From 1e3d5d70e918d624b9c00e7f0852866e1a49bafe Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 8 Mar 2007 19:00:15 +0000 Subject: [PATCH] - Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps. Tests were already moved by Fireball to rostests. svn path=/trunk/; revision=26033 --- rosapps/avtest/avtest.rbuild | 8 + rosapps/avtest/entry.c | 83 + rosapps/downloader/download.c | 303 + rosapps/downloader/downloader.rbuild | 34 + rosapps/downloader/downloader.rc | 10 + rosapps/downloader/main.c | 538 ++ .../internet/browser/browser.rbuild | 4 + .../internet/browser/firefox1509.dml | 7 + .../internet/browser/firefox2001.dml | 7 + .../packagetree/internet/category.xml | 54 + .../packagetree/internet/internet.rbuild | 6 + .../downloader/packagetree/packagetree.rbuild | 9 + .../packagetree/script/default_install.xml | 5 + .../packagetree/script/default_uninstall.xml | 1 + .../packagetree/script/script.rbuild | 3 + rosapps/downloader/packagetree/tree.xml | 142 + rosapps/downloader/resources.h | 48 + rosapps/downloader/resources/0.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/1.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/10.bmp | Bin 0 -> 824 bytes rosapps/downloader/resources/2.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/3.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/4.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/5.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/6.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/7.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/8.bmp | Bin 0 -> 822 bytes rosapps/downloader/resources/9.bmp | Bin 0 -> 824 bytes rosapps/downloader/resources/download.bmp | Bin 0 -> 13914 bytes rosapps/downloader/resources/help.bmp | Bin 0 -> 3126 bytes rosapps/downloader/resources/logo.bmp | Bin 0 -> 17414 bytes rosapps/downloader/resources/main.ico | Bin 0 -> 17542 bytes rosapps/downloader/resources/underline.bmp | Bin 0 -> 170 bytes rosapps/downloader/resources/uninstall.bmp | Bin 0 -> 13914 bytes rosapps/downloader/resources/update.bmp | Bin 0 -> 3126 bytes rosapps/downloader/rsrc.rc | 27 + rosapps/downloader/script.c | 246 + rosapps/downloader/structures.h | 40 + rosapps/downloader/translations/de.rc | 36 + rosapps/downloader/translations/en.rc | 36 + rosapps/downloader/translations/fr.rc | 36 + rosapps/downloader/translations/id.rc | 36 + rosapps/downloader/translations/it.rc | 36 + rosapps/downloader/xml.c | 525 ++ rosapps/ext2/attr.c | 136 + rosapps/ext2/blockdev.c | 155 + rosapps/ext2/dir.c | 338 ++ rosapps/ext2/ext2fs.h | 289 + rosapps/ext2/ext2fs.rc | 7 + rosapps/ext2/file.c | 61 + rosapps/ext2/inode.c | 148 + rosapps/ext2/quota.c | 49 + rosapps/ext2/rw.c | 219 + rosapps/ext2/security.c | 41 + rosapps/ext2/super.c | 201 + rosapps/gettype/gettype.c | 394 ++ rosapps/gettype/gettype.rbuild | 12 + rosapps/green/createclose.c | 38 + rosapps/green/dispatch.c | 105 + rosapps/green/green.c | 68 + rosapps/green/green.h | 192 + rosapps/green/green.inf | 96 + rosapps/green/green.rbuild | 16 + rosapps/green/green.rc | 5 + rosapps/green/keyboard.c | 321 ++ rosapps/green/misc.c | 114 + rosapps/green/pnp.c | 562 ++ rosapps/green/power.c | 58 + rosapps/green/screen.c | 674 +++ rosapps/imagesoft/about.c | 54 + rosapps/imagesoft/adjust.c | 525 ++ rosapps/imagesoft/brightness.c | 379 ++ rosapps/imagesoft/contrast.c | 380 ++ rosapps/imagesoft/custcombo.c | 213 + rosapps/imagesoft/floatwindow.c | 629 +++ rosapps/imagesoft/font.c | 178 + rosapps/imagesoft/imageprop.h | 49 + rosapps/imagesoft/imagesoft.c | 100 + rosapps/imagesoft/imagesoft.rbuild | 36 + rosapps/imagesoft/imagesoft.rc | 75 + rosapps/imagesoft/imgedwnd.c | 542 ++ rosapps/imagesoft/imgedwnd.h | 94 + rosapps/imagesoft/lang/en-GB.rc | 234 + rosapps/imagesoft/lang/en-US.rc | 234 + rosapps/imagesoft/lang/id-ID.rc | 234 + rosapps/imagesoft/lang/it-IT.rc | 234 + rosapps/imagesoft/lang/nb-NO.rc | 206 + rosapps/imagesoft/lang/th-TH.rc | 234 + rosapps/imagesoft/mainwnd.c | 1458 +++++ rosapps/imagesoft/mainwnd.h | 41 + rosapps/imagesoft/manifest.xml | 24 + rosapps/imagesoft/misc.c | 422 ++ rosapps/imagesoft/misc.h | 44 + rosapps/imagesoft/opensave.c | 87 + rosapps/imagesoft/precomp.h | 70 + .../res/cursors/PaintBrushToolCursor.cur | Bin 0 -> 326 bytes .../cursors/PaintBrushToolCursorMouseDown.cur | Bin 0 -> 326 bytes .../imagesoft/res/icons/color/ColorLess.bmp | Bin 0 -> 670 bytes .../imagesoft/res/icons/color/ColorMore.bmp | Bin 0 -> 450 bytes rosapps/imagesoft/res/icons/hist/HistBack.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/hist/HistDelete.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/hist/HistForward.bmp | Bin 0 -> 824 bytes rosapps/imagesoft/res/icons/hist/HistRedo.bmp | Bin 0 -> 824 bytes rosapps/imagesoft/res/icons/hist/HistUndo.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainCopyIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainCutIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainNewIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainOpenIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainPasteIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainPrintIcon.bmp | Bin 0 -> 824 bytes .../res/icons/std/MainPrintPreIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainRedoIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainSaveIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/std/MainUndoIcon.bmp | Bin 0 -> 824 bytes .../res/icons/text/TextAlignCenterIcon.bmp | Bin 0 -> 824 bytes .../res/icons/text/TextAlignLeftIcon.bmp | Bin 0 -> 822 bytes .../res/icons/text/TextAlignRightIcon.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/text/TextBoldIcon.bmp | Bin 0 -> 824 bytes .../res/icons/text/TextItalicIcon.bmp | Bin 0 -> 824 bytes .../res/icons/text/TextUnderlineIcon.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsCloneStamp.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsColorPicker.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsEllipse.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsEllipseSelect.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/tools/ToolsEraser.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsFreeformShape.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsLassoSelect.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/tools/ToolsLine.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsMagicWand.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/tools/ToolsMove.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsMoveSelection.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsPaintBrush.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsPaintBucket.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/tools/ToolsPencil.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsRecoloring.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsRectangle.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsRectangleSelect.bmp | Bin 0 -> 824 bytes .../res/icons/tools/ToolsRoundedRectangle.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/tools/ToolsText.bmp | Bin 0 -> 824 bytes .../imagesoft/res/icons/tools/ToolsZoom.bmp | Bin 0 -> 824 bytes rosapps/imagesoft/res/imagesoft.ico | Bin 0 -> 29926 bytes rosapps/imagesoft/resource.h | 297 + rosapps/imagesoft/rsrc.rc | 16 + rosapps/imagesoft/tooldock.c | 1138 ++++ rosapps/imagesoft/tooldock.h | 115 + rosapps/net/dhcpd/AUTHORS | 3 + rosapps/net/dhcpd/COPYING | 222 + rosapps/net/dhcpd/ChangeLog | 18 + rosapps/net/dhcpd/INSTALL | 188 + rosapps/net/dhcpd/Makefile.am | 1 + rosapps/net/dhcpd/Makefile.in | 352 ++ rosapps/net/dhcpd/NEWS | 2 + rosapps/net/dhcpd/README | 19 + rosapps/net/dhcpd/README.ROS | 6 + rosapps/net/dhcpd/TODO | 8 + rosapps/net/dhcpd/aclocal.m4 | 104 + rosapps/net/dhcpd/config.cache | 26 + rosapps/net/dhcpd/config.h | 25 + rosapps/net/dhcpd/config.h.in | 24 + rosapps/net/dhcpd/config.h.top | 1 + rosapps/net/dhcpd/config.log | 22 + rosapps/net/dhcpd/config.status | 251 + rosapps/net/dhcpd/configure | 1678 ++++++ rosapps/net/dhcpd/configure.in | 24 + rosapps/net/dhcpd/dhcpd.rc | 6 + rosapps/net/dhcpd/install-sh | 251 + rosapps/net/dhcpd/missing | 190 + rosapps/net/dhcpd/mkinstalldirs | 40 + rosapps/net/dhcpd/samples/dhcp.conf | 8 + rosapps/net/dhcpd/src/Makefile.am | 6 + rosapps/net/dhcpd/src/Makefile.in | 388 ++ rosapps/net/dhcpd/src/dhcp.conf | 9 + rosapps/net/dhcpd/src/display/display.c | 61 + rosapps/net/dhcpd/src/include/datatypes.h | 56 + rosapps/net/dhcpd/src/include/display.h | 6 + rosapps/net/dhcpd/src/include/headers.h | 25 + rosapps/net/dhcpd/src/include/iputils.h | 7 + rosapps/net/dhcpd/src/include/leases.h | 10 + rosapps/net/dhcpd/src/include/lock.h | 11 + rosapps/net/dhcpd/src/include/macutils.h | 7 + rosapps/net/dhcpd/src/include/options.h | 118 + rosapps/net/dhcpd/src/include/parser.h | 8 + rosapps/net/dhcpd/src/include/utils.h | 7 + rosapps/net/dhcpd/src/include/wutils.h | 6 + rosapps/net/dhcpd/src/leases/leases.c | 231 + rosapps/net/dhcpd/src/lock/locker.c | 40 + rosapps/net/dhcpd/src/main.c | 72 + rosapps/net/dhcpd/src/parsing/parser.c | 402 ++ rosapps/net/dhcpd/src/utils/iputils.c | 59 + rosapps/net/dhcpd/src/utils/macutils.c | 46 + rosapps/net/dhcpd/src/utils/macutils.h | 8 + rosapps/net/dhcpd/src/utils/utils.h | 6 + rosapps/net/dhcpd/src/utils/wutils.c | 9 + rosapps/net/dhcpd/stamp-h | 1 + rosapps/net/dhcpd/stamp-h.in | 1 + rosapps/net/tditest/DIRS | 1 + rosapps/net/tditest/include/debug.h | 89 + rosapps/net/tditest/include/tditest.h | 127 + rosapps/net/tditest/readme.txt | 18 + rosapps/net/tditest/tditest.def | 7 + rosapps/net/tditest/tditest.rc | 7 + rosapps/net/tditest/tditest/SOURCES | 14 + rosapps/net/tditest/tditest/tditest.c | 961 ++++ rosapps/ramdrv/minix/bitops.c | 203 + rosapps/ramdrv/minix/bitops.h | 30 + rosapps/ramdrv/minix/block.c | 109 + rosapps/ramdrv/minix/blockdev.c | 154 + rosapps/ramdrv/minix/cache.c | 45 + rosapps/ramdrv/minix/dir.c | 234 + rosapps/ramdrv/minix/inode.c | 136 + rosapps/ramdrv/minix/minix.h | 133 + rosapps/ramdrv/minix/minix.rc | 7 + rosapps/ramdrv/minix/minix_fs.h | 80 + rosapps/ramdrv/minix/mount.c | 160 + rosapps/ramdrv/minix/rw.c | 162 + rosapps/ramdrv/ramdrv.c | 242 + rosapps/ramdrv/ramdrv.h | 8 + rosapps/ramdrv/ramdrv.rbuild | 10 + rosapps/ramdrv/ramdrv.rc | 5 + rosapps/roshttpd/common/list.cpp | 94 + rosapps/roshttpd/common/roshttpd.rc | 6 + rosapps/roshttpd/common/socket.cpp | 344 ++ rosapps/roshttpd/common/thread.cpp | 80 + rosapps/roshttpd/config.cpp | 131 + rosapps/roshttpd/error.cpp | 16 + rosapps/roshttpd/http.cpp | 377 ++ rosapps/roshttpd/httpd.cpp | 492 ++ rosapps/roshttpd/include/config.h | 49 + rosapps/roshttpd/include/debug.h | 17 + rosapps/roshttpd/include/error.h | 15 + rosapps/roshttpd/include/http.h | 57 + rosapps/roshttpd/include/httpd.h | 85 + rosapps/roshttpd/include/iterator.h | 22 + rosapps/roshttpd/include/list.h | 233 + rosapps/roshttpd/include/socket.h | 140 + rosapps/roshttpd/include/thread.h | 34 + rosapps/roshttpd/roshttpd.cpp | 66 + rosapps/roshttpd/roshttpd.rbuild | 23 + rosapps/screenshot/screenshot.c | 404 ++ rosapps/screenshot/screenshot.h | 15 + rosapps/screenshot/screenshot.rbuild | 14 + rosapps/screenshot/screenshot.rc | 10 + rosapps/screenshot/snap.ico | Bin 0 -> 29926 bytes .../sysutils/utils/binpatch/binpatch.rbuild | 7 + rosapps/sysutils/utils/binpatch/patch.c | 616 ++ rosapps/sysutils/utils/cat/cat.c | 26 + rosapps/sysutils/utils/cat/cat.rbuild | 7 + rosapps/sysutils/utils/driver/driver.rbuild | 8 + rosapps/sysutils/utils/driver/load/load.c | 33 + .../sysutils/utils/driver/load/load.rbuild | 8 + rosapps/sysutils/utils/driver/unload/unload.c | 33 + .../utils/driver/unload/unload.rbuild | 8 + rosapps/sysutils/utils/infinst/infinst.c | 84 + rosapps/sysutils/utils/infinst/infinst.rbuild | 10 + .../sysutils/utils/nts2w32err/nts2w32err.c | 56 + .../utils/nts2w32err/nts2w32err.rbuild | 7 + rosapps/sysutils/utils/objdir/objdir.c | 380 ++ rosapps/sysutils/utils/objdir/objdir.rbuild | 9 + rosapps/sysutils/utils/partinfo/partinfo.c | 212 + .../sysutils/utils/partinfo/partinfo.rbuild | 7 + rosapps/sysutils/utils/pice/loader/main.c | 1001 ++++ rosapps/sysutils/utils/pice/loader/retypes.h | 15 + rosapps/sysutils/utils/pice/loader/stab.def | 264 + rosapps/sysutils/utils/pice/loader/stab_gnu.h | 37 + rosapps/sysutils/utils/pice/loader/stdinc.h | 28 + rosapps/sysutils/utils/pice/loader/terminal.c | 430 ++ rosapps/sysutils/utils/pice/loader/terminal.h | 34 + .../sysutils/utils/pice/module/animation.h | 2116 +++++++ rosapps/sysutils/utils/pice/module/bp.c | 752 +++ rosapps/sysutils/utils/pice/module/bp.h | 62 + rosapps/sysutils/utils/pice/module/charset.h | 2564 +++++++++ rosapps/sysutils/utils/pice/module/dblflt.c | 133 + rosapps/sysutils/utils/pice/module/dblflt.h | 32 + rosapps/sysutils/utils/pice/module/debug.c | 192 + rosapps/sysutils/utils/pice/module/debug.h | 47 + .../sysutils/utils/pice/module/disassembler.c | 716 +++ .../sysutils/utils/pice/module/disassembler.h | 159 + .../utils/pice/module/disassemblerdata.h | 1802 ++++++ .../utils/pice/module/disassemblerdefines.h | 515 ++ rosapps/sysutils/utils/pice/module/gpfault.c | 142 + rosapps/sysutils/utils/pice/module/gpfault.h | 34 + rosapps/sysutils/utils/pice/module/hardware.c | 1042 ++++ rosapps/sysutils/utils/pice/module/hardware.h | 166 + rosapps/sysutils/utils/pice/module/hercules.c | 486 ++ rosapps/sysutils/utils/pice/module/hercules.h | 32 + rosapps/sysutils/utils/pice/module/hooks.c | 177 + rosapps/sysutils/utils/pice/module/hooks.h | 49 + rosapps/sysutils/utils/pice/module/init.c | 379 ++ rosapps/sysutils/utils/pice/module/init.h | 35 + rosapps/sysutils/utils/pice/module/ldrsym.h | 38 + rosapps/sysutils/utils/pice/module/logo.h | 100 + rosapps/sysutils/utils/pice/module/output.c | 290 + rosapps/sysutils/utils/pice/module/output.h | 42 + rosapps/sysutils/utils/pice/module/parse.c | 4102 ++++++++++++++ rosapps/sysutils/utils/pice/module/parse.h | 182 + rosapps/sysutils/utils/pice/module/patch.c | 235 + rosapps/sysutils/utils/pice/module/patch.h | 34 + rosapps/sysutils/utils/pice/module/pci_ids.h | 905 +++ rosapps/sysutils/utils/pice/module/pgflt.c | 402 ++ rosapps/sysutils/utils/pice/module/pgflt.h | 34 + rosapps/sysutils/utils/pice/module/pice.rc | 7 + rosapps/sysutils/utils/pice/module/pice_ver.h | 36 + rosapps/sysutils/utils/pice/module/precomp.h | 65 + .../sysutils/utils/pice/module/privateice.c | 203 + rosapps/sysutils/utils/pice/module/regs.h | 122 + rosapps/sysutils/utils/pice/module/remods.h | 33 + rosapps/sysutils/utils/pice/module/retypes.h | 52 + .../sysutils/utils/pice/module/scancodes.h | 106 + rosapps/sysutils/utils/pice/module/serial.c | 656 +++ rosapps/sysutils/utils/pice/module/serial.h | 36 + .../sysutils/utils/pice/module/serial_port.h | 173 + rosapps/sysutils/utils/pice/module/shell.c | 1692 ++++++ rosapps/sysutils/utils/pice/module/shell.h | 91 + rosapps/sysutils/utils/pice/module/stab.def | 265 + rosapps/sysutils/utils/pice/module/stab_gnu.h | 67 + rosapps/sysutils/utils/pice/module/symbols.c | 2984 ++++++++++ rosapps/sysutils/utils/pice/module/symbols.h | 88 + rosapps/sysutils/utils/pice/module/syscall.c | 231 + rosapps/sysutils/utils/pice/module/syscall.h | 35 + rosapps/sysutils/utils/pice/module/trace.c | 91 + rosapps/sysutils/utils/pice/module/trace.h | 35 + rosapps/sysutils/utils/pice/module/utils.c | 2430 ++++++++ rosapps/sysutils/utils/pice/module/utils.h | 325 ++ rosapps/sysutils/utils/pice/module/vga.c | 572 ++ rosapps/sysutils/utils/pice/module/vga.h | 32 + .../sysutils/utils/pice/module/vga_utils.asm | 729 +++ rosapps/sysutils/utils/pice/pice.cfg | 4 + rosapps/sysutils/utils/pice/readme.txt | 107 + rosapps/sysutils/utils/pice/shared/shared.h | 204 + rosapps/sysutils/utils/pnpdump/pnpdump.c | 855 +++ rosapps/sysutils/utils/ps/ps.c | 281 + rosapps/sysutils/utils/ps/ps.c.toolhelp | 70 + rosapps/sysutils/utils/ps/ps.rbuild | 8 + rosapps/sysutils/utils/rosperf/alphablend.c | 88 + rosapps/sysutils/utils/rosperf/fill.c | 60 + rosapps/sysutils/utils/rosperf/gradient.c | 154 + rosapps/sysutils/utils/rosperf/lines.c | 97 + rosapps/sysutils/utils/rosperf/rosperf.c | 923 +++ rosapps/sysutils/utils/rosperf/rosperf.h | 74 + rosapps/sysutils/utils/rosperf/rosperf.rbuild | 22 + rosapps/sysutils/utils/rosperf/rosperf.rc | 4 + rosapps/sysutils/utils/rosperf/testlist.c | 44 + rosapps/sysutils/utils/rosperf/text.c | 44 + rosapps/sysutils/utils/sdkparse/EnumDirs.h | 15 + .../sysutils/utils/sdkparse/EnumDirsImpl.h | 42 + rosapps/sysutils/utils/sdkparse/EnumFiles.h | 11 + .../sysutils/utils/sdkparse/EnumFilesImpl.h | 92 + rosapps/sysutils/utils/sdkparse/File.cpp | 129 + rosapps/sysutils/utils/sdkparse/File.h | 111 + rosapps/sysutils/utils/sdkparse/FixLFN.h | 32 + rosapps/sysutils/utils/sdkparse/Header.h | 26 + rosapps/sysutils/utils/sdkparse/Symbol.h | 18 + rosapps/sysutils/utils/sdkparse/Type.h | 22 + rosapps/sysutils/utils/sdkparse/assert.h | 47 + .../sysutils/utils/sdkparse/binary2cstr.cpp | 49 + rosapps/sysutils/utils/sdkparse/binary2cstr.h | 10 + rosapps/sysutils/utils/sdkparse/input.lst | 349 ++ rosapps/sysutils/utils/sdkparse/iskeyword.cpp | 138 + rosapps/sysutils/utils/sdkparse/iskeyword.h | 8 + rosapps/sysutils/utils/sdkparse/safestr.h | 61 + rosapps/sysutils/utils/sdkparse/sdkparse.cpp | 988 ++++ rosapps/sysutils/utils/sdkparse/sdkparse.dsp | 169 + rosapps/sysutils/utils/sdkparse/sdkparse.dsw | 29 + rosapps/sysutils/utils/sdkparse/skip_ws.cpp | 17 + rosapps/sysutils/utils/sdkparse/skip_ws.h | 10 + .../utils/sdkparse/strip_comments.cpp | 43 + .../sysutils/utils/sdkparse/strip_comments.h | 10 + rosapps/sysutils/utils/sdkparse/test.h | 263 + rosapps/sysutils/utils/sdkparse/tokenize.cpp | 312 ++ rosapps/sysutils/utils/sdkparse/tokenize.h | 8 + rosapps/sysutils/utils/stats/stats.c | 478 ++ rosapps/sysutils/utils/stats/stats.rbuild | 9 + .../sysutils/utils/theme/dump/manifest.rbuild | 24 + .../sysutils/utils/theme/dump/themedump.bpr | 116 + .../sysutils/utils/theme/dump/themedump.cpp | 642 +++ .../sysutils/utils/theme/dump/themedump.rc | 6 + rosapps/sysutils/utils/tickcount/tickcount.c | 191 + .../sysutils/utils/tickcount/tickcount.rbuild | 9 + rosapps/sysutils/utils/utils.rbuild | 35 + rosapps/templates/template/template.c | 284 + rosapps/winefile/Doxyfile | 1213 ++++ rosapps/winefile/Makefile-MinGW | 56 + rosapps/winefile/doxy-footer.html | 16 + rosapps/winefile/doxy-footer.htmt | 16 + rosapps/winefile/drivebar.bmp | Bin 0 -> 742 bytes rosapps/winefile/images.bmp | Bin 0 -> 1158 bytes rosapps/winefile/lang/cs-CZ.rc | 212 + rosapps/winefile/lang/de-DE.rc | 262 + rosapps/winefile/lang/en-US.rc | 290 + rosapps/winefile/lang/es-ES.rc | 258 + rosapps/winefile/lang/fr-FR.rc | 266 + rosapps/winefile/lang/hu-HU.rc | 163 + rosapps/winefile/lang/it-IT.rc | 183 + rosapps/winefile/lang/nb-NO.rc | 290 + rosapps/winefile/lang/nl-NL.rc | 160 + rosapps/winefile/lang/pl-PL.rc | 183 + rosapps/winefile/lang/pt-PT.rc | 335 ++ rosapps/winefile/lang/ru-RU.rc | 288 + rosapps/winefile/lang/sl-SI.rc | 161 + rosapps/winefile/lang/sv-SE.rc | 209 + rosapps/winefile/lang/zh-CN.rc | 161 + rosapps/winefile/make-docu.sh | 2 + rosapps/winefile/make_winefile.dsp | 93 + rosapps/winefile/make_winefile.vcproj | 77 + rosapps/winefile/makel-docu.bat | 3 + rosapps/winefile/resource.h | 151 + rosapps/winefile/resource.rc | 293 + rosapps/winefile/splitpath.c | 155 + rosapps/winefile/toolbar.bmp | Bin 0 -> 1438 bytes rosapps/winefile/winefile.c | 4929 +++++++++++++++++ rosapps/winefile/winefile.dsp | 269 + rosapps/winefile/winefile.dsw | 41 + rosapps/winefile/winefile.h | 166 + rosapps/winefile/winefile.ico | Bin 0 -> 2734 bytes rosapps/winefile/winefile.rbuild | 23 + rosapps/winefile/winefile.rc | 44 + rosapps/winefile/winefile.sln | 34 + rosapps/winefile/winefile.vcproj | 1220 ++++ rosapps/winver/winver.c | 12 + rosapps/winver/winver.rbuild | 11 + 420 files changed, 78215 insertions(+) create mode 100755 rosapps/avtest/avtest.rbuild create mode 100755 rosapps/avtest/entry.c create mode 100644 rosapps/downloader/download.c create mode 100644 rosapps/downloader/downloader.rbuild create mode 100644 rosapps/downloader/downloader.rc create mode 100644 rosapps/downloader/main.c create mode 100644 rosapps/downloader/packagetree/internet/browser/browser.rbuild create mode 100644 rosapps/downloader/packagetree/internet/browser/firefox1509.dml create mode 100644 rosapps/downloader/packagetree/internet/browser/firefox2001.dml create mode 100644 rosapps/downloader/packagetree/internet/category.xml create mode 100644 rosapps/downloader/packagetree/internet/internet.rbuild create mode 100644 rosapps/downloader/packagetree/packagetree.rbuild create mode 100644 rosapps/downloader/packagetree/script/default_install.xml create mode 100644 rosapps/downloader/packagetree/script/default_uninstall.xml create mode 100644 rosapps/downloader/packagetree/script/script.rbuild create mode 100644 rosapps/downloader/packagetree/tree.xml create mode 100644 rosapps/downloader/resources.h create mode 100644 rosapps/downloader/resources/0.bmp create mode 100644 rosapps/downloader/resources/1.bmp create mode 100644 rosapps/downloader/resources/10.bmp create mode 100644 rosapps/downloader/resources/2.bmp create mode 100644 rosapps/downloader/resources/3.bmp create mode 100644 rosapps/downloader/resources/4.bmp create mode 100644 rosapps/downloader/resources/5.bmp create mode 100644 rosapps/downloader/resources/6.bmp create mode 100644 rosapps/downloader/resources/7.bmp create mode 100644 rosapps/downloader/resources/8.bmp create mode 100644 rosapps/downloader/resources/9.bmp create mode 100644 rosapps/downloader/resources/download.bmp create mode 100644 rosapps/downloader/resources/help.bmp create mode 100644 rosapps/downloader/resources/logo.bmp create mode 100644 rosapps/downloader/resources/main.ico create mode 100644 rosapps/downloader/resources/underline.bmp create mode 100644 rosapps/downloader/resources/uninstall.bmp create mode 100644 rosapps/downloader/resources/update.bmp create mode 100644 rosapps/downloader/rsrc.rc create mode 100644 rosapps/downloader/script.c create mode 100644 rosapps/downloader/structures.h create mode 100644 rosapps/downloader/translations/de.rc create mode 100644 rosapps/downloader/translations/en.rc create mode 100644 rosapps/downloader/translations/fr.rc create mode 100644 rosapps/downloader/translations/id.rc create mode 100644 rosapps/downloader/translations/it.rc create mode 100644 rosapps/downloader/xml.c create mode 100644 rosapps/ext2/attr.c create mode 100644 rosapps/ext2/blockdev.c create mode 100644 rosapps/ext2/dir.c create mode 100644 rosapps/ext2/ext2fs.h create mode 100644 rosapps/ext2/ext2fs.rc create mode 100644 rosapps/ext2/file.c create mode 100644 rosapps/ext2/inode.c create mode 100644 rosapps/ext2/quota.c create mode 100644 rosapps/ext2/rw.c create mode 100644 rosapps/ext2/security.c create mode 100644 rosapps/ext2/super.c create mode 100644 rosapps/gettype/gettype.c create mode 100644 rosapps/gettype/gettype.rbuild create mode 100644 rosapps/green/createclose.c create mode 100644 rosapps/green/dispatch.c create mode 100644 rosapps/green/green.c create mode 100644 rosapps/green/green.h create mode 100644 rosapps/green/green.inf create mode 100644 rosapps/green/green.rbuild create mode 100644 rosapps/green/green.rc create mode 100644 rosapps/green/keyboard.c create mode 100644 rosapps/green/misc.c create mode 100644 rosapps/green/pnp.c create mode 100644 rosapps/green/power.c create mode 100644 rosapps/green/screen.c create mode 100644 rosapps/imagesoft/about.c create mode 100644 rosapps/imagesoft/adjust.c create mode 100644 rosapps/imagesoft/brightness.c create mode 100644 rosapps/imagesoft/contrast.c create mode 100644 rosapps/imagesoft/custcombo.c create mode 100644 rosapps/imagesoft/floatwindow.c create mode 100644 rosapps/imagesoft/font.c create mode 100644 rosapps/imagesoft/imageprop.h create mode 100644 rosapps/imagesoft/imagesoft.c create mode 100644 rosapps/imagesoft/imagesoft.rbuild create mode 100644 rosapps/imagesoft/imagesoft.rc create mode 100644 rosapps/imagesoft/imgedwnd.c create mode 100644 rosapps/imagesoft/imgedwnd.h create mode 100644 rosapps/imagesoft/lang/en-GB.rc create mode 100644 rosapps/imagesoft/lang/en-US.rc create mode 100644 rosapps/imagesoft/lang/id-ID.rc create mode 100644 rosapps/imagesoft/lang/it-IT.rc create mode 100644 rosapps/imagesoft/lang/nb-NO.rc create mode 100644 rosapps/imagesoft/lang/th-TH.rc create mode 100644 rosapps/imagesoft/mainwnd.c create mode 100644 rosapps/imagesoft/mainwnd.h create mode 100644 rosapps/imagesoft/manifest.xml create mode 100644 rosapps/imagesoft/misc.c create mode 100644 rosapps/imagesoft/misc.h create mode 100644 rosapps/imagesoft/opensave.c create mode 100644 rosapps/imagesoft/precomp.h create mode 100644 rosapps/imagesoft/res/cursors/PaintBrushToolCursor.cur create mode 100644 rosapps/imagesoft/res/cursors/PaintBrushToolCursorMouseDown.cur create mode 100644 rosapps/imagesoft/res/icons/color/ColorLess.bmp create mode 100644 rosapps/imagesoft/res/icons/color/ColorMore.bmp create mode 100644 rosapps/imagesoft/res/icons/hist/HistBack.bmp create mode 100644 rosapps/imagesoft/res/icons/hist/HistDelete.bmp create mode 100644 rosapps/imagesoft/res/icons/hist/HistForward.bmp create mode 100644 rosapps/imagesoft/res/icons/hist/HistRedo.bmp create mode 100644 rosapps/imagesoft/res/icons/hist/HistUndo.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainCopyIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainCutIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainNewIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainOpenIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainPasteIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainPrintIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainPrintPreIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainRedoIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainSaveIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/std/MainUndoIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/text/TextAlignCenterIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/text/TextAlignLeftIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/text/TextAlignRightIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/text/TextBoldIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/text/TextItalicIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/text/TextUnderlineIcon.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsCloneStamp.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsColorPicker.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsEllipse.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsEllipseSelect.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsEraser.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsFreeformShape.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsLassoSelect.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsLine.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsMagicWand.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsMove.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsMoveSelection.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsPaintBrush.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsPaintBucket.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsPencil.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsRecoloring.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsRectangle.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsRectangleSelect.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsRoundedRectangle.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsText.bmp create mode 100644 rosapps/imagesoft/res/icons/tools/ToolsZoom.bmp create mode 100644 rosapps/imagesoft/res/imagesoft.ico create mode 100644 rosapps/imagesoft/resource.h create mode 100644 rosapps/imagesoft/rsrc.rc create mode 100644 rosapps/imagesoft/tooldock.c create mode 100644 rosapps/imagesoft/tooldock.h create mode 100644 rosapps/net/dhcpd/AUTHORS create mode 100644 rosapps/net/dhcpd/COPYING create mode 100644 rosapps/net/dhcpd/ChangeLog create mode 100644 rosapps/net/dhcpd/INSTALL create mode 100644 rosapps/net/dhcpd/Makefile.am create mode 100644 rosapps/net/dhcpd/Makefile.in create mode 100644 rosapps/net/dhcpd/NEWS create mode 100644 rosapps/net/dhcpd/README create mode 100644 rosapps/net/dhcpd/README.ROS create mode 100644 rosapps/net/dhcpd/TODO create mode 100644 rosapps/net/dhcpd/aclocal.m4 create mode 100644 rosapps/net/dhcpd/config.cache create mode 100644 rosapps/net/dhcpd/config.h create mode 100644 rosapps/net/dhcpd/config.h.in create mode 100644 rosapps/net/dhcpd/config.h.top create mode 100644 rosapps/net/dhcpd/config.log create mode 100644 rosapps/net/dhcpd/config.status create mode 100644 rosapps/net/dhcpd/configure create mode 100644 rosapps/net/dhcpd/configure.in create mode 100644 rosapps/net/dhcpd/dhcpd.rc create mode 100644 rosapps/net/dhcpd/install-sh create mode 100644 rosapps/net/dhcpd/missing create mode 100644 rosapps/net/dhcpd/mkinstalldirs create mode 100644 rosapps/net/dhcpd/samples/dhcp.conf create mode 100644 rosapps/net/dhcpd/src/Makefile.am create mode 100644 rosapps/net/dhcpd/src/Makefile.in create mode 100644 rosapps/net/dhcpd/src/dhcp.conf create mode 100644 rosapps/net/dhcpd/src/display/display.c create mode 100644 rosapps/net/dhcpd/src/include/datatypes.h create mode 100644 rosapps/net/dhcpd/src/include/display.h create mode 100644 rosapps/net/dhcpd/src/include/headers.h create mode 100644 rosapps/net/dhcpd/src/include/iputils.h create mode 100644 rosapps/net/dhcpd/src/include/leases.h create mode 100644 rosapps/net/dhcpd/src/include/lock.h create mode 100644 rosapps/net/dhcpd/src/include/macutils.h create mode 100644 rosapps/net/dhcpd/src/include/options.h create mode 100644 rosapps/net/dhcpd/src/include/parser.h create mode 100644 rosapps/net/dhcpd/src/include/utils.h create mode 100644 rosapps/net/dhcpd/src/include/wutils.h create mode 100644 rosapps/net/dhcpd/src/leases/leases.c create mode 100644 rosapps/net/dhcpd/src/lock/locker.c create mode 100644 rosapps/net/dhcpd/src/main.c create mode 100644 rosapps/net/dhcpd/src/parsing/parser.c create mode 100644 rosapps/net/dhcpd/src/utils/iputils.c create mode 100644 rosapps/net/dhcpd/src/utils/macutils.c create mode 100644 rosapps/net/dhcpd/src/utils/macutils.h create mode 100644 rosapps/net/dhcpd/src/utils/utils.h create mode 100644 rosapps/net/dhcpd/src/utils/wutils.c create mode 100644 rosapps/net/dhcpd/stamp-h create mode 100644 rosapps/net/dhcpd/stamp-h.in create mode 100644 rosapps/net/tditest/DIRS create mode 100644 rosapps/net/tditest/include/debug.h create mode 100644 rosapps/net/tditest/include/tditest.h create mode 100644 rosapps/net/tditest/readme.txt create mode 100644 rosapps/net/tditest/tditest.def create mode 100644 rosapps/net/tditest/tditest.rc create mode 100644 rosapps/net/tditest/tditest/SOURCES create mode 100644 rosapps/net/tditest/tditest/tditest.c create mode 100644 rosapps/ramdrv/minix/bitops.c create mode 100644 rosapps/ramdrv/minix/bitops.h create mode 100644 rosapps/ramdrv/minix/block.c create mode 100644 rosapps/ramdrv/minix/blockdev.c create mode 100644 rosapps/ramdrv/minix/cache.c create mode 100644 rosapps/ramdrv/minix/dir.c create mode 100644 rosapps/ramdrv/minix/inode.c create mode 100644 rosapps/ramdrv/minix/minix.h create mode 100644 rosapps/ramdrv/minix/minix.rc create mode 100644 rosapps/ramdrv/minix/minix_fs.h create mode 100644 rosapps/ramdrv/minix/mount.c create mode 100644 rosapps/ramdrv/minix/rw.c create mode 100644 rosapps/ramdrv/ramdrv.c create mode 100644 rosapps/ramdrv/ramdrv.h create mode 100644 rosapps/ramdrv/ramdrv.rbuild create mode 100644 rosapps/ramdrv/ramdrv.rc create mode 100644 rosapps/roshttpd/common/list.cpp create mode 100644 rosapps/roshttpd/common/roshttpd.rc create mode 100644 rosapps/roshttpd/common/socket.cpp create mode 100644 rosapps/roshttpd/common/thread.cpp create mode 100644 rosapps/roshttpd/config.cpp create mode 100644 rosapps/roshttpd/error.cpp create mode 100644 rosapps/roshttpd/http.cpp create mode 100644 rosapps/roshttpd/httpd.cpp create mode 100644 rosapps/roshttpd/include/config.h create mode 100644 rosapps/roshttpd/include/debug.h create mode 100644 rosapps/roshttpd/include/error.h create mode 100644 rosapps/roshttpd/include/http.h create mode 100644 rosapps/roshttpd/include/httpd.h create mode 100644 rosapps/roshttpd/include/iterator.h create mode 100644 rosapps/roshttpd/include/list.h create mode 100644 rosapps/roshttpd/include/socket.h create mode 100644 rosapps/roshttpd/include/thread.h create mode 100644 rosapps/roshttpd/roshttpd.cpp create mode 100644 rosapps/roshttpd/roshttpd.rbuild create mode 100644 rosapps/screenshot/screenshot.c create mode 100644 rosapps/screenshot/screenshot.h create mode 100644 rosapps/screenshot/screenshot.rbuild create mode 100644 rosapps/screenshot/screenshot.rc create mode 100644 rosapps/screenshot/snap.ico create mode 100644 rosapps/sysutils/utils/binpatch/binpatch.rbuild create mode 100644 rosapps/sysutils/utils/binpatch/patch.c create mode 100644 rosapps/sysutils/utils/cat/cat.c create mode 100644 rosapps/sysutils/utils/cat/cat.rbuild create mode 100644 rosapps/sysutils/utils/driver/driver.rbuild create mode 100644 rosapps/sysutils/utils/driver/load/load.c create mode 100644 rosapps/sysutils/utils/driver/load/load.rbuild create mode 100644 rosapps/sysutils/utils/driver/unload/unload.c create mode 100644 rosapps/sysutils/utils/driver/unload/unload.rbuild create mode 100644 rosapps/sysutils/utils/infinst/infinst.c create mode 100644 rosapps/sysutils/utils/infinst/infinst.rbuild create mode 100644 rosapps/sysutils/utils/nts2w32err/nts2w32err.c create mode 100644 rosapps/sysutils/utils/nts2w32err/nts2w32err.rbuild create mode 100644 rosapps/sysutils/utils/objdir/objdir.c create mode 100644 rosapps/sysutils/utils/objdir/objdir.rbuild create mode 100644 rosapps/sysutils/utils/partinfo/partinfo.c create mode 100644 rosapps/sysutils/utils/partinfo/partinfo.rbuild create mode 100644 rosapps/sysutils/utils/pice/loader/main.c create mode 100644 rosapps/sysutils/utils/pice/loader/retypes.h create mode 100644 rosapps/sysutils/utils/pice/loader/stab.def create mode 100644 rosapps/sysutils/utils/pice/loader/stab_gnu.h create mode 100644 rosapps/sysutils/utils/pice/loader/stdinc.h create mode 100644 rosapps/sysutils/utils/pice/loader/terminal.c create mode 100644 rosapps/sysutils/utils/pice/loader/terminal.h create mode 100644 rosapps/sysutils/utils/pice/module/animation.h create mode 100644 rosapps/sysutils/utils/pice/module/bp.c create mode 100644 rosapps/sysutils/utils/pice/module/bp.h create mode 100644 rosapps/sysutils/utils/pice/module/charset.h create mode 100644 rosapps/sysutils/utils/pice/module/dblflt.c create mode 100644 rosapps/sysutils/utils/pice/module/dblflt.h create mode 100644 rosapps/sysutils/utils/pice/module/debug.c create mode 100644 rosapps/sysutils/utils/pice/module/debug.h create mode 100644 rosapps/sysutils/utils/pice/module/disassembler.c create mode 100644 rosapps/sysutils/utils/pice/module/disassembler.h create mode 100644 rosapps/sysutils/utils/pice/module/disassemblerdata.h create mode 100644 rosapps/sysutils/utils/pice/module/disassemblerdefines.h create mode 100644 rosapps/sysutils/utils/pice/module/gpfault.c create mode 100644 rosapps/sysutils/utils/pice/module/gpfault.h create mode 100644 rosapps/sysutils/utils/pice/module/hardware.c create mode 100644 rosapps/sysutils/utils/pice/module/hardware.h create mode 100644 rosapps/sysutils/utils/pice/module/hercules.c create mode 100644 rosapps/sysutils/utils/pice/module/hercules.h create mode 100644 rosapps/sysutils/utils/pice/module/hooks.c create mode 100644 rosapps/sysutils/utils/pice/module/hooks.h create mode 100644 rosapps/sysutils/utils/pice/module/init.c create mode 100644 rosapps/sysutils/utils/pice/module/init.h create mode 100644 rosapps/sysutils/utils/pice/module/ldrsym.h create mode 100644 rosapps/sysutils/utils/pice/module/logo.h create mode 100644 rosapps/sysutils/utils/pice/module/output.c create mode 100644 rosapps/sysutils/utils/pice/module/output.h create mode 100644 rosapps/sysutils/utils/pice/module/parse.c create mode 100644 rosapps/sysutils/utils/pice/module/parse.h create mode 100644 rosapps/sysutils/utils/pice/module/patch.c create mode 100644 rosapps/sysutils/utils/pice/module/patch.h create mode 100644 rosapps/sysutils/utils/pice/module/pci_ids.h create mode 100644 rosapps/sysutils/utils/pice/module/pgflt.c create mode 100644 rosapps/sysutils/utils/pice/module/pgflt.h create mode 100644 rosapps/sysutils/utils/pice/module/pice.rc create mode 100644 rosapps/sysutils/utils/pice/module/pice_ver.h create mode 100644 rosapps/sysutils/utils/pice/module/precomp.h create mode 100644 rosapps/sysutils/utils/pice/module/privateice.c create mode 100644 rosapps/sysutils/utils/pice/module/regs.h create mode 100644 rosapps/sysutils/utils/pice/module/remods.h create mode 100644 rosapps/sysutils/utils/pice/module/retypes.h create mode 100644 rosapps/sysutils/utils/pice/module/scancodes.h create mode 100644 rosapps/sysutils/utils/pice/module/serial.c create mode 100644 rosapps/sysutils/utils/pice/module/serial.h create mode 100644 rosapps/sysutils/utils/pice/module/serial_port.h create mode 100644 rosapps/sysutils/utils/pice/module/shell.c create mode 100644 rosapps/sysutils/utils/pice/module/shell.h create mode 100644 rosapps/sysutils/utils/pice/module/stab.def create mode 100644 rosapps/sysutils/utils/pice/module/stab_gnu.h create mode 100644 rosapps/sysutils/utils/pice/module/symbols.c create mode 100644 rosapps/sysutils/utils/pice/module/symbols.h create mode 100644 rosapps/sysutils/utils/pice/module/syscall.c create mode 100644 rosapps/sysutils/utils/pice/module/syscall.h create mode 100644 rosapps/sysutils/utils/pice/module/trace.c create mode 100644 rosapps/sysutils/utils/pice/module/trace.h create mode 100644 rosapps/sysutils/utils/pice/module/utils.c create mode 100644 rosapps/sysutils/utils/pice/module/utils.h create mode 100644 rosapps/sysutils/utils/pice/module/vga.c create mode 100644 rosapps/sysutils/utils/pice/module/vga.h create mode 100644 rosapps/sysutils/utils/pice/module/vga_utils.asm create mode 100644 rosapps/sysutils/utils/pice/pice.cfg create mode 100644 rosapps/sysutils/utils/pice/readme.txt create mode 100644 rosapps/sysutils/utils/pice/shared/shared.h create mode 100644 rosapps/sysutils/utils/pnpdump/pnpdump.c create mode 100644 rosapps/sysutils/utils/ps/ps.c create mode 100644 rosapps/sysutils/utils/ps/ps.c.toolhelp create mode 100644 rosapps/sysutils/utils/ps/ps.rbuild create mode 100644 rosapps/sysutils/utils/rosperf/alphablend.c create mode 100644 rosapps/sysutils/utils/rosperf/fill.c create mode 100644 rosapps/sysutils/utils/rosperf/gradient.c create mode 100644 rosapps/sysutils/utils/rosperf/lines.c create mode 100644 rosapps/sysutils/utils/rosperf/rosperf.c create mode 100644 rosapps/sysutils/utils/rosperf/rosperf.h create mode 100644 rosapps/sysutils/utils/rosperf/rosperf.rbuild create mode 100644 rosapps/sysutils/utils/rosperf/rosperf.rc create mode 100644 rosapps/sysutils/utils/rosperf/testlist.c create mode 100644 rosapps/sysutils/utils/rosperf/text.c create mode 100644 rosapps/sysutils/utils/sdkparse/EnumDirs.h create mode 100644 rosapps/sysutils/utils/sdkparse/EnumDirsImpl.h create mode 100644 rosapps/sysutils/utils/sdkparse/EnumFiles.h create mode 100644 rosapps/sysutils/utils/sdkparse/EnumFilesImpl.h create mode 100644 rosapps/sysutils/utils/sdkparse/File.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/File.h create mode 100644 rosapps/sysutils/utils/sdkparse/FixLFN.h create mode 100644 rosapps/sysutils/utils/sdkparse/Header.h create mode 100644 rosapps/sysutils/utils/sdkparse/Symbol.h create mode 100644 rosapps/sysutils/utils/sdkparse/Type.h create mode 100644 rosapps/sysutils/utils/sdkparse/assert.h create mode 100644 rosapps/sysutils/utils/sdkparse/binary2cstr.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/binary2cstr.h create mode 100644 rosapps/sysutils/utils/sdkparse/input.lst create mode 100644 rosapps/sysutils/utils/sdkparse/iskeyword.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/iskeyword.h create mode 100644 rosapps/sysutils/utils/sdkparse/safestr.h create mode 100644 rosapps/sysutils/utils/sdkparse/sdkparse.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/sdkparse.dsp create mode 100644 rosapps/sysutils/utils/sdkparse/sdkparse.dsw create mode 100644 rosapps/sysutils/utils/sdkparse/skip_ws.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/skip_ws.h create mode 100644 rosapps/sysutils/utils/sdkparse/strip_comments.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/strip_comments.h create mode 100644 rosapps/sysutils/utils/sdkparse/test.h create mode 100644 rosapps/sysutils/utils/sdkparse/tokenize.cpp create mode 100644 rosapps/sysutils/utils/sdkparse/tokenize.h create mode 100644 rosapps/sysutils/utils/stats/stats.c create mode 100644 rosapps/sysutils/utils/stats/stats.rbuild create mode 100644 rosapps/sysutils/utils/theme/dump/manifest.rbuild create mode 100644 rosapps/sysutils/utils/theme/dump/themedump.bpr create mode 100644 rosapps/sysutils/utils/theme/dump/themedump.cpp create mode 100644 rosapps/sysutils/utils/theme/dump/themedump.rc create mode 100644 rosapps/sysutils/utils/tickcount/tickcount.c create mode 100644 rosapps/sysutils/utils/tickcount/tickcount.rbuild create mode 100644 rosapps/sysutils/utils/utils.rbuild create mode 100644 rosapps/templates/template/template.c create mode 100644 rosapps/winefile/Doxyfile create mode 100644 rosapps/winefile/Makefile-MinGW create mode 100644 rosapps/winefile/doxy-footer.html create mode 100644 rosapps/winefile/doxy-footer.htmt create mode 100644 rosapps/winefile/drivebar.bmp create mode 100644 rosapps/winefile/images.bmp create mode 100644 rosapps/winefile/lang/cs-CZ.rc create mode 100644 rosapps/winefile/lang/de-DE.rc create mode 100644 rosapps/winefile/lang/en-US.rc create mode 100644 rosapps/winefile/lang/es-ES.rc create mode 100644 rosapps/winefile/lang/fr-FR.rc create mode 100644 rosapps/winefile/lang/hu-HU.rc create mode 100644 rosapps/winefile/lang/it-IT.rc create mode 100644 rosapps/winefile/lang/nb-NO.rc create mode 100644 rosapps/winefile/lang/nl-NL.rc create mode 100644 rosapps/winefile/lang/pl-PL.rc create mode 100644 rosapps/winefile/lang/pt-PT.rc create mode 100644 rosapps/winefile/lang/ru-RU.rc create mode 100644 rosapps/winefile/lang/sl-SI.rc create mode 100644 rosapps/winefile/lang/sv-SE.rc create mode 100644 rosapps/winefile/lang/zh-CN.rc create mode 100755 rosapps/winefile/make-docu.sh create mode 100644 rosapps/winefile/make_winefile.dsp create mode 100644 rosapps/winefile/make_winefile.vcproj create mode 100755 rosapps/winefile/makel-docu.bat create mode 100644 rosapps/winefile/resource.h create mode 100644 rosapps/winefile/resource.rc create mode 100644 rosapps/winefile/splitpath.c create mode 100644 rosapps/winefile/toolbar.bmp create mode 100644 rosapps/winefile/winefile.c create mode 100644 rosapps/winefile/winefile.dsp create mode 100644 rosapps/winefile/winefile.dsw create mode 100644 rosapps/winefile/winefile.h create mode 100644 rosapps/winefile/winefile.ico create mode 100644 rosapps/winefile/winefile.rbuild create mode 100644 rosapps/winefile/winefile.rc create mode 100644 rosapps/winefile/winefile.sln create mode 100644 rosapps/winefile/winefile.vcproj create mode 100644 rosapps/winver/winver.c create mode 100644 rosapps/winver/winver.rbuild diff --git a/rosapps/avtest/avtest.rbuild b/rosapps/avtest/avtest.rbuild new file mode 100755 index 00000000000..5088f33c374 --- /dev/null +++ b/rosapps/avtest/avtest.rbuild @@ -0,0 +1,8 @@ + + . + .. + + ks + ntoskrnl + entry.c + diff --git a/rosapps/avtest/entry.c b/rosapps/avtest/entry.c new file mode 100755 index 00000000000..2c66a5e85ba --- /dev/null +++ b/rosapps/avtest/entry.c @@ -0,0 +1,83 @@ +#include +#include + +/* Where do we go? */ +#ifndef SIZEOF_ARRAY + #define SIZEOF_ARRAY(array) \ + (sizeof(array) / sizeof(array[0])) +#endif + +/* Not in the DDK but hey! */ +#define DEFINE_KSFILTER_DISPATCH(name) \ + const KSFILTER_DISPATCH name = + +/* To be put in KS.H */ +#define DEFINE_KSFILTER_DESCRIPTOR(name) \ + const KSFILTER_DESCRIPTOR name = + +#define DEFINE_KSFILTER_DESCRIPTOR_TABLE(name) \ + const KSFILTER_DESCRIPTOR* const name[] = + + + +NTSTATUS FilterCreate( + IN OUT PKSFILTER Filter, + IN PIRP Irp) +{ + return STATUS_SUCCESS; +} + +NTSTATUS FilterClose( + IN OUT PKSFILTER Filter, + IN PIRP Irp) +{ + return STATUS_SUCCESS; +} + +NTSTATUS Process( + IN PKSFILTER Filter, + IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex) +{ + return STATUS_SUCCESS; +} + + +DEFINE_KSFILTER_DISPATCH(FilterDispatch) +{ + FilterCreate, + FilterClose, + Process, + NULL // Reset +}; + +DEFINE_KSFILTER_DESCRIPTOR(FilterDesc) +{ +}; + +DEFINE_KSFILTER_DESCRIPTOR_TABLE(FilterDescs) +{ + &FilterDesc +}; + + + +const KSDEVICE_DESCRIPTOR DeviceDescriptor = +{ + NULL, + SIZEOF_ARRAY(FilterDescs), + FilterDescs +}; + + +/* Funcs */ + +NTSTATUS STDCALL +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPathName) +{ + DPRINT1("AVStream test component loaded!\n"); + + return KsInitializeDriver(DriverObject, RegistryPathName, + &DeviceDescriptor); +} diff --git a/rosapps/downloader/download.c b/rosapps/downloader/download.c new file mode 100644 index 00000000000..f710f5e42ec --- /dev/null +++ b/rosapps/downloader/download.c @@ -0,0 +1,303 @@ +/* PROJECT: ReactOS Downloader (was GetFirefox) + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/downloader/download.c + * PURPOSE: Displaying a download dialog + * COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers) + * Copyright 2004 Mike McCormack (for CodeWeavers) + * Copyright 2005 Ge van Geldorp (gvg@reactos.org) + */ +/* + * Based on Wine dlls/shdocvw/shdocvw_main.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define COBJMACROS +#define WIN32_NO_STATUS +#include +#include +#include +#include +#include + +#include "resources.h" +#include "structures.h" + +#define NDEBUG +#include + +extern struct Application* SelectedApplication; +extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT]; + +typedef struct _IBindStatusCallbackImpl + { + const IBindStatusCallbackVtbl *vtbl; + LONG ref; + HWND hDialog; + BOOL *pbCancelled; + } IBindStatusCallbackImpl; + +static HRESULT WINAPI +dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject) +{ + if (NULL == ppvObject) + { + return E_POINTER; + } + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IBindStatusCallback)) + { + IBindStatusCallback_AddRef( This ); + *ppvObject = This; + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI +dlAddRef(IBindStatusCallback* iface) +{ + IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; + + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI +dlRelease(IBindStatusCallback* iface) +{ + IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; + DWORD ref = InterlockedDecrement(&This->ref); + + if( !ref ) + { + DestroyWindow( This->hDialog ); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI +dlOnStartBinding(IBindStatusCallback* iface, DWORD dwReserved, IBinding* pib) +{ + DPRINT1("OnStartBinding not implemented\n"); + + return S_OK; +} + +static HRESULT WINAPI +dlGetPriority(IBindStatusCallback* iface, LONG* pnPriority) +{ + DPRINT1("GetPriority not implemented\n"); + + return S_OK; +} + +static HRESULT WINAPI +dlOnLowResource( IBindStatusCallback* iface, DWORD reserved) +{ + DPRINT1("OnLowResource not implemented\n"); + + return S_OK; +} + +static HRESULT WINAPI +dlOnProgress(IBindStatusCallback* iface, ULONG ulProgress, + ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) +{ + IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; + HWND Item; + LONG r; + WCHAR OldText[100]; + + Item = GetDlgItem(This->hDialog, IDC_PROGRESS); + if (NULL != Item && 0 != ulProgressMax) + { + SendMessageW(Item, PBM_SETPOS, (ulProgress * 100) / ulProgressMax, 0); + } + + Item = GetDlgItem(This->hDialog, IDC_STATUS); + if (NULL != Item && NULL != szStatusText) + { + SendMessageW(Item, WM_GETTEXT, sizeof(OldText) / sizeof(OldText[0]), + (LPARAM) OldText); + if (sizeof(OldText) / sizeof(OldText[0]) - 1 <= wcslen(OldText) || + 0 != wcscmp(OldText, szStatusText)) + { + SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) szStatusText); + } + } + + SetLastError(0); + r = GetWindowLongPtrW(This->hDialog, GWLP_USERDATA); + if (0 != r || 0 != GetLastError()) + { + *This->pbCancelled = TRUE; + DPRINT("Cancelled\n"); + return E_ABORT; + } + + return S_OK; +} + +static HRESULT WINAPI +dlOnStopBinding(IBindStatusCallback* iface, HRESULT hresult, LPCWSTR szError) +{ + DPRINT1("OnStopBinding not implemented\n"); + + return S_OK; +} + +static HRESULT WINAPI +dlGetBindInfo(IBindStatusCallback* iface, DWORD* grfBINDF, BINDINFO* pbindinfo) +{ + DPRINT1("GetBindInfo not implemented\n"); + + return S_OK; +} + +static HRESULT WINAPI +dlOnDataAvailable(IBindStatusCallback* iface, DWORD grfBSCF, + DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed) +{ + DPRINT1("OnDataAvailable implemented\n"); + + return S_OK; +} + +static HRESULT WINAPI +dlOnObjectAvailable(IBindStatusCallback* iface, REFIID riid, IUnknown* punk) +{ + DPRINT1("OnObjectAvailable implemented\n"); + + return S_OK; +} + +static const IBindStatusCallbackVtbl dlVtbl = +{ + dlQueryInterface, + dlAddRef, + dlRelease, + dlOnStartBinding, + dlGetPriority, + dlOnLowResource, + dlOnProgress, + dlOnStopBinding, + dlGetBindInfo, + dlOnDataAvailable, + dlOnObjectAvailable +}; + +static IBindStatusCallback* +CreateDl(HWND Dlg, BOOL *pbCancelled) +{ + IBindStatusCallbackImpl *This; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(IBindStatusCallbackImpl)); + This->vtbl = &dlVtbl; + This->ref = 1; + This->hDialog = Dlg; + This->pbCancelled = pbCancelled; + + return (IBindStatusCallback*) This; +} + +static DWORD WINAPI +ThreadFunc(LPVOID Context) +{ + //static const WCHAR szUrl[] = DownloadUrl; + IBindStatusCallback *dl; + HWND Dlg = ((struct lParamDownload*)Context)->Dlg; + DWORD r; + BOOL bCancelled = FALSE; + dl = CreateDl(Dlg, &bCancelled); + r = URLDownloadToFileW(NULL, ((struct lParamDownload*)Context)->URL, ((struct lParamDownload*)Context)->File, 0, dl); + if (NULL != dl) + { + IBindStatusCallback_Release(dl); + } + if (S_OK != r) + { + MessageBoxW(0,Strings[IDS_DOWNLOAD_ERROR],0,0); + } + EndDialog(Dlg, 0); + return 0; +} + +INT_PTR CALLBACK +DownloadProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + HANDLE Thread; + DWORD ThreadId; + HWND Item;; + + switch (Msg) + { + case WM_INITDIALOG:/* + Icon = LoadIconW((HINSTANCE) GetWindowLongPtr(Dlg, GWLP_HINSTANCE), + MAKEINTRESOURCEW(IDI_ICON_MAIN)); + if (NULL != Icon) + { + SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) Icon); + SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) Icon); + }*/ + SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0); + Item = GetDlgItem(Dlg, IDC_PROGRESS); + if (NULL != Item) + { + SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0,100)); + SendMessageW(Item, PBM_SETPOS, 0, 0); + }/* + Item = GetDlgItem(Dlg, IDC_REMOVE); + if (NULL != Item) + { + if (GetShortcutName(ShortcutName) && + INVALID_FILE_ATTRIBUTES != GetFileAttributesW(ShortcutName)) + { + SendMessageW(Item, BM_SETCHECK, BST_CHECKED, 0); + } + else + { + SendMessageW(Item, BM_SETCHECK, BST_UNCHECKED, 0); + ShowWindow(Item, SW_HIDE); + } + }*/ + ((struct lParamDownload*)lParam)->Dlg = Dlg; + Thread = CreateThread(NULL, 0, ThreadFunc, (LPVOID)lParam, 0, &ThreadId); + if (NULL == Thread) + { + return FALSE; + } + CloseHandle(Thread); + return TRUE; + + case WM_COMMAND: + if (wParam == IDCANCEL) + { + SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1); + PostMessage(Dlg, WM_CLOSE, 0, 0); + } + return FALSE; + + case WM_CLOSE: + EndDialog(Dlg, 0); + return TRUE; + + default: + return FALSE; + } +} diff --git a/rosapps/downloader/downloader.rbuild b/rosapps/downloader/downloader.rbuild new file mode 100644 index 00000000000..4665d5350dd --- /dev/null +++ b/rosapps/downloader/downloader.rbuild @@ -0,0 +1,34 @@ + + + + + + + . + . + + + + + 0x0501 + + +#include "rsrc.rc" diff --git a/rosapps/downloader/main.c b/rosapps/downloader/main.c new file mode 100644 index 00000000000..6f812ee102f --- /dev/null +++ b/rosapps/downloader/main.c @@ -0,0 +1,538 @@ +/* PROJECT: ReactOS Downloader + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/downloader/xml.c + * PURPOSE: Main program + * PROGRAMMERS: Maarten Bosma, Lester Kortenhoeven + */ + +#include +#include +#include +#include +#include +#include +#include "resources.h" +#include "structures.h" + +#define XML_PATH "tree.xml" + +HWND hwnd, hCategories, hApps, hDownloadButton, hUninstallButton, hUpdateButton, hHelpButton; +HBITMAP hLogo, hUnderline; +CHAR* CmdLine; +WCHAR* DescriptionHeadline = L""; +WCHAR* DescriptionText = L""; +WCHAR ApplicationText[0xA04]; // MAX_STRING_LENGHT + Version + \n + MAX_STRING_LENGHT + Licence + \n + MAX_STRING_LENGHT + Maintainer + \n\n + Description + // 0x100 + 0x100 + 1 + 0x100 + 0x100 + 1 + 0x100 + 0x100 + 2 + 0x400 = 0xA04 +struct Category Root; +struct Application* SelectedApplication; + +INT_PTR CALLBACK DownloadProc (HWND, UINT, WPARAM, LPARAM); +DWORD WINAPI InstallThreadFunc(LPVOID); +DWORD WINAPI UninstallThreadFunc(LPVOID); +BOOL ProcessXML (const char* filename, struct Category* Root); +char* addDML (const char*); +VOID FreeTree (struct Category* Node); +WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT]; + +BOOL getUninstaller(struct Application* CurrentApplication, WCHAR* Uninstaller) { + + DWORD ArraySize = 0x100; + + HKEY hKey1; + HKEY hKey2; + DWORD Type = 0; + WCHAR Value[ArraySize]; + WCHAR KeyName[ArraySize]; + DWORD Size = ArraySize; + LONG i = 0; + + if (CurrentApplication->RegName[0] == L'\0') { + return FALSE; + } + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_READ,&hKey1) == ERROR_SUCCESS) { + if (RegOpenKeyExW(hKey1,CurrentApplication->RegName,0,KEY_READ,&hKey2) == ERROR_SUCCESS) { + if (RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size) == ERROR_SUCCESS) { + RegCloseKey(hKey2); + RegCloseKey(hKey1); + return TRUE; + } else { + RegCloseKey(hKey2); + RegCloseKey(hKey1); + return FALSE; + } + } + while (RegEnumKeyExW(hKey1,i,KeyName,&Size,NULL,NULL,NULL,NULL) == ERROR_SUCCESS) { + ++i; + RegOpenKeyExW(hKey1,KeyName,0,KEY_READ,&hKey2); + Size = sizeof(Value); + if (RegQueryValueExW(hKey2,L"DisplayName",0,&Type,(LPBYTE)Value,&Size) == ERROR_SUCCESS) { + Size = ArraySize; + if (!wcscmp(Value,CurrentApplication->RegName)) { + if (RegQueryValueExW(hKey2,L"UninstallString",0,&Type,(LPBYTE)Uninstaller,&Size) == ERROR_SUCCESS) { + RegCloseKey(hKey2); + RegCloseKey(hKey1); + return TRUE; + } else { + RegCloseKey(hKey2); + RegCloseKey(hKey1); + return FALSE; + } + } + } + RegCloseKey(hKey2); + Size = ArraySize; + } + RegCloseKey(hKey1); + } + return FALSE; +} + +void ShowMessage (WCHAR* title, WCHAR* message) +{ + DescriptionHeadline = title; + DescriptionText = message; + InvalidateRect(hwnd,NULL,TRUE); + UpdateWindow(hwnd); +} + +void AddItems (HWND hwnd, struct Category* Category, struct Category* Parent) +{ + TV_INSERTSTRUCTW Insert; + + Insert.item.lParam = (UINT)Category; + Insert.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;; + Insert.item.pszText = Category->Name; + Insert.item.cchTextMax = lstrlenW(Category->Name); + Insert.item.iImage = Category->Icon; + Insert.item.iSelectedImage = Category->Icon; + Insert.hInsertAfter = TVI_LAST; + Insert.hParent = Category->Parent ? Category->Parent->TreeviewItem : TVI_ROOT; + + Category->TreeviewItem = (HTREEITEM)SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert); + + if(Category->Next) + AddItems (hwnd,Category->Next,Parent); + + if(Category->Children) + AddItems (hwnd,Category->Children,Category); +} + +void CategoryChoosen (HWND hwnd, struct Category* Category) +{ + struct Application* CurrentApplication; + TV_INSERTSTRUCTW Insert; + SelectedApplication = NULL; + + if(Category->Children && !Category->Apps) + ShowMessage(Category->Name, Strings[IDS_CHOOSE_SUB]); + else if(!Category->Children && Category->Apps) + ShowMessage(Category->Name, Strings[IDS_CHOOSE_APP]); + else if(Category->Children && Category->Apps) + ShowMessage(Category->Name, Strings[IDS_CHOOSE_BOTH]); + else + ShowMessage(Category->Name, Strings[IDS_NO_APPS]); + + (void)TreeView_DeleteItem(hwnd, TVI_ROOT); + (void)TreeView_DeleteItem(hwnd, TVI_ROOT); // Delete twice to bypass bug in windows + + Insert.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE; + Insert.hInsertAfter = TVI_LAST; + Insert.hParent = TVI_ROOT; + + CurrentApplication = Category->Apps; + + while(CurrentApplication) + { + Insert.item.lParam = (UINT)CurrentApplication; + Insert.item.pszText = CurrentApplication->Name; + Insert.item.cchTextMax = lstrlenW(CurrentApplication->Name); + if(getUninstaller(CurrentApplication, NULL)) { + Insert.item.iImage = 9; + } else { + Insert.item.iImage = 10; + } + SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert); + CurrentApplication = CurrentApplication->Next; + } +} + +BOOL SetupControls (HWND hwnd) +{ + TV_INSERTSTRUCTW Insert = {0}; + HIMAGELIST hImageList; + HINSTANCE hInstance = GetModuleHandle(NULL); + + // Parse the XML file + if (ProcessXML (XML_PATH, &Root) == FALSE) + return FALSE; + + // Set up the controls + hCategories = CreateWindowExW(0, WC_TREEVIEWW, L"Categories", WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS, + 0, 0, 0, 0, hwnd, NULL, hInstance, NULL); + + hApps = CreateWindowExW(0, WC_TREEVIEWW, L"Applications", WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS, + 0, 0, 0, 0, hwnd, NULL, hInstance, NULL); + + hLogo = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_LOGO)); + hUnderline = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_UNDERLINE)); + + hHelpButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 550, 10, 40, 40, hwnd, 0, hInstance, NULL); + hUpdateButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 500, 10, 40, 40, hwnd, 0, hInstance, NULL); + hDownloadButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 330, 505, 140, 35, hwnd, 0, hInstance, NULL); + hUninstallButton = CreateWindowW (L"Button", L"", WS_CHILD|WS_VISIBLE|BS_BITMAP, 260, 505, 140, 35, hwnd, 0, hInstance, NULL); + + SendMessageW(hHelpButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_HELP))); + SendMessageW(hUpdateButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_UPDATE))); + SendMessageW(hDownloadButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_DOWNLOAD))); + SendMessageW(hUninstallButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_UNINSTALL))); + ShowWindow(hUninstallButton, SW_HIDE); + + // Set deflaut entry for hApps + Insert.item.mask = TVIF_TEXT|TVIF_IMAGE; + Insert.item.pszText = Strings[IDS_CHOOSE_CATEGORY]; + Insert.item.cchTextMax = lstrlenW(Strings[IDS_CHOOSE_CATEGORY]); + Insert.item.iImage = 0; + SendMessage(hApps, TVM_INSERTITEM, 0, (LPARAM)&Insert); + + // Create Tree Icons + hImageList = ImageList_Create(16, 16, ILC_COLORDDB, 1, 1); + SendMessageW(hCategories, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hImageList); + SendMessageW(hApps, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hImageList); + + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_0)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_1)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_2)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_3)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_4)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_5)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_6)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_7)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_8)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_9)), NULL); + ImageList_Add(hImageList, LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_10)), NULL); + + // Fill the TreeViews + AddItems (hCategories, Root.Children, NULL); + + return TRUE; +} + +static void ResizeControl (HWND hwnd, int x1, int y1, int x2, int y2) +{ + // Make resizing a little easier + MoveWindow(hwnd, x1, y1, x2-x1, y2-y1, TRUE); +} + +static void DrawBitmap (HDC hdc, int x, int y, HBITMAP hBmp) +{ + BITMAP bm; + HDC hdcMem = CreateCompatibleDC(hdc); + + SelectObject(hdcMem, hBmp); + GetObject(hBmp, sizeof(bm), &bm); + TransparentBlt(hdc, x, y, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, 0xFFFFFF); + + DeleteDC(hdcMem); +} + +static void DrawDescription (HDC hdc, RECT DescriptionRect) +{ + int i; + HFONT Font; + RECT Rect = {DescriptionRect.left+5, DescriptionRect.top+3, DescriptionRect.right-2, DescriptionRect.top+22}; + + // Backgroud + Rectangle(hdc, DescriptionRect.left, DescriptionRect.top, DescriptionRect.right, DescriptionRect.bottom); + + // Underline + for (i=DescriptionRect.left+1;iChildren) + searchApp(AppName, Node->Children); + if (Node->Next) + searchApp(AppName, Node->Next); + CurrentApplication = Node->Apps; + while((SelectedApplication == NULL) && (CurrentApplication != NULL)) { + if(wcscmp(CurrentApplication->Name,AppName)==0) + SelectedApplication = CurrentApplication; + CurrentApplication = CurrentApplication->Next; + } +} + +void ShowSelectedApplication() { + ApplicationText[0]=L'\0'; + if(SelectedApplication->Version[0] != L'\0') { + StrCatW(ApplicationText, Strings[IDS_VERSION]); + StrCatW(ApplicationText, SelectedApplication->Version); + StrCatW(ApplicationText, L"\n"); + } + if(SelectedApplication->Licence[0] != L'\0') { + StrCatW(ApplicationText, Strings[IDS_LICENCE]); + StrCatW(ApplicationText, SelectedApplication->Licence); + StrCatW(ApplicationText, L"\n"); + } + if(SelectedApplication->Maintainer[0] != L'\0') { + StrCatW(ApplicationText, Strings[IDS_MAINTAINER]); + StrCatW(ApplicationText, SelectedApplication->Maintainer); + StrCatW(ApplicationText, L"\n"); + } + if((SelectedApplication->Licence[0] != L'\0') || (SelectedApplication->Version[0] != L'\0') || (SelectedApplication->Maintainer[0] != L'\0')) + StrCatW(ApplicationText, L"\n"); + StrCatW(ApplicationText, SelectedApplication->Description); + ShowMessage(SelectedApplication->Name, ApplicationText); +} + +LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) +{ + static RECT DescriptionRect; + + switch (Message) + { + case WM_CREATE: + { + WCHAR wAppName[0x100] = L""; + if (strncmp(CmdLine,"add ",4)==0) { + CmdLine = CmdLine+4; + if(CmdLine[0]==L'\"') { + CmdLine++; + CmdLine[strlen(CmdLine)-1]=L'\0'; + } + char* aAppName = addDML(CmdLine); + MultiByteToWideChar(CP_UTF8, 0, aAppName, -1, wAppName, 0x100); + } else if (strncmp(CmdLine,"show ",5)==0) { + MultiByteToWideChar(CP_UTF8, 0, CmdLine+5, -1, wAppName, 0x100); + } + + if(!SetupControls(hwnd)) + return -1; + + if(wAppName[0]!=L'\0') + searchApp(wAppName, &Root); + + if(SelectedApplication == NULL) { + ShowMessage(Strings[IDS_WELCOME_TITLE], Strings[IDS_WELCOME]); + } else { + ShowSelectedApplication(); + if(getUninstaller(SelectedApplication, NULL)) + showUninstaller(); + else + hideUninstaller(); + } + } + break; + + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + HDC BackbufferHdc = CreateCompatibleDC(hdc); + HBITMAP BackbufferBmp = CreateCompatibleBitmap(hdc, ps.rcPaint.right, ps.rcPaint.bottom); + SelectObject(BackbufferHdc, BackbufferBmp); + + FillRect(BackbufferHdc, &ps.rcPaint, CreateSolidBrush(RGB(235,235,235))); + DrawBitmap(BackbufferHdc, 10, 12, hLogo); + DrawDescription(BackbufferHdc, DescriptionRect); + + BitBlt(hdc, 0, 0, ps.rcPaint.right, ps.rcPaint.bottom, BackbufferHdc, 0, 0, SRCCOPY); + DeleteObject(BackbufferBmp); + DeleteDC(BackbufferHdc); + EndPaint(hwnd, &ps); + } + break; + + case WM_COMMAND: + { + if(HIWORD(wParam) == BN_CLICKED) + { + if (lParam == (LPARAM)hDownloadButton) + { + if(SelectedApplication) { + DWORD ThreadId; + CreateThread(NULL, 0, InstallThreadFunc, SelectedApplication, 0, &ThreadId); + } else + ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]); + } + else if (lParam == (LPARAM)hUninstallButton) + { + if(SelectedApplication) { + DWORD ThreadId; + CreateThread(NULL, 0, UninstallThreadFunc, SelectedApplication, 0, &ThreadId); + hideUninstaller(); + } else + ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]); + } + else if (lParam == (LPARAM)hUpdateButton) + { + ShowMessage(Strings[IDS_UPDATE_TITLE], Strings[IDS_UPDATE]); + } + else if (lParam == (LPARAM)hHelpButton) + { + ShowMessage(Strings[IDS_HELP_TITLE], Strings[IDS_HELP]); + } + } + } + break; + + case WM_NOTIFY: + { + LPNMHDR data = (LPNMHDR)lParam; + if(data->code == TVN_SELCHANGED) + { + BOOL bShowUninstaller = FALSE; + if(data->hwndFrom == hCategories) + { + struct Category* Category = (struct Category*) ((LPNMTREEVIEW)lParam)->itemNew.lParam; + CategoryChoosen (hApps, Category); + } + else if(data->hwndFrom == hApps) + { + SelectedApplication = (struct Application*) ((LPNMTREEVIEW)lParam)->itemNew.lParam; + if(SelectedApplication) + { + ShowSelectedApplication(); + if(getUninstaller(SelectedApplication, NULL)) { + bShowUninstaller = TRUE; + } + } + } + if (bShowUninstaller) + showUninstaller(); + else + hideUninstaller(); + } + } + break; + + case WM_SIZING: + { + LPRECT pRect = (LPRECT)lParam; + if (pRect->right-pRect->left < 520) + pRect->right = pRect->left + 520; + + if (pRect->bottom-pRect->top < 300) + pRect->bottom = pRect->top + 300; + } + break; + + case WM_SIZE: + { + int Split_Hozizontal = (HIWORD(lParam)-(45+60))/2 + 60; + int Split_Vertical = 200; + + ResizeControl(hCategories, 10, 60, Split_Vertical, HIWORD(lParam)-10); + ResizeControl(hApps, Split_Vertical+5, 60, LOWORD(lParam)-10, Split_Hozizontal); + RECT Rect = {Split_Vertical+5, Split_Hozizontal+5, LOWORD(lParam)-10, HIWORD(lParam)-50}; + DescriptionRect = Rect; + + MoveWindow(hHelpButton, LOWORD(lParam)-50, 10, 40, 40, TRUE); + MoveWindow(hUpdateButton, LOWORD(lParam)-100, 10, 40, 40, TRUE); + if(IsWindowVisible(hUninstallButton)) + MoveWindow(hDownloadButton, (Split_Vertical+LOWORD(lParam))/2, HIWORD(lParam)-45, 140, 35, TRUE); + else + MoveWindow(hDownloadButton, (Split_Vertical+LOWORD(lParam))/2-70, HIWORD(lParam)-45, 140, 35, TRUE); + MoveWindow(hUninstallButton, (Split_Vertical+LOWORD(lParam))/2-140, HIWORD(lParam)-45, 140, 35, TRUE); + } + break; + + case WM_DESTROY: + { + DeleteObject(hLogo); + if(Root.Children) + FreeTree(Root.Children); + PostQuitMessage(0); + return 0; + } + break; + } + + return DefWindowProc (hwnd, Message, wParam, lParam); +} + +INT WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, + LPSTR lpCmdLine, INT nCmdShow) +{ + int i; + WNDCLASSEXW WndClass = {0}; + MSG msg; + + InitCommonControls(); + CmdLine = lpCmdLine; + + // Load strings + for(i=0; i + +firefox1509.dml +firefox2001.dml diff --git a/rosapps/downloader/packagetree/internet/browser/firefox1509.dml b/rosapps/downloader/packagetree/internet/browser/firefox1509.dml new file mode 100644 index 00000000000..3f077451653 --- /dev/null +++ b/rosapps/downloader/packagetree/internet/browser/firefox1509.dml @@ -0,0 +1,7 @@ + + Mozilla Firefox (1.5) + MPL/GPL/LGPL + 1.5.0.9 + The most popular and one of the best free WebBrowsers out there. + http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/1.5.0.9/win32/en-US/Firefox%20Setup%201.5.0.9.exe + \ No newline at end of file diff --git a/rosapps/downloader/packagetree/internet/browser/firefox2001.dml b/rosapps/downloader/packagetree/internet/browser/firefox2001.dml new file mode 100644 index 00000000000..4e1d9e4e92f --- /dev/null +++ b/rosapps/downloader/packagetree/internet/browser/firefox2001.dml @@ -0,0 +1,7 @@ + + Mozilla Firefox (2.0.0.1) + MPL/GPL/LGPL + 2.0.0.1 + The most popular and one of the best free WebBrowsers out there. + http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/latest/win32/en-US/Firefox%20Setup%202.0.0.1.exe + \ No newline at end of file diff --git a/rosapps/downloader/packagetree/internet/category.xml b/rosapps/downloader/packagetree/internet/category.xml new file mode 100644 index 00000000000..dcf2b42a9b6 --- /dev/null +++ b/rosapps/downloader/packagetree/internet/category.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + Mozilla Thunderbird (1.5) + MPL/GPL/LGPL + 1.5.0.9 + The most popular and one of the best free MailClients out there. + http://ftp-mozilla.netscape.com/pub/mozilla.org/thunderbird/releases/latest/win32/en-US/Thunderbird%20Setup%201.5.0.9.exe + + + SeaMonkey (1.0.7) + 1.0.7 + Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, Composer bundle you will ever need. + http://ftp-mozilla.netscape.com/pub/mozilla.org/seamonkey/releases/1.0.7/seamonkey-1.0.7.en-US.win32.installer.exe + + + Mozilla ActiveX Control v1.7.12 (ReactOS special) + 1.7.12 + Essential Component to get ReactOS Explorer's and other application's Internet Browsing feature running. + http://ovh.dl.sourceforge.net/sourceforge/reactos/MozillaControl1712-ReactOS.exe + + + The Off By One Web Browser + The Off By One Browser is a very small and fast web browser with full HTML 3.2 support. + http://offbyone.com/offbyone/images/OffByOneSetup.exe + + + This tool allows you to access your Windows shared folders/printers with ReactOS. + http://svn.reactos.org/packages/samba-tng.exe + + + Miranda IM + 0.5.1 + Open source multiprotocol instant messaging application - May not work completely. + http://ovh.dl.sourceforge.net/sourceforge/miranda/miranda-im-v0.5.1-unicode.exe + + + PuTTY version 0.59 + MIT + 0.59 + A free SSH, Telnet, rlogin, and raw TCP client. + http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.59-installer.exe + + \ No newline at end of file diff --git a/rosapps/downloader/packagetree/internet/internet.rbuild b/rosapps/downloader/packagetree/internet/internet.rbuild new file mode 100644 index 00000000000..7b7ab54e582 --- /dev/null +++ b/rosapps/downloader/packagetree/internet/internet.rbuild @@ -0,0 +1,6 @@ + + + + + +category.xml diff --git a/rosapps/downloader/packagetree/packagetree.rbuild b/rosapps/downloader/packagetree/packagetree.rbuild new file mode 100644 index 00000000000..01d7036e57f --- /dev/null +++ b/rosapps/downloader/packagetree/packagetree.rbuild @@ -0,0 +1,9 @@ + + + + + + + + +tree.xml diff --git a/rosapps/downloader/packagetree/script/default_install.xml b/rosapps/downloader/packagetree/script/default_install.xml new file mode 100644 index 00000000000..c26a300a57f --- /dev/null +++ b/rosapps/downloader/packagetree/script/default_install.xml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/rosapps/downloader/packagetree/script/default_uninstall.xml b/rosapps/downloader/packagetree/script/default_uninstall.xml new file mode 100644 index 00000000000..0f4c05c56ce --- /dev/null +++ b/rosapps/downloader/packagetree/script/default_uninstall.xml @@ -0,0 +1 @@ + diff --git a/rosapps/downloader/packagetree/script/script.rbuild b/rosapps/downloader/packagetree/script/script.rbuild new file mode 100644 index 00000000000..9230d0fbc4e --- /dev/null +++ b/rosapps/downloader/packagetree/script/script.rbuild @@ -0,0 +1,3 @@ + +default_install.xml +default_uninstall.xml diff --git a/rosapps/downloader/packagetree/tree.xml b/rosapps/downloader/packagetree/tree.xml new file mode 100644 index 00000000000..9ce014fd9a3 --- /dev/null +++ b/rosapps/downloader/packagetree/tree.xml @@ -0,0 +1,142 @@ + + + + + "AbiWord 2.4.1 (remove only)" + 2.4.1 + Word processor. + http://www.abiword.org/downloads/abiword/2.4.1/Windows/abiword-setup-2.4.1.exe + + + OpenOffice.org 2.1 + 2.1.0 + THE Open Source Office Suite. + http://ftp.tu-chemnitz.de/pub/openoffice-extended//stable/2.1.0/OOo_2.1.0_Win32Intel_install_en-US.exe + + + + + IrfanView (remove only) + 3.99 + Viewer for all kinds of graphics/audio files/video files. + http://gd.tuwien.ac.at/graphics/irfanview/iview399.exe + + + 3.99 + Additional Plugins for supporting more file types. + http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_399.exe + + + Tux Paint 0.9.16 + 0.9.16 + An open source bitmap graphics editor geared towards young children. + http://ovh.dl.sourceforge.net/sourceforge/tuxpaint/tuxpaint-0.9.16-win32-installer.exe + + + + + + + ReactOS Build Environment 0.3.4 + 0.3.4 + Allows you to build the ReactOS Source. For more instructions see ReactOS wiki. + http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-0.3.4.exe + + + MinGW 5.1.3 + 5.1.3 + A Port of the GNU toolchain with GCC, GDB, GNU make, etc. + http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe + + + FreeBASIC 0.16b + 0.16b + Open Source Basic Compiler. The Basic syntax is compatible to QBASIC. + http://switch.dl.sourceforge.net/sourceforge/fbc/FreeBASIC-v0.16b-win32.exe + + + + + ScummVM 0.9.1 + 0.9.1 + SamNMax, Day of Tentacle, etc on ReactOS + http://ovh.dl.sourceforge.net/sourceforge/scummvm/scummvm-0.9.1-win32.exe + + + Nice Clone of Chip's Challenge originally made for the Atari Lynx. Includes free CCLP2 Graphics Pack, so you dont need the copyrighted Original. + http://www.muppetlabs.com/~breadbox/pub/software/tworld/tworld-1.3.0-win32-CCLP2.exe + + + OpenTTD 0.5.0 + 0.5.0-RC5 + Open-source-clone of the "Transport Tycoon Deluxe" game-engine. You need a copy of Transport Tycoon. + http://ovh.dl.sourceforge.net/sourceforge/openttd/openttd-0.5.0-RC5-win32.exe + + LBreakout2 2.4.1 + LBreakout2 2.4.1 + 2.4.1 + Breakout Clone using SDL libs. + http://switch.dl.sourceforge.net/sourceforge/lgames/lbreakout2-2.4.1-win32.exe + + + LGeneral 1.1 + 1.1 + Panzer General Clone using SDL libs. + http://kent.dl.sourceforge.net/sourceforge/lgames/lgeneral-1.1-win32.exe + + + LMarbles 1.0.6 + 1.0.6 + Atomix Clone using SDL libs. + http://heanet.dl.sourceforge.net/sourceforge/lgames/lmarbles-1.0.6-win32.exe + + + + + 7-Zip 4.42 + 4.42 + Utility to create and open 7zip, zip, tar, rar and other archive files. + http://ovh.dl.sourceforge.net/sourceforge/sevenzip/7z442.exe + + + uTorrent + 1.6 + Small and fast Torrent Client. + http://download.utorrent.com/1.6/uTorrent-1.6-install.exe + + + Audiograbber 1.83 SE + 1.83 SE + A very good CD Ripper/Audio File Converter. + http://www.audiograbber.de/files/342677432/agsetup183se.exe + + + + + SDL Runtime + 1.2.11 + Needed for many Open Source Games to run. You need 7-Zip or a similar Utility to extract it. + http://ovh.dl.sourceforge.net/sourceforge/libsdl/SDL-1.2.11-win32.zip + + + + + + + + + + + + + + + + + + 0.65 + DOSBox is a DOS emulator. + http://puzzle.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.65-win32-installer.exe + + + diff --git a/rosapps/downloader/resources.h b/rosapps/downloader/resources.h new file mode 100644 index 00000000000..875777f62fd --- /dev/null +++ b/rosapps/downloader/resources.h @@ -0,0 +1,48 @@ + +#define IDI_MAIN 0x0 +#define IDB_UNDERLINE 0x100 +#define IDB_LOGO 0x101 +#define IDB_HELP 0x102 +#define IDB_UPDATE 0x103 +#define IDB_DOWNLOAD 0x104 +#define IDB_UNINSTALL 0x105 +#define IDB_TREEVIEW_ICON_0 0x900 +#define IDB_TREEVIEW_ICON_1 0x901 +#define IDB_TREEVIEW_ICON_2 0x902 +#define IDB_TREEVIEW_ICON_3 0x903 +#define IDB_TREEVIEW_ICON_4 0x904 +#define IDB_TREEVIEW_ICON_5 0x905 +#define IDB_TREEVIEW_ICON_6 0x906 +#define IDB_TREEVIEW_ICON_7 0x907 +#define IDB_TREEVIEW_ICON_8 0x908 +#define IDB_TREEVIEW_ICON_9 0x909 +#define IDB_TREEVIEW_ICON_10 0x910 +#define IDD_DOWNLOAD 0x100 +#define IDC_PROGRESS 0x1000 +#define IDC_STATUS 0x1001 +#define IDC_REMOVE 0x1002 + +#define IDS_WINDOW_TITLE 0 +#define IDS_WELCOME_TITLE 1 +#define IDS_WELCOME 2 +#define IDS_NO_APP_TITLE 3 +#define IDS_NO_APP 4 +#define IDS_UPDATE_TITLE 5 +#define IDS_UPDATE 6 +#define IDS_HELP_TITLE 7 +#define IDS_HELP 8 +#define IDS_NO_APPS 9 +#define IDS_CHOOSE_APP 10 +#define IDS_CHOOSE_SUB 11 +#define IDS_CHOOSE_CATEGORY 12 +#define IDS_CHOOSE_BOTH 13 +#define IDS_XMLERROR_1 14 +#define IDS_XMLERROR_2 15 +#define IDS_DOWNLOAD_ERROR 16 +#define IDS_UNZIP_ERROR 17 +#define IDS_VERSION 18 +#define IDS_LICENCE 19 +#define IDS_MAINTAINER 20 + +#define STRING_COUNT 21 +#define MAX_STRING_LENGHT 0x100 diff --git a/rosapps/downloader/resources/0.bmp b/rosapps/downloader/resources/0.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e31ccefe73705c02c8be8d33e3ce0fd0af4754e9 GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H0s;ACiM$hyVk_e^g*QC1cKsji_Sycr3+Mik%_h zi)%jr_=Zm%Ob)2N`tmZHC3#A1!Iz)ifeGWJf$AHtugaW%5rfGX=wEry~qOX@E!Z@jvSZ+oJ^{xp-*^%b{P zIIk#CY72t94WgcHmLCYs@#k0)!o4PncXJ%y&LsXlDKh(W(l5=4+ubc*?+I}miuzf8 z>G#E^tZD+c=gaPK$}r5v1?c(A|t#N7Ee zcgL=6R%!`^`xiYts~opIIGulF=EO@I=UmxtF*!ACAxe0n#T?K(yC0uhedln?u_coA mUYPNPseb#z({XECk==l%2AK;q-)KU7_#%96KvqvMJp%yX)*;6L literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/1.bmp b/rosapps/downloader/resources/1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b5d584bf20682e940a6727526d9d288ff20a00c8 GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H0s;U+0BjhyVk_e-Kk^2F{4(>5<9AZqg0X-NxQx?s-Uy?Y-$dW5X&{rmSD zX0*5as4OpVJ~X@Yz!5 zzr8VVORdk|-lTiSHhy{g{Nc3==ML|E^5h9b{iiq2dqZ^h^(Jj?44D~kx-8%2!phdO z%bLzCZn%AD?eCx8ZXH^;uq@{D+m{gahZgs(tO&ZhfAQgk?Hiht_D-+9xT5*o;;Iv~ z@()cf+A*Q{$eilsMV{+Biy-P376l!elK1)blV9JzUf8;5-^84IJ7?V9GV$`N=4~xe z)8mY0#2EoS)gNI3QQs4+b8ddwÏKe_Yx)Ry-bx4t>I@#^}%B?TVyGwf$3noW;2 z1bV;2TM44R%TM*poPs+$=lpne=f{H+f1aNE`QXIq#Z8NH-R5UF%ucpklw}7}@1qP+ zKO@x%7&1p@SA2VL^8cr2|6gAI|N8o;+ecSdhAzo>Uta9FFw+j`o(bVb5cT`!bu2G* zKe@Q&&AlssKRy5d<;DNcFaCae|M1N2(+lhNOw2nttq2$|i!0(G>Ve_e6Qpx&R>{}5 z&)z+`{rla+|9^k~|M&0n%Lk`cOGV^Dq=(b9a!=37J3J|Eb(v33 pkk*046VVhyxIl+(>M5NRZ4L~IP9K#?F%~Q8(>}d^j#V*{f&hdJIMDzA literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/10.bmp b/rosapps/downloader/resources/10.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d0825e8fb7960913de3052c6650fc4bca54283e0 GIT binary patch literal 824 zcmbu6v1)@*7=>*+7drM4@&u)G_dZ9TK|&IO=&X_@QN$%78In=V5|XHmrC^kxi$)}a znF4tLp*`GNMA|f=^oM)7T)%Vv|6HG*A8!~^57=v1cVFv@xhMD6_#WNTMJ}*?{JVC$ z-3zJX@p#b;4A>+|w%aWZXCy^YW>$*QB6b{1>Sg+U9b=@@0)oS%h%5fZ;1@A!Pqay)BL)o@%Sr*2ll9ET?X0zFDw=v9YHtYBMC7;n{8fMX literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/2.bmp b/rosapps/downloader/resources/2.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e59ab5e984a509a13c9090774f4c89240cb147e2 GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H0s;U+0BjhyVk_e;D}t_wVJaS7yzd+dp|?YgY#x z&0oCe%(=5LRS5d|i|5@F`kp?0`sdG|A3uNn{PpYGw{Ks+e!X+|PVdD2^A|24l!93+ z*Q|c^>ebC~qAH%}h`iUVcQ)B_#-@87?p7p^Vcd3fp0LreFZIC$*%!982=-n;kf z*Ds(fR`ozFK=lt^yqU3X*W9fKuk2a=>h-Oziw{4xbV19PT^vun-6`ObDOhLr&*4BiBQ}d6` zt+}vy=Jxg^;ziD%gd{)tLxz4U~FtGDJeO7 z_H110f#Tue;Xudq_V%t`z1rK`TU}kfpr8Pc`fuO90kr^K-qh4&Z*Q-ts8~=^^z8X_ zJX(JJ`qkdv?&{_i8yCBAR08u^g!7!J~(Gw5;E>arfRmKr2q2I<cfbrqWHv%f~N&^5CH+7u= literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/4.bmp b/rosapps/downloader/resources/4.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5df366dd321ba1f05bf24233aedd4fd2f2ee7a4c GIT binary patch literal 822 zcmbV}O-lk%6ow~S2Q9;2(5h9q3O{DXc4?NOq68ug5~3UNW73Ue{ehqmK?>X$1#WfS zZ)oGvtqVb1DfDh-$t)oK+!l}Zf;1AIE2?)7@@c6&G+ zP9_t}vN#c-TwV{06^jKr&~iK;)6H!zF+Q100)Po$DCGH^&*!7jh@ldRL_8h`BVZ;1 zrU%I9FNDwKEHaD5qSNWn%H@H%2|UjR0497UbFSX+7njXugg*=!YcqpbNSSE{Oe0|E zepC13^`H+6_z#5d_xrQijLRE_;l@6n&y6L|Zx?>KTu!G`kH-V^L)>b${>OhgSMK)R OeO{iQ{yy*HL-!pLj!icJ literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/5.bmp b/rosapps/downloader/resources/5.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fd5099eded63601871b9b7fdc3fa5a771ebf6696 GIT binary patch literal 822 zcmbV}TWHf@6vs2x;bjQQKsJU7>cf20!BBiqhTx0N3)_RT7a59z;EQ|kLGT8G1DOmI z?2vYww{^A(8(x@}xx}v5>9%(3Elrj-iOJd|?YA~*)9KkFbIdnC{@>x`e}3mAU%uv( zO_kWnYJ%7Rd+VQFfz__~7}RIC7~3!~?AQM;2ffhfn5ci{+T2f6Sa48vA5r%lZ?sR0 z(BitOO~aFz1wTJF=Mu8ARw^$ofgpiLFrjp4II!As?BfhL@ob@oNk2_xEUff`mu-UL z5R`W-5lR5GI%ka*la*kQ+RsU!(z$!2&>7{9_{eH!@Wgk@Obc!~?^f~vm@K%#LoYZF zXb~Ho-c5ud{*?o-7@fYK5P$@1mG7cO@J(N4_PgU7oxx4c5D1d0w*;6_TF2jr^Lt#e z?L_2am}?8Bj!!WM19XEsUi01yX3cnb+t=k&8}lozxS5qNMffYxpY37pbcj6@;!cIw z=4s}DpWf%A_Ik)&6Y;hD0I%GdPj{u{ZdU2$lrC1jla#I}(pSlaj+k(GDtYt=17nT( zwS%5Vq}an}ts?Rx&7R3y7Zx82==QwSGMRWLqH{5^%}?#Lc@4gUh}I8z@tkUx3Y4aQ z&S`c<8<5n8Y_@fZ9z)tSMyj)UI(-R)PcCY31vi5!f4(S`${$c^1nF;brQVEsc9ME2 zsT~2Ts*eE7;2}Pl0ICJQdNZ^4K*gGx zAOvIpU4^E;y}cbM2oE0s%K1H*WOw^Z*ScQa#*iBGm)k1_2QDFdjM$ls$a(2#_Qa H0n;-8-_=#w literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/7.bmp b/rosapps/downloader/resources/7.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1c8007b117d1675bdd79c617728a92a080dab064 GIT binary patch literal 822 zcmaiu%}T>i5QQTy-3V@6y7US904@bzMqEg-E2)*J3zcp}i$4+ZCvMW(RB6RDlq!PS zL|j-AS_P|V5(qXB2ztoKC8Pl_bBDPz-#K?CrV@i(a1zMlxWj*UfEx|^9OffKbg98{ zPf9*BIY#k%r~dqRKvwqGVC{g1~OX6WnUQDQXQc+Xq%ow*v-S zA;=$7Fq)>9E0-vs^?jc{rA!j25b62Ukto)$Zx|dV`|CnchG$VO#X5thRWYTwe`xFp z0_yP2%$8usaV*>Jn&ziroR!YWnKC1(K=ZrTJ3Ki?;ks_C{f_0)VgJG~EFph3^*j$k z2GBIK%uABQnydh6+IE=72v0j`MkMHWz6|8Z0>IETEen}BqoA)NFaacq9fciY>t84K BaXbJ3 literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/8.bmp b/rosapps/downloader/resources/8.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e30064272fd41a97b138de957e3b50c225ecb587 GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H0s;U+0BjhyVk_e~Q8R2j3WC&H>T0_rC}l22=x7 zdEnlUgAYLrJX-$z`E%##2cVkeSAJ9;{Wbsk-z%?vhC#M zejk2>-4=-Az4v|^E_!dY_+$5(A2ToioO$WzjEg@owLlbax%s{S%oo>H@BP<*sy^~< z`o$m9E_|N~MCZO8dhi42Fkm=9yboj_c<@7Y#xtwMuX;~?@m=>mX6wf(=e_~aFTSWKw}~5 zApt(;+$YJ2kEAC*$>06XeZ_0V>Cb#tzs}wDE_K`6bvM2M6`#Hbbq`P%#0zuJeH80| z=)dY^-NE-7GoAu%l$h{n`q_^_#Sh=0#~nn=ymKF2mOM?{`bxa-zDV!=>1VJjhByqO rWykHWsheNOO}IDh^n0u(Llh%xIduQ)mYbgmDn{0V=0RjLNn!&4R40Oq literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/9.bmp b/rosapps/downloader/resources/9.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1e28d936e2bd036696932e328b6b9954aa2f5a4e GIT binary patch literal 824 zcmbtQ&nts*82_@819Ef~N*XCm?+z}zVMGp+QC!u^a-cZSSZiZjb9iHG^KKzO=AuTE z8Z$1;i3hq2mUx#6f7(7Mv=PU zD)bH_xWNo6Bs5sDAfsapy>@sa{J0}bi7?@Etw4$yXbE~jUV0fBuMMkL3 z%gE)u3%q!6-v(Io2W!FTEZPQ9Zh~ZkZ3Y7l#18pBXPLr2^br<(3aPxAZLqsgC2>V& ze5aKN{P6e<7M-B@6*Tpsf0Dqj%=qFC>w~qFM2h>R;k3N&WUZ1=IXcI7@^`RS<%dD- J%s=&veF7ImWL^LO literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/download.bmp b/rosapps/downloader/resources/download.bmp new file mode 100644 index 0000000000000000000000000000000000000000..09ff0a35183eb3c856996e634aef9e4f5acff51c GIT binary patch literal 13914 zcmeHL`%_g_6t)=?XGer7 zJ9qj9`g(eMI=YaHTP>|On{PBXHWgKtjosmRsvxcYT3usZJviV)3Jj3IV-_-tOuYbC zUs@B`LBsb4?+@G^xZRHpf}PUd+SaOR(KKGKt*y1)>)~`ZbaKp+yz=6@n%buN2Jj&T z21wn8y4{bt&>-)oQC&iOq3hS)?(OP9{88WBPi$ML3ftS4zp`xKy9ui`n&!5fx4?%K z7$8v?v5Bw^p>qFhrwHQqh4UG31Mw5kt%yCo*(&IQ{;-lwW^{uh5_qk;%@^z~TBe-TuF>XYjU zld6M|qsh%-PMrrLy40`5xz)5a3Gm{>e_x>g`9F5-SbIDB(BKelSC3#Kb}0B$rc42J z`m|}=z6k?IfB_Ryzppnie&FUU0uDrEj9~;EfmGZsq|4piO-xMSxr2j4;^{Nr@7)It zZcCOj{iI>Cl@%}mV<<4ekc^N7Fr+>)JTx@>&|2@}{oa~m7MB7hT?w?T4Y6w2YSp;a zqx1Osx?@xKxDVVDhE87(nKp$f(kY!D}D8*1+%bL(Ra0VfRCQ^qsIzoNMf=f2%f{!l6Dme1yf#8T4rOT z`{IVbww6}XfBfh#7-ADq*6?)XIhecy{}p}gclDxEA<-?VuNMZG7p|XB>W4Hi9BT$7RgC0`w zkr&X6&yZl^j}1Za9G;f6iz){^F0rHyY2v4YNt@{BBR?^7$-kWyV3=rx#Ko3c`-9#m z+KWG}++&vIqsU!rUa;Q0cmpyuq1<2B%KSmwT?*gXqIxrac}_!xF%}JZOAFX%^=eW= z%aw%!OdMF43qAobM7U7vkXG<%B6`rx4NX|O*k81{fY&$5b9h?P?q|zB10E|1XC)Q} z>N7tbwoqol;XNOv^QgPO*JkgEpES9FwI@HW*gZ2paD0}J*#%!k-dY7RRrpU+uYL36Abi1k56&&#3Al{Gbvg`GejcJ@FF@F_;Vj;699A`Q3}`{g9<(!1URF~f%j(3 z0v^F+Mwv(uG~?|)_0jn00FWDSiGgu82{25=2uT1#g7~pq^+nS54DFTk+AC?=%c`DA zw8cf=Iu}JPD2VtVKYT`3fSJnEB;_kzJLeIrQO7o?#WtnJHl`{YR5SN`B$Ooa3I((w zXK-bO2!{ya4c)K62Y^Z$(HNrO(@~Dw6!h>Ku+%XmqsSWe9d;AFRpBfnB=3^AUEs+O z!VW!XD5sc?y+f+dQxV32i0cG~*xkn5>v$iSDnkT5YonP*EkYX?u@H2sw#uzoxu_t@ zF>lA53t_XeLuO_KD9)~WHStTd$ogbOq>JgUg*1hx8&VFwA!q3D#aT>q5$dPDAAyfX zuZP$U%n%*rD0++oDKbu3Bcm)slD?lov5KC+xk<;J4E^Pfz{Y^vsG^PcKJ~EMpcM{~Bw^8I*U3 z_=m;rKp5#Q6+LKh;9lyv6d?KcdN8RH^0g66x|S0jQ?LwNoL!JOEc;CxH<32L1TGn} z3nVqz!up|e2afTo2!Nv#pFVKGgRK|vodG#gYcGFZ5{GiPFn`y)3*ob~Lf=W>JR{9- za`Ni`Dn|$lu4IUnAjm8%qe=*JG#a)fO-KSnyh4u7_g=xxVM$SpbN;URPjY0JzQsoE zZ=JGk+-Y5{8_7OGZNaflHw0XpF%)rTltd$mkC84(nvevD7@{04FNrRMk4O#FfvNBXWuFaahnrTEv-A5{)E2M!F% zrg|fCG%;z_$a92y0;)Ir-X-G9D2YZAA0u6oG$9EPF(jU&Nl9MMnj;Zgvgr9DAYSV% z&&oNH`1bXDVSlDsl%v$1s^spAiJj%Yc9i_mR`hdg{^6Us2X18V(`4Z7b<(#>jK6z7 zlXV$vOazdl@w=SSOn2(uXAL#U&veGvk}+}wRK#qVM0XYKC7lFS4^A)Nx literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/help.bmp b/rosapps/downloader/resources/help.bmp new file mode 100644 index 0000000000000000000000000000000000000000..59a5bd52a9ac1d6fba3130e0de13619002da2f37 GIT binary patch literal 3126 zcmc(h*;8BR8OGiF{sFz}IfK!(vu}*+J~VfLH`# z2|Gea0>mbEfe?s&7yBX>VSyyH0Ro|g<)V*{98V@TPH#Fr^XbgtobUXe_kG^?`wrLd zUj6+g;<$?QpYeO|)$ezg{(vhScs}q)>(6@Q(xp9>=KnR+3Z-IOCRy89U0j}>7EO&$ zjtz~B3=ZKuIXaFz%kzty;&s`}ZIyiYzYkKgtCDVREzZtQjEo8Sg1VyYqEHvA>$MDr z%M_arFmOS2`7}T9AtNWXrLl?6>lzdeh$g3@^_xP99r@ad7?XQ>ofTwH%KZ-+!FJSxBIv%B^+7IOo`T4#c<#v3Du5_MRsF`Jy1)Q z2(lRjaew0&J8iIpEXXDG<^_$=Alf(dOer!1uP-Mp=~h7f*QUp8PDIURr=KFR;JhdH+wr{RP3o{Gi@k(o9pnP9cHH ziQ!04l2Gpd9UyP#E7dh*H^9$MOn|SCw6`R=wk5mqD4u+(Z(lA6*rDRE;nK*FvZ#^L z$f1((fx=Lz;E{A%KqO)o6erZgJlRvK-<0U9q&6nHpBVLLCuUJ|abt`l_?@Zl{48(8 zIq*}6eEX$BCMCx91S4*o9s{AlqA*DGWcx1j*^oFj8MrClK>doZkZj~S|6^aa3HVY^ zZC#WdH_i#cccps@a{S@Ra7lzxsZ^;{YT^*pyqIPsK?M@X0s(YqdT$K3LPEDI&3F9- zz+XymQv(O8(g9bl&DMs0Umxwzobae48k^|A8DE8`9h4h|0wkBCFuS-9AgW#LyP zjG_btAMv*(Kb~u^0Dq~sp*qUN%Fl7Svb#11ep|Y473p?ODEJP|iOz&S-hFw2L&f1^ z^cbx|3btOaKR!O*5%tX1r;DnSkrz4^4bYSA$D??({`go}5(B7WZ*LHW&;>qY)SD{T!GxRzb$1Kn$o9 z@`bCsOkePi_f-^|KfU7LdmnHNM!;=`|4nxAcXg5Xo8tbBU=WhE1c1Qjms8y)lgVs0 z;|z(_zFL$9YuRFch8N;N*KreEz(*^lz2^TMe@%n~-S-A7=o_>sN(_tIQ=TFPye`at zj-`YwBxCI-!~qGt{z%k7L-SjMZ~f7=DfVGonwKU1Jr!*E+5f*Q#IuOM`Gr@x_m_l4 zck3eUh!iYKxI2@O$O}Rpp|U+AJUu-{7Vt{GHisTSnr$!K5PU!^0*`%&l+hczViEY<6rb1qkA;@?;4epN`Kj61knp6` zs6#%7KsR3q^#5F(3Wt+pg%Mj^nfFNt3R8feguHX0j~+Y*GVP82fbFA?Rfe1 z`b8FvsR6xZ$w)!AJX!314KAV3SPPIqt+BGu`M{&52pi_(jO#t+PDiF6Y(yA{oE7}- z?i%W79;nJ_N+ns%v7Y6U4cenC8mSl(Q_bZ?Pd_d5A|wKCv7Ue1T@X3TW6M@&_EmC| z(V*AuD>6^3KKLKw`z+w(jY;Cnlktr);x@^Rfu&*H?onU9Z<-~fYC^z;*C zQQ`e%rTWk9sRhS8jLDn z<{YoO*yFPj_kWgoeSvaR`rTv%+=37`C}t2b0`H(kSdX~BB&f$L$el-vV3Qxe_4@@0 zd^(H0Znk9x8;|xeS-C#nmJtB2N<1to<nQ zn6NyVA@;SgPw@J$Y=7&Y{mk4<`;WP){+4}}P_c5}JVU)DorK8)%-px4F1o4MlC&Fagsr`6AA{?`ssw`TkCBMo5w8S2<39 YOSk<10~h#{n-PjfnDB1G|N7~F06nGMYybcN literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/logo.bmp b/rosapps/downloader/resources/logo.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4f10e49d3ef89219dc40f7bec9a329fe1f587a66 GIT binary patch literal 17414 zcmeHOYiyI}6=r|-XFvC6Q>RwdM#T^yf*@8|E4sGox{0Y>JE<*ItNmCjjaAyzYOU6F zy}*DpToRH1A&`VifW#1*G{lfNw+5ULCwA;FzQsIe=Pv)q(J47PIXMxHjz=QliHT4+90-L2!Jsb?81skx0qEnwFzmPsA9%taQFpmc z*8QF!uqeJkSaf^>y!yRk-Vx8}u-ok%8ge?F_Q64$!)~?NEjHVLl>|D(VYB0|(=j;g zbh%x_9`^`hkpUBcZ1<#27bkmhIuhtTUEQ$vUez1)ef zec>ldI`-6E#iIdx9j8e4ke`>PjNQD0Z@g7S!sA5tuybhnPR-}ec)1kcZ;Yoe@geB<6GJm3Y&v+r~n<8`h?ckn%PjEAt{z=753czAnbo99|y&s4?*)1$V< z9@(kE>mHuy-cc`J@9|1FSCv_NrVzM;Z+bz)i!}4yesB0LGT{7=EBMCuZ<*>Un`bTr z?%;doJfFZ;!-liloeyun(Be*hawU>++1(SZw#dtOXzu#4z(^z-x z*bzuayLPVTm)LHR%xd*%stWq7tLuBZ-~hL|94Lw#M0fa^$E>MlHQvEDJn-IxM>r@S z9vZ=U-ZUJ4zax}!*`W(pNm204WY7A&8JgepR8G3Q`KQ-F=d69gc;G;RB4qRPPo%TX z$&pF{%`2}xhYauhZL4Sp4U|?iLgzeC=oY!bpFKejvMH*9MI;qE`VxKc5yX>)lOw01 zLFz7jQ7%}FRq{@yHGh1`Fdg*ULFWDWbqS`UD(| zDJdU*{2n>rE&vr#R#47xAVf?8+<6Jn&i;w$e9gYUVRCJ00*ff_zS zupMdtQIleaxJAbN{O$0MP0A4PN4Ve$BW1=_#FvdwL_kHP7(US%x>zLLQWS<_$b#vl zl5iDE6_cPUOaL5EDsOItQzbA`FPIp1LnBnz$!@U51{e_w6SxV%y4EYgjAOTN)3Kdr%&NL4x< zwDp-kI<&Egan=DTAV`Q1{cvNT8L4l^H%HO&D;6ehO4e~uqY-xFGKe zg$4P(P-6;jK55Cgysowvbb7x%-@HY@6SoJ2QDB9UqUPz1iMBQANQGOZBO7!=kbuTV zW{xuORa}>hBJ>=^m57SyDZV$LT6{z-%^%#T4DLcqLb{lW%HYDdR4DWA?`;=O8-q_* zm@+Oeow4M1j4a>LD3+40bHz~7JA{R|1<+ai{^lrpoD(I;Kzkj)(F+cNi@Q`9GpDFi zERt@C&~w!M`@H|^98FaK8~ zt%d826lI2mnWMXW z<<|(J1a?}B24$WW_!b>4oDlV(5`^PvMdu9?QgYN!$>(a27Nu02pEE;I?(b@yL1V`gwO$V3TGymHZ&2* z&uj$JuA+B!hKz}%VqmAWX!ny5SIUN4I5x;gZj^`55>Tb6ipf(Xse0?!u4PXD3B89HKSgxzr-~6$I*ezE)7vHos(JFz< zaERanO{SA5p|PM5q2-t}q+)asNFdVwW4@e^AL^G6LX7eOqg--J ziVZUU$pjyJ{nzqZT<@y&wDe?jO55+|;uw^<_~zFcAVpDp0D=av2vTX+0y6U94M!tF zQ49^Dcy%Zgi#*VoZ=w@dUJE+;P%Jrceh|quAOv=15q8|AC~g)$aDZ?WCWd@)Wj87S zZZvR;Md8T>BZR|m^1Y?J^Ra!}s!n@kViHsH=TqHvQb^~WKI=%T?I{8GHMT^xEpf(n za|ljZ6IIrDl_h@Ck{W^&1M%YnGeaQ7DrV&75SU{}%<>VFTxOCFo8;2|lpHdqCZKgB z*)>CmH8MF@OgfgS$zhnwZHNkI)_ayY}28z&$B$U_DMryDINu?(U|eZC1x<@UeoH{=jsTd-^kH^1L%y>r9@53?|PGCe;`MN3zC| zzz|g1g$YO<191!ij)B`JLFyQYRf-dUlfWFSb0&KI$wv#cmj^tBm&_}6Xdc?$xN)!6 z>mTRh7y>9vGbw<85mbb~pg&@Vwr>5DGFH)=9Eee3d@8m!^VZu#xn{-5p8 zRP~Ns_T1*1i5Haxhv4=}F!Mri+Mdw+k~^CRANZtkO=0KS!^Ty`S6A-R;2lDN3-is7 zH1Vm14q+FML`C@h`j`&=5>%4D=)!!Xtj>Yab-SBdT~TNBMvpiCLBqgBSFCO@PEtP@ zuXo1l@T-Z^M71$+rq6puKT_Q@e6H7BXB=%bc`iv_t>kGP811l(b~$_ocgW_SbcPe| z==D+ghG#~+@(sOLeq?{wx(fUH3fr2425fPi)sqei^G(f&S8Qv%to^U;Y-%AL`t;T^ zZb@HsQGBD03%x_Cy;_|o2Ff8-{h@~LK%T3#sYcv(I8(mB^lwXRn_b6<8(zIVx; zTjkzx+_|<)TCwZmMZ@r{{p0C{qSHluAk7+he~szTFF`%&ivlHrPJ9Wt{rnbds=91{ zvZ$@kp9J5I=)a3}{uj%;SMJoXoM<;iqtWT<>94-}>iYHTvMdLK!B8j^kH>G^xbgMZ zUni5vNF?I(`9A%;H>X@$e{6953D<_I;ccxW>i&SL+M9dIy{^)}GOy|M6^FR=|A7vm zAtK64(9|Lqott>sUt7{FEddtUB^ZG@ z`G&_wb%re!I_r3f@?zcC*0W}j@0EEMSLQdb-lN@Irdz$QV|C%>HAT8LCEaTe=$}8) zpHphgDKq69m6&gw-t|)81MTRe>Ok(P(N%lek)P|xDocaFe0<|4ZhJLm{MPVa)W%vV zd`KVORMer`qs>i8^M<|J4F#>a``dH(f1xVAl3Suv9q3ja(yI>ls>%$iBmJs!NmVhR zsD~`>sSerZEIhyG9CVPF;rrbUpYdCmZ>kIbUfIy=dZwgxb4lB8N?Lzi()w(1>oY|y z&lI;lUDWbaQOhs)w>(j(-BhT3yg>UHWS9n#Z4=j-(@-f)Q76=_H*@Pdl-rW|E1fyJMfzr<0jUch2dlidI6zf0V_o%|ML(+?NxTH71=8}9!97t#oeI^+u#LskvYtC7|Q(Oc77IJ+^?2fL{$k&J(FlYHY zE?>uzQ$<5!+r`R3%ir`v8Ri{K9}=6+mOfKH*}j?We?c}6R551jgMY(v(`po|yc?Yu zh+Mkfhm!J#PI%^b;$)r@?zu|1<|yEjt-#SN1rBF+ z;9y1v4y1R$DYae1F{K^5liLte)hAygPvZxld&QTEWYj8ONWQgq92l0VEx)j#1Lg8g ztnf`m_Kj|&*LNYct`i0F?#HNTy#;N!Od6H94a&lvOC>lQQ?4t2GV3e8sYH2mH?~KX z;~j?!Fk9o_&#&x$z*{>m;4S+|EIbg0_YNiEW7l*zUzH&uuMU;X3M`jo!#lS{(?58; z>Q5wpF6$_|*@+9XHoUj@a=&b|bwT*;-m7?be;no?Ov0bN^6`mpF}@7HhRlX;v~>Rn z-@LYdyIEGhV66j1)At193(K7jf zc58_j4>da2m*-$WyLEMpo{wA&01&k46&49f!APhT^hEer17AxZ9B7)?CV{3a{*B9N z%i?2x4>Kk#2!5aAw0JNxwODd!f1YPHq zbFc24%k~dtZq=Pr`Tn8Io!WCI-D}VHKPP^`W3#jf`?)2aVNq zuZpuitQ2EH*rkU4t=d_UG4*Y)4X&8QW{0`l(NT_O6eG`;|aFP*HG62O2 z1QU`%1(i`?eP9Z7;D_+j!IDduep5$6QEv$^=( zADk~}K!lp}MK>W*EEmW8GkNvBL0R<=mU%>R-7)su0Vx;f zDD^eXZ_mnyWlX1`LU5or+<_1ujwk%#@_a9kGZw^RLNm@d@W3;g{x8)4wI(&+i!&6T zc~xLCVNT2*CRi4&LePZxly5EiZ9FlDc$fHq_}wtUvOXl^pz9C)vLz_}hIVF;IGqF1|h9+P7ufjy3ySkR88;nl-}XLhSbzm}FKAF_VG zoECiMUp_3HNS6;;zh`D6{^(gaEF4R27_$BosSSAlc=oX19A7(R{Vqv$n0p{~SlAnV zeK7jR7+D97XSn_MUa7zwhnQhu%XyioUn75_O&G5aK9UTreHXG`BOB?x@vHq|x+Vae z4;Eu8`y@J!qL5?;`x%4+DrPsIYq$lLlhlK;}^A7|<3!}b_h z`+aI;?K5lE=Fr>8v?df#q{NAw4!C7^z?C?j)d3gcXl6T(WVGWjaVWhV&S`BpKXo-1y~!PF-5vmG9pP5qq6XoPE8BRnW)y;9N_Ou9}NwIHIT1(#&4 zh^lBqY$ek!QrdhQyaqSfAqmrVCBx8KdW&@Tx4*UxzxX;}+Qc>f@*Nk7?H?;KqrPwfG{P;T30~RF@Xv2WSaCZd=sT3#I)R>@^!gs8)hbnA`=-FqHn4~KTs1v&kF@td zdUdbquk?G{WOcv~++V5Q?vAtcz1@$Mc+A)EIDKP`ft7!X;VS6@UAd#@qct#E1AR3> zYm$$oyY!7#D+qeTON^3^>6-aK@b3xga)LTJ(6_4knjYP2#P_KL!Tu2?S|_|t!3!o| z5&i2F9N`>Iqct#E1EV$YzrO}Jw)`r=Ybv~#fY-Q25?)U+B@Bq6Mv}(SJ-p_`>vOLY zJRI{H%}DYV>H8JI>weP-UIXMc&u1mBbKdL1_x*-=kKpyKg(J*j(#LCy{GQ2saAp!u z-BUupbDv>9x!(U-&@=i-@8i|Z<5zlA8(aByjTkH3%k(~2>MXo8_A|2MV}k3B+hZER z_4}m6>v!DW+1I(R{)gR(cXmenxHqmA?pdvma3ZS(8r(8lFc7YEojIQII4*RppL9AV zj-@w?Y`$29S(`%dj{R`iakAr21h+r0ug)NNztqzbKcm#&UVfYEyUjISF7EBv8sCb6 z*h1F_O&paS1iY{0`$$@wU3sd8Y*|eFmf-bSUVrCj^J$6KGED^2nXemI`SqSI>%zLI zmJx-0Jdxc7Lo2@@$rgT%W81m!7!%ybpOwZ67V{^u{b$O$N7Qz%tB3YW=rvUwdw4A5 zada@YYkYf!?GKlAV)bSDi1KYr6FoPrw5}kzL&k92hM&u!CbD1B8$xm16%h?1%Gyge za5Sx1WB*X?)|40R51{q>zlYb1C{_`5I7sUuhE`(zYwQ_nF4`~2Yr*G1l_Scs)7P*s zz5&$!+<%@oiS~PEH{laM*@*H*a0PZp*S)y?mXcnMcP#OwJ(wfNU!|wLfA!Kdtv)&J+{{^xgHCSWR56H+;j2$`HEq%->=stv36KuMMH@>Ek2$p z?oWEo=l2zQ;9n8`;cGl@m2a-;G9e`kz$Nn<;UYspFMr~Q|GZ)Eq(ta z#!hJ7qIVAlM%EG@hX;h}huiokf#zP4OYtMJMZ{8~q8Ly7(*{#Riup|27_3aF?)=H( zT+b6fOR4R~yj>S)ja~A0UHhrN`Q500--N!E-(UXIE%8ngt@j_zqF5Nc%kulIGsnb; z1H}HccI+cG`=wkL@9N|MV_3JCoYrK-ed?VuzaT39YarwrRbOZ;5Nc_r!Ox zE!a$a8`B3LM_=p0>d=CF6IKU=YiysiR65SU+MC}=g$b+uBTQENw@_cPrBm)}0>v9I zd8IWxxKQ4SqU=+oFDIRMjxiw*3*e%lyr&VNsJAD^gh=yzZAs^Jdr%)<1VoxJ`cGXj~O8Pz=nQ?0*u^;~V!!?LMh#Gq(L|l@e=1^C+G!fyu^mcc$)$ zh1qu(c`WLpF`d^U22A9`5>wlN+u;RrLPo4(=c{lX=& z2Ci|HaE&U3TXZoz<4fR|C__+6Il|K`aW=gi=QGO@nN^0^f@?^X)g$|Q6AJ1(P%7_1 zdCQ%CDq8O#vZNWNn%Y&t3pv# zHA;vAStYUxOOcXOfU_~Fn7{KJK5)&&2kwPFsFF$w4I4!eAmEI z^6yVITU8Dd|3aw$=VD)YBII&8y1Ke>@7_K1 z^z@*$wH4LX)u^tiL3?{U?%utN`}gldsZ^q|u@O~ORj~Dmqu6s6%nug9{BSAEkH}yh zF2jkWYSql6Wn@3aruSyRaCJbBfu(eXmU)9Zq-SCO+uP3eq|$x`Zi7II$#1<~g+RtuK1`kkZ;+g>I!aWyn#Z)OoAM7q& zQ+?{5s?ylqpVR-POx_TRDVt7X=9UOd`HtiNk(j#e3Z`z4#x(m_yuLRH(|0Fh`kpkZ z*UU%lKU56gwAu&D!^%~&T(6T~1sK0RyvNYW-)#W1hH~j8^1+?vhC4K_-ttJT!_L@x zyt(xZW_=rqnVX1jLNN2&aLn3F*S7qCSz9k)wp}D?XhVC)~iHf>ram~O=dY$qb8ux1Tt)z8y-avEFO#^FxLMkVki57ip z|2Dc7J-VOa@yZ^(GFk(pH85HOqc!mVw+8yQ4DtUqae8)6dyZ(=ksxqjhoh{t7fFoD zi@BcqTq_sLQADs;U0%GO^t@;;$|E_oYW?1tB3nfdGHyw{G%gCi{4P zaNM2hMo#3i`b-JD$@h9#4~jV_#u(_mqqT-@+mLfcj1eIOc<b(B_k8i572>Gtv~y& zeQ)1)ci;CrcJ&H7vghgFlYjQZuMB?g!tW=0-hh73p7(&EeFy!X5}_c6J!nb9H$|sn&c*k9)!I%vRbfA-?We zX@f(`*(t-_uWxVXsCSlc@Yv7I7{AD1c(>GCHcwwM86Z#g_CQ~@Oq3-NW{Cx;Ws3R9{Px4yjC0xPYSl2<{PzAgJ8LPn zt+(*NPft$&Jjf@1VTyWvBv_{iRLlHT62HM-AGy%Gzx!Nor>C&(ba(Tq&Ib23&dFxB zTSKKQr~CxF)TOfMcts&&v0%N0cg~VHUE#ZKK{{c5ldn% z&5`t~u<@Y~?Lg3oG*Bt=SBU&%0$&NwOVoK*(CW!+I^EGg?d1k>o89UvPSmhms)~sm z0f02YZrU5{J2p14VqJdp?Zch56x-R`5ySNR>4_!Qxrpl{Wc_gX*ie{O9x@^g9ufx* zi2S7jKQY&*r^AciN)_`uOfzI*heu=8$+`+xcIk=AB1jF9snlNHZ(>RMS>yK)A8qH5 zcbsp1W4cfBbBZj+$VoM{hzS*0HyEywhYm}k)v~m$^0WyGi=N;{B!U0X7%FEWe=NxI_{eY{1Jz+&Q?Ax*R0rkPA>&uLEisp?XX>Js*|Q%e#(%TG$0C>3PQ!ai)uyMpd^6ToG9jJ%ll&Z?OyfQ&T-1m)|PwL zmeF{vCrg=EgxwqT4Hf}KXVb?-MH3e6!^bJ>VWf_8Awg(}_r&w?)|+o4I+3HmfB;;Q zz&(6{y>Y}Pe0Dk@u`2?F9qC4Wl0la|GnPD~OPtm+=cnZNZ*fP#L3p?76=WV(yuP% zE?caivN&%p$jb)`(BZ*GM(o4KDeGZ-U9?SL+ro<*)SQ*&6`=d>@7~2Fr}UF(2tC@` zXs;<1Lm-Lf0w-}5drVkxBJeC_!XANY!GCNJN;}9AeMXl)GbX!#YvA6k?o|uNJR76x zj~eWw%6lUE`Q$!svRuT}3>9gWnX=x1)>{9@>hld%ehrn>&c@*Ss=$ikjkxD|<_tug zm62&9oSvEnbl@U7S{Ymhr>uw9(Fd7T0(@c2nh*VoI6`?m+~eSKwSoHinjRZ5~2y-~6rs)QfW%cTfAk|hFa zcUy3KeNannU=ur_v6|A}KyKk2XXb9iJ@jDfb>lX|I*k@W1}>u8hmTX%!|Un7Ed%FU zXmAKR-1hI^zn&y|gkbw5B_zV`gDr;71zPwJ$H<^_`}Z>G(eU0nK7?|F`i$9e_R@U& zszrQzC3Retq#1}GmKEqVm4=BHlR;>mr^`hYVLQ3IHN2}Sw7ov0r8c;^CcLdKrlaxT z#ng>>h~lz;)rGSN4;jbEEKXSu+e<=r;%RZ{1VdUcz4VeoCbySF6gYmNR6vq=kGRk~ zo|+JI3V5ACqm8TJpu=NuhP2$GX5ARZ@F8 zse*P2ua(r<6y8=J*2;k#L237PO58>q!(+6O$5{yDU;pg6NZqj{Q3D)5c1$YnhwMPs zhago7CV5LfA(m^B$H^v;%ohzORllMh87b z?QG*@*Wz5~!ffTF&b_(XvxR-WtuCyykVb5fHx zt)q_)CXC3q*7+`rDOxJbRV#eCjc$#Vu65<`?asZ13SFnTXx@X!!mQhYY41}RU!3pYcR1$I7 zPff6#3yjM*_T@0bCRESJ5gd0TQg5Z$XQ-Dv+#fdB*Su(KTbwJHP6Ik&R!O{ude6y) zXZyQ7#a(Aa?Wg%Ir+7^so%N6)7k0_#CHY75vp>#ae3X*#5hMO+dh$CNiJE!Sb3Mdk zv=PQx2*W0Vdjwvc;7NuzT;eL(xFk$be6Sh9&1@f-|BHcW#qwOU-dk+2>_f{=~d=I5*>?w4_7H zw1Y`82NRZc9u)X zj?rR$JDU7LpqJCzz8LbX#p2jo2XQ%IIkvfJ?j~l$RdBp%AD*e`@t2%(A#ZhMX?4X4 zZRG}PmX#Zp8_UoZmzRiUUS2XUSy5Y9vMyLHsLfj~^OnUYZP9G{Z=1W?)#7?7>zR`h zLU=ivFY+TYt(PjuW37E1WIv(OvquIXo(*seOU0;{+0{F)N9_VAmaVE-suOf-}S330T<__!zKK~f?;DTzT( zg7P4R@!XmrzmTaJ(+o^c{4q6&u)hnOvI2fr^DlL^JbLVeBK+>R_x_yCsFVGO|8wG$ l5dQCtSXWk0<>kB*9=P?d4X`D@Y;F3#U$NZ)cUJ&b;6FT6k{kd4 literal 0 HcmV?d00001 diff --git a/rosapps/downloader/resources/update.bmp b/rosapps/downloader/resources/update.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d21aeec828f938e2715a001910f8fcc017fc3e91 GIT binary patch literal 3126 zcmeHIX;53&6?XskUuHU;X(rR@pSFMU%Sk5V*pq@-i~^np$7^syZHR4*30uInEP+5! z#q0RRj{?lI``B^@N{txi{_8-qLj{F)%An;%GQTPc@967QO2>p+=c`O)01K|ea z|4LK=A8NPEDdh?we|%(!#q1yGf7l0YaNsd_gd-J8%zC5W?fnmYp|LQPE#^mpDSpm6o-)r^dc0#ZQ(y@AK&%_vo<$M;rz z*gL1);c>g&2x2yw)oL}Ei$tQOr6sXgjG`zE_60s!EEXt8rBazp2FjLMi`VPLP!#j| z--X}P)t#Dhh@X;@5(a}&R#x`YKM93Gd4nIIh*C^(SZ!~`e`6B1xVo|mOdv>*^73*Z z?e@zN9C6$nnP@R_6QCQeRrFNH=J|GavQ&Vq$_0_%0SF~bD2n{wj z`S5Yho9UiLIyx!Bg8qM%eSVhpiNklp}Pa9CJmB=W^E=O;&%DL>dHaH)_o)c?iW= zP4@|>P7T-BE2ib+d|pRxJo_%5b?4+z9&RA(L|6Lp`{^eesw$eu$k|Oz1Eeb!%dFGsWY9{-sNV{x7xYRjpuL}E4$rxFO~u~2TdH!co|!Xe$AD15%Y#Sr<#<94fB36s?1 zWZ-$ABzuTnxVX5uy1Kf)zCKiyDXqUDu1TFJ`^y;R%)o;xIQ9dN9+uunuFuRYNlJp{ zPfrC-CnBd3Ts@3KkptUfJ&ogi&Acf^fFO@9Yr=e2nyYQqjnY*jn-2X ztd>{UFYQ*-^iZQ^xWd?9s_7z5H)ks)0-w)kGMQ+UTlX`+-8*1pGMIO?`7bBCv$GE2 zb2@6f%Wuu9XDtBp$+GCNqU6$_!j%E}6Y zAd2bfifaj-#l?kZ&Vada41u_iA`vY%J#Ws-;2$w|QPQxM~{TbWT0@>$m;-XNbyb)b8WMV0meY)8EPGar$d( z!}zjEj9lQYsXD-iu*=dCDsLvbX3c<4xp>i!AiTcz8E$J(&E7^7y9>76Mf>ieV<$N4 zGRR-Y*Q*tCR?DOI#>btVq|>LtT>JzpzvpB2V=xXkx6N9d99fzYqmw>?nNCW{)aWRH zyx7?h4)?wcSpa!=$r)~2euF_J4PvN5G^*hDNymo$e!tCTYp2m#NhC054`cK?pKj(L zbLY_j`OdS>uB=Q7+0QV`?viVF34ykanjKaXpV=ki^jl2& z&CN|XMNWr$J~33(Rc=Y+C{Ax?79rCN*N-l#sKrz6RHsb#^u% zkC%?H1HO>tDXNqoFb`06gQks=kskTswd21^`_pgkp8L#e-@ASKDk`hf(^r<4l_G)i zDaWCa81)*3aKxsZK(*s@GPXgZoDT(O_4=Yqmmnpf+L#RigZ9mffPOnUC;pG$ANydx z!9fc6e83X8C_aDQD3@a%w@x$$Xuyep$Fffj&y4gaxFdqz-aGN}J=CAz^76Vu9w%^n zsHTOCli(rwjUgE{jFRX7`nq zl_n(t=dh>yAn!SVLJEa$psvWQngSD82y90OxrluBYz__wNd&NMqyjl_6gKodG5@dj HE(ZP%SOXt^ literal 0 HcmV?d00001 diff --git a/rosapps/downloader/rsrc.rc b/rosapps/downloader/rsrc.rc new file mode 100644 index 00000000000..8c38be58043 --- /dev/null +++ b/rosapps/downloader/rsrc.rc @@ -0,0 +1,27 @@ +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +IDI_MAIN ICON DISCARDABLE "resources/main.ico" +IDB_LOGO BITMAP DISCARDABLE "resources/logo.bmp" +IDB_HELP BITMAP DISCARDABLE "resources/help.bmp" +IDB_UPDATE BITMAP DISCARDABLE "resources/update.bmp" +IDB_DOWNLOAD BITMAP DISCARDABLE "resources/download.bmp" +IDB_UNINSTALL BITMAP DISCARDABLE "resources/uninstall.bmp" +IDB_UNDERLINE BITMAP DISCARDABLE "resources/underline.bmp" +IDB_TREEVIEW_ICON_0 BITMAP DISCARDABLE "resources/0.bmp" +IDB_TREEVIEW_ICON_1 BITMAP DISCARDABLE "resources/1.bmp" +IDB_TREEVIEW_ICON_2 BITMAP DISCARDABLE "resources/2.bmp" +IDB_TREEVIEW_ICON_3 BITMAP DISCARDABLE "resources/3.bmp" +IDB_TREEVIEW_ICON_4 BITMAP DISCARDABLE "resources/4.bmp" +IDB_TREEVIEW_ICON_5 BITMAP DISCARDABLE "resources/5.bmp" +IDB_TREEVIEW_ICON_6 BITMAP DISCARDABLE "resources/6.bmp" +IDB_TREEVIEW_ICON_7 BITMAP DISCARDABLE "resources/7.bmp" +IDB_TREEVIEW_ICON_8 BITMAP DISCARDABLE "resources/8.bmp" +IDB_TREEVIEW_ICON_9 BITMAP DISCARDABLE "resources/9.bmp" +IDB_TREEVIEW_ICON_10 BITMAP DISCARDABLE "resources/10.bmp" + + +#include "translations/de.rc" +#include "translations/en.rc" +#include "translations/fr.rc" +#include "translations/id.rc" +#include "translations/it.rc" diff --git a/rosapps/downloader/script.c b/rosapps/downloader/script.c new file mode 100644 index 00000000000..c7ebb082e17 --- /dev/null +++ b/rosapps/downloader/script.c @@ -0,0 +1,246 @@ +/* PROJECT: ReactOS Downloader + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/downloader/script.c + * PURPOSE: Run (un/)installscript + * PROGRAMMERS: Lester Kortenhoeven + */ + +#include + +#include "resources.h" +#include "structures.h" + +extern BOOL getUninstaller(struct Application*, WCHAR*); +extern INT_PTR CALLBACK DownloadProc (HWND, UINT, WPARAM, LPARAM); +extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT]; + +static void DownloadScriptFunc (WCHAR* URL, WCHAR* File) { + struct lParamDownload* lParam; + lParam = malloc(sizeof(struct lParamDownload)); + lParam->URL = URL; + lParam->File = File; + DialogBoxParamW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc, (LPARAM)lParam); + free(lParam); +} + +static void ExecScriptFunc(WCHAR* Arg) { + STARTUPINFOW si; + PROCESS_INFORMATION pi; + + memset(&si, 0, sizeof(si)); + si.cb=sizeof(si); + CreateProcessW(NULL,Arg,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); + CloseHandle(pi.hThread); + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hProcess); +} + + +static void DelScriptFunc(WCHAR* Arg) { + DeleteFileW(Arg); +} + +static BOOL UnzipScriptFunc(WCHAR* File, WCHAR* Outdir) { + HKEY hKey; + DWORD Type = 0; + WCHAR ExecStr[0x100]; + DWORD currentlengt = 0x100; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\7-Zip",0,KEY_READ,&hKey) == ERROR_SUCCESS) { + if (RegQueryValueExW(hKey,L"Path",0,&Type,(LPBYTE)ExecStr,¤tlengt) == ERROR_SUCCESS) { + if (File[0] != L'\0') { + wcsncat(ExecStr,L"\\7z.exe x ",0x100-currentlengt); + currentlengt = lstrlenW(ExecStr); + wcsncat(ExecStr,File,0x100-currentlengt); + currentlengt = lstrlenW(ExecStr); + wcsncat(ExecStr,L" -o",0x100-currentlengt); + currentlengt = lstrlenW(ExecStr); + wcsncat(ExecStr,Outdir,0x100-currentlengt); + ExecScriptFunc(ExecStr); + RegCloseKey(hKey); + } + return TRUE; + } + RegCloseKey(hKey); + } + MessageBoxW(0,Strings[IDS_UNZIP_ERROR],0,0); + return FALSE; +} + +static void AddUninstallerScriptFunc(WCHAR* RegName, WCHAR* File) { + HKEY hKey1; + HKEY hKey2; + LPDWORD dispos = NULL; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_WRITE,&hKey1) == ERROR_SUCCESS) + if (RegCreateKeyEx(hKey1,RegName,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hKey2,dispos) == ERROR_SUCCESS) { + RegSetValueExW(hKey2,L"DisplayName",0,REG_SZ,(BYTE*)RegName,(lstrlen(RegName)+1)*sizeof(WCHAR)); + RegSetValueExW(hKey2,L"UninstallString",0,REG_SZ,(BYTE*)File,(lstrlen(File)+1)*sizeof(WCHAR)); + } + RegCloseKey(hKey2); + RegCloseKey(hKey1); +} + +static void RemoveUninstallerScriptFunc(WCHAR* RegName) { + HKEY hKey1; + HKEY hKey2; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",0,KEY_WRITE,&hKey1) == ERROR_SUCCESS) { + if (RegOpenKeyExW(hKey1,RegName,0,KEY_WRITE,&hKey2) == ERROR_SUCCESS) { + RegDeleteValueW(hKey2,L"DisplayName"); + RegDeleteValueW(hKey2,L"UninstallString"); + RegCloseKey(hKey2); + } + // RegDeleteKeyW(hKey1,RegName); + } + RegCloseKey(hKey1); +} + +static void MessageScriptFunc(WCHAR* Text) { + MessageBoxW(0,Text,Strings[IDS_WINDOW_TITLE],0); +} + +extern void LoadScriptFunc(WCHAR*, struct ScriptElement*); + +static void RunScript(struct Application* App, struct ScriptElement* Script) { + BOOL bRun = TRUE; + struct ScriptElement* p = Script; + INT SizeB = 0x100; + INT SizeA = sizeof(p->Arg)/sizeof(*(p->Arg)); + INT i; + int currentlengt = 0; + WCHAR ArgBuffer[SizeA][SizeB]; + WCHAR BufferA[SizeB]; + WCHAR BufferB[SizeB]; + WCHAR BufferC[SizeB]; + WCHAR* Pos1; + WCHAR* Pos2; + WCHAR* Pos3 = NULL; + BOOL bNext; + while(bRun && (p != NULL)) { + + for(i=0; iArg[i]); + Pos1 = BufferA; + Pos2 = wcschr(Pos1, L'%'); + if(!Pos2) { + wcscpy(ArgBuffer[i], Pos1); + break; + } + Pos2[0] = L'\0'; + wcscpy(BufferB, Pos1); + Pos1 = Pos2 + 1; + Pos2 = wcschr(Pos1, L'%'); + while (Pos2) { + Pos2[0] = L'\0'; + if(bNext) { + if (wcscmp(Pos1, L"name") == 0) { + Pos3 = App->Name; + } else if (wcscmp(Pos1, L"regname") == 0) { + Pos3 = App->RegName; + } else if (wcscmp(Pos1, L"version") == 0) { + Pos3 = App->Version; + } else if (wcscmp(Pos1, L"maintainer") == 0) { + Pos3 = App->Maintainer; + } else if (wcscmp(Pos1, L"licence") == 0) { + Pos3 = App->Licence; + } else if (wcscmp(Pos1, L"description") == 0) { + Pos3 = App->Description; + } else if (wcscmp(Pos1, L"location") == 0) { + Pos3 = App->Location; + } else if (wcscmp(Pos1, L"regname_uninstaller") == 0) { + if (!getUninstaller(App, BufferC)) { + BufferC[0] = '\0'; + } + Pos3 = BufferC; + } else if (wcscmp(Pos1, L"location_file") == 0) { + Pos3 = wcsrchr(App->Location, L'/'); + if(Pos3 == NULL) { + BufferC[0] = '\0'; + Pos3 = BufferC; + } else { + Pos3++; + } + } else { + Pos3 = _wgetenv(Pos1); + } + bNext = !(Pos3); + if (bNext) { + Pos3 = Pos1; + currentlengt = lstrlenW(BufferB); + wcsncat(BufferB, L"%", SizeB-currentlengt); + } + } else { + Pos3 = Pos1; + bNext = TRUE; + } + currentlengt = lstrlenW(BufferB); + wcsncat(BufferB, Pos3, SizeB-currentlengt); + Pos1 = Pos2 + 1; + Pos2 = wcschr(Pos1, L'%'); + } + if (bNext) { + wcsncat(BufferB, L"%", SizeB-currentlengt); + } + currentlengt = lstrlenW(BufferB); + wcsncat(BufferB, Pos1, SizeB-currentlengt); + wcscpy(ArgBuffer[i], BufferB); + } + + if (wcscmp(p->Func, L"download") == 0) { + DownloadScriptFunc(ArgBuffer[0], ArgBuffer[1]); + } else if (wcscmp(p->Func, L"exec") == 0) { + ExecScriptFunc(ArgBuffer[0]); + } else if (wcscmp(p->Func, L"del") == 0) { + DelScriptFunc(ArgBuffer[0]); + } else if (wcscmp(p->Func, L"unzip") == 0) { + bRun = UnzipScriptFunc(ArgBuffer[0], ArgBuffer[1]); + } else if (wcscmp(p->Func, L"adduninstaller") == 0) { + AddUninstallerScriptFunc(ArgBuffer[0], ArgBuffer[1]); + } else if (wcscmp(p->Func, L"removeuninstaller") == 0) { + RemoveUninstallerScriptFunc(ArgBuffer[0]); + } else if (wcscmp(p->Func, L"message") == 0) { + MessageScriptFunc(ArgBuffer[0]); + } else if (wcscmp(p->Func, L"load") == 0) { + LoadScriptFunc(ArgBuffer[0],p); + } + p = p->Next; + } +} + +DWORD WINAPI InstallThreadFunc(LPVOID Context) { + struct Application* App = (struct Application*)Context; + + if(App->InstallScript == NULL){ + /* Default UninstallScript */ + struct ScriptElement* Current; + Current = malloc(sizeof(struct ScriptElement)); + App->InstallScript = Current; + memset(Current, 0, sizeof(struct ScriptElement)); + wcscpy(Current->Func, L"load"); + wcscpy(Current->Arg[0], L"script/default.install.xml"); + } + + RunScript(App, App->InstallScript); + + return 0; +} + + + +DWORD WINAPI UninstallThreadFunc(LPVOID Context){ + struct Application* App = (struct Application*)Context; + + if(App->UninstallScript == NULL){ + /* Default UninstallScript */ + struct ScriptElement* Current; + Current = malloc(sizeof(struct ScriptElement)); + App->UninstallScript = Current; + memset(Current, 0, sizeof(struct ScriptElement)); + wcscpy(Current->Func, L"load"); + wcscpy(Current->Arg[0], L"script/default.uninstall.xml"); + } + + RunScript(App, App->UninstallScript); + + return 0; +} + diff --git a/rosapps/downloader/structures.h b/rosapps/downloader/structures.h new file mode 100644 index 00000000000..fc1fee118c2 --- /dev/null +++ b/rosapps/downloader/structures.h @@ -0,0 +1,40 @@ + +struct Application +{ + WCHAR Name[0x100]; + WCHAR RegName[0x100]; + WCHAR Version[0x100]; + WCHAR Maintainer[0x100]; + WCHAR Licence[0x100]; + WCHAR Description[0x400]; + WCHAR Location[0x100]; + struct Application* Next; + struct ScriptElement* InstallScript; + struct ScriptElement* UninstallScript; +}; + +struct Category +{ + WCHAR Name[0x100]; + //WCHAR Description[0x100]; + int Icon; + HANDLE TreeviewItem; + struct Application* Apps; + struct Category* Next; + struct Category* Children; + struct Category* Parent; +}; + +struct ScriptElement +{ + WCHAR Func[0x100]; + WCHAR Arg[2][0x100]; + struct ScriptElement* Next; +}; + +struct lParamDownload +{ + HWND Dlg; + WCHAR* URL; + WCHAR* File; +}; diff --git a/rosapps/downloader/translations/de.rc b/rosapps/downloader/translations/de.rc new file mode 100644 index 00000000000..497325ac15c --- /dev/null +++ b/rosapps/downloader/translations/de.rc @@ -0,0 +1,36 @@ +LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT + +IDD_DOWNLOAD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Download..." +FONT 8, "MS Shell Dlg" +{ + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12 + LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" + IDS_WELCOME_TITLE "Willkommen im ReactOS Downloader" + IDS_WELCOME "Bitte whlen Sie links eine Kategorie. Dies ist Version 1.0." + IDS_NO_APP_TITLE "Keine Anwendung ausgewhlt" + IDS_NO_APP "Bitte whlen Sie eine Anwendung, bevor Sie die Download-Schaltflche bettigen. Wenn Sie Hilfe bentigen, drcken Sie die Hilfe-Schaltflche in der oberen rechten Ecke." + IDS_UPDATE_TITLE "Update" + IDS_UPDATE "Diese Funktion wurde noch nicht implementiert." + IDS_HELP_TITLE "Hilfe" + IDS_HELP "Whlen Sie links eine Kategorie, whlen Sie eine Anwendung und drcken Sie die Download-Schaltflche. Um die Anwendungsinformationen zu aktualisieren, drcken Sie die Schaltflche neben der Hilfe-Schaltflche." + IDS_NO_APPS "In dieser Kategorie sind bisher noch keine Anwendungen. Sie knnen helfen, indem Sie Anwendungen hinzufgen." + IDS_CHOOSE_APP "Bitte whlen Sie eine Anwendung." + IDS_CHOOSE_SUB "Bitte whlen Sie eine Unterkategorie." + IDS_CHOOSE_CATEGORY "Bitte whlen Sie eine Kategorie." + IDS_CHOOSE_BOTH "Bitte whlen Sie eine Unterkategorie oder eine Anwendung." + IDS_XMLERROR_1 "XML Datei nicht gefunden!" + IDS_XMLERROR_2 "XML Datei kann nicht verarbeitet werden!" + IDS_DOWNLOAD_ERROR "Die Datei konnte nicht runtergeladen werden.\nBitte prfen sie, ob eine Verbindung zum Internet besteht." + IDS_UNZIP_ERROR "7-Zip nicht gefunden.\nBitte installieren Sie 7-Zip." + IDS_VERSION "Version: " + IDS_LICENCE "Lizenz: " + IDS_MAINTAINER "Maintainer: " +END diff --git a/rosapps/downloader/translations/en.rc b/rosapps/downloader/translations/en.rc new file mode 100644 index 00000000000..5921e961ef9 --- /dev/null +++ b/rosapps/downloader/translations/en.rc @@ -0,0 +1,36 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +IDD_DOWNLOAD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Download..." +FONT 8, "MS Shell Dlg" +{ + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12 + LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" + IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader" + IDS_WELCOME "Please choose a category on the left. This is version 1.0." + IDS_NO_APP_TITLE "No application selected" + IDS_NO_APP "Please select a Application before you click the download button, if you need assistance please click on the question mark button on the top right corner." + IDS_UPDATE_TITLE "Update" + IDS_UPDATE "Sorry this feature is not implemented yet." + IDS_HELP_TITLE "Help" + IDS_HELP "Choose a category on the left, then choose a application and click the download button. To update the application information click the button next to the help button." + IDS_NO_APPS "Sorry, there no applications in this category yet. You can help and add more applications." + IDS_CHOOSE_APP "Please choose an application." + IDS_CHOOSE_SUB "Please choose a subcategory." + IDS_CHOOSE_CATEGORY "Please choose a category." + IDS_CHOOSE_BOTH "Please choose a subcategory or an application." + IDS_XMLERROR_1 "Could not find the xml file !" + IDS_XMLERROR_2 "Could not parse the xml file !" + IDS_DOWNLOAD_ERROR "Unable to download the file.\nPlease check you internet connection." + IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip" + IDS_VERSION "Version: " + IDS_LICENCE "Licence: " + IDS_MAINTAINER "Maintainer: " +END diff --git a/rosapps/downloader/translations/fr.rc b/rosapps/downloader/translations/fr.rc new file mode 100644 index 00000000000..4efedf6348e --- /dev/null +++ b/rosapps/downloader/translations/fr.rc @@ -0,0 +1,36 @@ +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH + +IDD_DOWNLOAD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Tlchargement..." +FONT 8, "MS Shell Dlg" +{ + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12 + LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "Annuler", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WINDOW_TITLE "Tlcharger ! - Tlchargeur de ReactOS" + IDS_WELCOME_TITLE "Bienvenue dans le Tlchargeur de ReactOS" + IDS_WELCOME "Veuillez choisir une catgorie sur la droite. C'est la version 1.0." + IDS_NO_APP_TITLE "Aucune application selectionne" + IDS_NO_APP "Veuillez slectionner une application avant de cliquer sur le bouton Tlcharger, si vous avez besoin d'aide, veuillez cliquer sur le point d'interrogation dans le coin suprieur droit." + IDS_UPDATE_TITLE "Mise jour" + IDS_UPDATE "Dsol, cette fonctionnalit n'est pas encore implmente." + IDS_HELP_TITLE "Aide" + IDS_HELP "Choisissez une catgorie sur la droite, puis choisissez une application et cliquez sur le bouton Tlcharger. Pour mettre jour les informations sur l'application, cliquez sur le bouton ct du bouton d'aide." + IDS_NO_APPS "Dsol, il n'y a pas encore d'application dans cette catgorie. Vous pouvez contribuer et ajouter plus d'applications." + IDS_CHOOSE_APP "Veuillez choisir une application." + IDS_CHOOSE_SUB "Veuillez choisir une sous-catgorie." + IDS_CHOOSE_CATEGORY "Veuillez choisir une catgorie." + IDS_CHOOSE_BOTH "Veuillez choisir une sous-catgorie ou une application." + IDS_XMLERROR_1 "Impossible de trouver le fichier xml !" + IDS_XMLERROR_2 "Impossible d'analyser le fichier xml !" + IDS_DOWNLOAD_ERROR "Impossible de tlcharger le fichier.\nVeuillez vrifier votre connexion Internet." + IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip" + IDS_VERSION "Version: " + IDS_LICENCE "Licence: " + IDS_MAINTAINER "Maintainer: " +END diff --git a/rosapps/downloader/translations/id.rc b/rosapps/downloader/translations/id.rc new file mode 100644 index 00000000000..89d642d2074 --- /dev/null +++ b/rosapps/downloader/translations/id.rc @@ -0,0 +1,36 @@ +LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT + +IDD_DOWNLOAD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Download..." +FONT 8, "MS Shell Dlg" +{ + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12 + LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "Batal", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" + IDS_WELCOME_TITLE "Selamat datang di ReactOS Downloader" + IDS_WELCOME "Silahkan pilih kategori di sebelah kanan. Ini versi 1.0." + IDS_NO_APP_TITLE "Tidak ada aplikasi yang dipilih" + IDS_NO_APP "Silahkan pilih Aplikasi sebelum anda mengklik tombol download, jika anda membutuhkan asistensi silahkan klik pada tombol di sudut kanan atas." + IDS_UPDATE_TITLE "Mutakhirkan" + IDS_UPDATE "Maaf fitur ini belum diimplementasikan." + IDS_HELP_TITLE "Bantuan" + IDS_HELP "Pilih kategori di sisi kiri, lalu pilih aplikasi dan klik tombol download. Untuk memutakhirkan informasi aplikasi klik tombol disebelah tombol bantuan." + IDS_NO_APPS "Maaf, belum ada aplikasi dalam kategori ini. Anda dapat membantu dan menambahkan aplikasi lebih banyak." + IDS_CHOOSE_APP "Silahkan pilih aplikasi." + IDS_CHOOSE_SUB "Silahkan pilih subkategori." + IDS_CHOOSE_CATEGORY "Silahkan pilih kategori." + IDS_CHOOSE_BOTH "Silahkan pilih subkategori atau aplikasi." + IDS_XMLERROR_1 "Tidak dapat menemukan file xml !" + IDS_XMLERROR_2 "Tidak dapat mengurai file xml !" + IDS_DOWNLOAD_ERROR "Tidak bisa mendownload file.\nSilahkan periksa koneksi internet anda." + IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip" + IDS_VERSION "Versi: " + IDS_LICENCE "Lisensi: " + IDS_MAINTAINER "Pemelihara: " +END diff --git a/rosapps/downloader/translations/it.rc b/rosapps/downloader/translations/it.rc new file mode 100644 index 00000000000..ade0ff46d10 --- /dev/null +++ b/rosapps/downloader/translations/it.rc @@ -0,0 +1,36 @@ +LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN + +IDD_DOWNLOAD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Download..." +FONT 8, "MS Shell Dlg" +{ + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12 + LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" + IDS_WELCOME_TITLE "Benvenuto al ReactOS Downloader" + IDS_WELCOME "Scegli una categoria a destra. Questa la versione 1.0." + IDS_NO_APP_TITLE "Nessuna applicazione selezionata" + IDS_NO_APP "Scegli una Applicazione prima di premere il bottone di download, se serve assistenza clicca sul punto di domanda nell'angolo in alto a destra." + IDS_UPDATE_TITLE "Aggiona" + IDS_UPDATE "Funzione non ancora implementata." + IDS_HELP_TITLE "Aiuto" + IDS_HELP "Scegli una categoria a destra, poi scegli una applicazione e clicca il bottone download. Per aggiornare le informazioni sulla applicazione clicca il bottone accanto a quello di aiuto." + IDS_NO_APPS "Non ci sono ancora applicazioni in questa categoria. Puoi aiutare aggiungendone altre." + IDS_CHOOSE_APP "Scegli una applicazione." + IDS_CHOOSE_SUB "Scegli una sottocategoria." + IDS_CHOOSE_CATEGORY "Scegli una categoria." + IDS_CHOOSE_BOTH "Scegli una sottocategoria o una applicazione." + IDS_XMLERROR_1 "File xml non trovato !" + IDS_XMLERROR_2 "Impossibile trattare il contenuto del file xml !" + IDS_DOWNLOAD_ERROR "Download del file impossibile.\nVerifica la connessione a Internet." + IDS_UNZIP_ERROR "7-Zip not found.\nPlease install 7-Zip" + IDS_VERSION "Version: " + IDS_LICENCE "Licence: " + IDS_MAINTAINER "Maintainer: " +END diff --git a/rosapps/downloader/xml.c b/rosapps/downloader/xml.c new file mode 100644 index 00000000000..b56ff71dc6c --- /dev/null +++ b/rosapps/downloader/xml.c @@ -0,0 +1,525 @@ +/* PROJECT: ReactOS Downloader + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base\applications\downloader\xml.c + * PURPOSE: Parsing of application information xml files + * PROGRAMMERS: Maarten Bosma, Lester Kortenhoeven + */ + +#include +#include +#include +#include +#include +#include +#include "structures.h" +#include "resources.h" + +BOOL TagOpen; +BOOL InstallScriptOpen; +BOOL UninstallScriptOpen; +struct Category* Current; +struct Application* CurrentApplication; +struct ScriptElement* CurrentScript; +char DML_Name[0x100]; +char DML_Target[0x100]; +char Path [0x100]; +char CurrentTag [0x100]; + +extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT]; +BOOL ImportXML (const char*); + +void ImportFolder (const char* folder) +{ + WCHAR buffer[0x100]; + char buffer2[0x100]; + struct _wfinddata_t Finddata; + DWORD Findhandle; + buffer[0]='\0'; + strcpy(buffer2, Path); + strncat(buffer2, folder, 0x100-strlen(buffer2)); + strncat(buffer2, "\\*.dml", 0x100-strlen(buffer2)); + MultiByteToWideChar(CP_UTF8, 0, buffer2, -1, buffer, 0x100); + if((Findhandle=_wfindfirst(buffer, &Finddata)) == -1) + return; + do { + buffer[0]='\0'; + MultiByteToWideChar(CP_UTF8, 0, folder, -1, buffer, 0x100); + wcsncat(buffer, L"\\", 0x100-wcslen(buffer)); + wcsncat(buffer, Finddata.name, 0x100-wcslen(buffer)); + WideCharToMultiByte(CP_UTF8, 0, buffer, -1, buffer2, 0x100, NULL, FALSE); + ImportXML(buffer2); + } while(_wfindnext(Findhandle, &Finddata)==0); + _findclose(Findhandle); +} + + +void Script_tag_opened (void* usrdata, const char* tag, const char** arg) +{ + int i; + if (!strcmp(tag, "script")) { + return; + } else if (InstallScriptOpen && (CurrentScript == NULL)) { + CurrentApplication->InstallScript = malloc(sizeof(struct ScriptElement)); + CurrentScript = CurrentApplication->InstallScript; + } else if (UninstallScriptOpen && (CurrentScript == NULL)) { + CurrentApplication->UninstallScript = malloc(sizeof(struct ScriptElement)); + CurrentScript = CurrentApplication->UninstallScript; + } else if (CurrentScript != NULL) { + CurrentScript->Next = malloc(sizeof(struct ScriptElement)); + CurrentScript = CurrentScript->Next; + } else { + return; + } + memset(CurrentScript, 0, sizeof(struct ScriptElement)); + if (!strcmp(tag, "download")) { + wcscpy(CurrentScript->Func, L"download"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "file")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[1], 0x100); + } else if(!strcmp(arg[i], "url")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } + } + } else if (!strcmp(tag, "exec")) { + wcscpy(CurrentScript->Func, L"exec"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "file")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } + } + } else if (!strcmp(tag, "del")) { + wcscpy(CurrentScript->Func, L"del"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "file")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } + } + } else if (!strcmp(tag, "unzip")) { + wcscpy(CurrentScript->Func, L"unzip"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "file")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } else if(!strcmp(arg[i], "outdir")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[1], 0x100); + } + } + } else if (!strcmp(tag, "adduninstaller")) { + wcscpy(CurrentScript->Func, L"adduninstaller"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "regname")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } else if(!strcmp(arg[i], "file")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[1], 0x100); + } + } + } else if (!strcmp(tag, "removeuninstaller")) { + wcscpy(CurrentScript->Func, L"removeuninstaller"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "regname")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } + } + } else if (!strcmp(tag, "message")) { + wcscpy(CurrentScript->Func, L"message"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "text")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } + } + } else if (!strcmp(tag, "load")) { + wcscpy(CurrentScript->Func, L"load"); + for (i=0; arg[i]; i+=2) { + if(!strcmp(arg[i], "file")) { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentScript->Arg[0], 0x100); + } + } + } else + MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); +} + + +void tag_opened (void* usrdata, const char* tag, const char** arg) +{ + int i; + + if(!strcmp(tag, "import")) + { + for (i=0; arg[i]; i+=2) + { + if(!strcmp(arg[i], "file")) + { + ImportXML(arg[i+1]); + } + else if(!strcmp(arg[i], "folder")) + { + ImportFolder(arg[i+1]); + } + } + } + else if(!strcmp(tag, "tree") && !CurrentApplication) + { + // check version + } + + else if(!strcmp(tag, "category") && !CurrentApplication) + { + if (!Current) + { + Current = malloc(sizeof(struct Category)); + memset(Current, 0, sizeof(struct Category)); + } + else if (TagOpen) + { + Current->Children = malloc(sizeof(struct Category)); + memset(Current->Children, 0, sizeof(struct Category)); + Current->Children->Parent = Current; + Current = Current->Children; + } + else + { + Current->Next = malloc(sizeof(struct Category)); + memset(Current->Next, 0, sizeof(struct Category)); + Current->Next->Parent = Current->Parent; + Current = Current->Next; + } + TagOpen = TRUE; + + for (i=0; arg[i]; i+=2) + { + if(!strcmp(arg[i], "name")) + { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, Current->Name, 0x100); + } + if(!strcmp(arg[i], "icon")) + { + Current->Icon = atoi(arg[i+1]); + } + } + } + + else if(!strcmp(tag, "application") && !CurrentApplication) + { + if(Current->Apps) + { + CurrentApplication = Current->Apps; + while(CurrentApplication->Next) + CurrentApplication = CurrentApplication->Next; + CurrentApplication->Next = malloc(sizeof(struct Application)); + memset(CurrentApplication->Next, 0, sizeof(struct Application)); + CurrentApplication = CurrentApplication->Next; + } + else + { + Current->Apps = malloc(sizeof(struct Application)); + memset(Current->Apps, 0, sizeof(struct Application)); + CurrentApplication = Current->Apps; + } + + for (i=0; arg[i]; i+=2) + { + if(!strcmp(arg[i], "name")) + { + MultiByteToWideChar(CP_UTF8, 0, arg[i+1], -1, CurrentApplication->Name, 0x100); + } + } + } + else if (CurrentApplication) + { + if (!strcmp(tag, "installscript")) { + InstallScriptOpen = TRUE; + } else if (!strcmp(tag, "uninstallscript")) { + UninstallScriptOpen = TRUE; + } else { + Script_tag_opened(usrdata, tag, arg); + if (CurrentScript == NULL) { + strncpy(CurrentTag, tag, 0x100); + } + } + } + else + MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); +} + + +void text (void* usrdata, const char* data, int len) +{ + if (!CurrentApplication) + return; + + if(!strcmp(CurrentTag, "maintainer")) + { + int currentlengt = lstrlenW(CurrentApplication->Maintainer); + MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Maintainer[currentlengt], 0x100-currentlengt); + } + else if(!strcmp(CurrentTag, "regname")) + { + int currentlengt = lstrlenW(CurrentApplication->RegName); + MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->RegName[currentlengt], 0x100-currentlengt); + } + else if(!strcmp(CurrentTag, "description")) + { + int currentlengt = lstrlenW(CurrentApplication->Description); + MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Description[currentlengt], 0x400-currentlengt); + } + else if(!strcmp(CurrentTag, "location")) + { + int currentlengt = lstrlenW(CurrentApplication->Location); + MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Location[currentlengt], 0x100-currentlengt); + } + else if(!strcmp(CurrentTag, "version")) + { + int currentlengt = lstrlenW(CurrentApplication->Version); + MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Version[currentlengt], 0x400-currentlengt); + } + else if(!strcmp(CurrentTag, "licence")) + { + int currentlengt = lstrlenW(CurrentApplication->Licence); + MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Licence[currentlengt], 0x100-currentlengt); + } +} + +void tag_closed (void* tree, const char* tag) +{ + CurrentTag[0] = 0; + + if(!strcmp(tag, "category")) + { + if (TagOpen) + { + TagOpen = FALSE; + } + else + { + Current = Current->Parent; + } + } + else if(!strcmp(tag, "application")) + { + CurrentApplication = NULL; + } + else if(!strcmp(tag, "installscript") || !strcmp(tag, "uninstallscript")) + { + CurrentScript = NULL; + InstallScriptOpen = FALSE; + UninstallScriptOpen = FALSE; + } +} + +BOOL ImportXML (const char* filename) +{ + int done = 0; + char buffer[0x100]; + FILE* file; + XML_Parser parser; + strcpy(buffer, Path); + strncat(buffer, filename, 0x100-strlen(buffer)); + file = fopen(buffer, "r"); + if(!file) + { + MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0); + return FALSE; + } + + parser = XML_ParserCreate(NULL); + XML_SetElementHandler(parser, tag_opened, tag_closed); + XML_SetCharacterDataHandler(parser, text); + + while (!done) + { + size_t len = fread (buffer, 1, sizeof(buffer), file); + done = len < sizeof(buffer); + + buffer[len] = 0; + if(!XML_Parse(parser, buffer, len, done)) + { + MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); + return FALSE; + } + } + + XML_ParserFree(parser); + fclose(file); + + return TRUE; +} + +BOOL ProcessXML (const char* filename, struct Category* Root) +{ + FILE* file; + file = fopen(filename, "r"); + if(file) + { + Path[0]='\0'; + fclose(file); + } + else + { + strncpy(Path, getenv("SystemRoot"), 0x100-13); + strcat(Path, "\\packagetree\\"); + } + + if(Current) + return FALSE; + + Current = Root; + CurrentApplication = NULL; + CurrentScript = NULL; + TagOpen = TRUE; + InstallScriptOpen = FALSE; + UninstallScriptOpen = FALSE; + + return ImportXML(filename); +} + +void DML_tag_opened (void* usrdata, const char* tag, const char** arg) +{ + int i; + + if(!strcmp(tag, "application")) + { + for (i=0; arg[i]; i+=2) + { + if(!strcmp(arg[i], "name")) + { + strncpy(DML_Name, arg[i+1], 0x100); + } + else if(!strcmp(arg[i], "target")) + { + strncpy(DML_Target, arg[i+1], 0x100); + } + } + } +} + +void NOP_text (void* usrdata, const char* data, int len) +{ +} + +void NOP_tag_closed (void* tree, const char* tag) +{ +} + +char* addDML (const char* filename) +{ + int done = 0; + char buffer[0x100]; + FILE* file; + XML_Parser parser; + DML_Target[0] = '\0'; + file = fopen(filename, "r"); + if(!file) + { + MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0); + return NULL; + } + + parser = XML_ParserCreate(NULL); + XML_SetElementHandler(parser, DML_tag_opened, NOP_tag_closed); + XML_SetCharacterDataHandler(parser, NOP_text); + + while (!done) + { + size_t len = fread (buffer, 1, sizeof(buffer), file); + done = len < sizeof(buffer); + + buffer[len] = 0; + if(!XML_Parse(parser, buffer, len, done)) + { + MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); + return NULL; + } + } + + XML_ParserFree(parser); + fclose(file); + + if(DML_Target[0]=='\0') + { + MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); + return NULL; + } + + strcpy(buffer, getenv("SystemRoot")); + strncat(buffer, "\\packagetree\\", 0x100-strlen(buffer)); + strncat(buffer, DML_Target, 0x100-strlen(buffer)); + + CopyFileA(filename, buffer, FALSE); + return DML_Name; +} + +void LoadScriptFunc(WCHAR* filenameW, struct ScriptElement* Script) +{ + int done = 0; + char buffer[0x100]; + char filenameA[0x100]; + FILE* file; + XML_Parser parser; + struct ScriptElement* NextElement = Script->Next; + wcscpy(Script->Func,L"NOP"); + CurrentScript = Script; + WideCharToMultiByte(CP_UTF8, 0, filenameW, -1, filenameA, 0x100, NULL, FALSE); + strcpy(buffer, Path); + strncat(buffer, filenameA, 0x100-strlen(buffer)); + file = fopen(buffer, "r"); + if(!file) + { + MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0); + return; + } + + parser = XML_ParserCreate(NULL); + XML_SetElementHandler(parser, Script_tag_opened, NOP_tag_closed); + XML_SetCharacterDataHandler(parser, NOP_text); + + while (!done) + { + size_t len = fread (buffer, 1, sizeof(buffer), file); + done = len < sizeof(buffer); + + buffer[len] = 0; + if(!XML_Parse(parser, buffer, len, done)) + { + MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); + CurrentScript->Next = NextElement; + return; + } + } + + XML_ParserFree(parser); + fclose(file); + CurrentScript->Next = NextElement; + return; +} + +void FreeScript (struct ScriptElement* Script) +{ + if (Script->Next != NULL) + FreeScript(Script->Next); + free(Script); +} + +void FreeApps (struct Application* Apps) +{ + if (Apps->Next) + FreeApps(Apps->Next); + if (Apps->InstallScript) + FreeScript(Apps->InstallScript); + if (Apps->UninstallScript) + FreeScript(Apps->UninstallScript); + + free(Apps); +} + +void FreeTree (struct Category* Node) +{ + if (Node->Children) + FreeTree(Node->Children); + + if (Node->Next) + FreeTree(Node->Next); + + if (Node->Apps) + FreeApps(Node->Apps); + + free(Node); +} diff --git a/rosapps/ext2/attr.c b/rosapps/ext2/attr.c new file mode 100644 index 00000000000..37e011ad124 --- /dev/null +++ b/rosapps/ext2/attr.c @@ -0,0 +1,136 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/attr.c + * PURPOSE: Set/Get file attributes support + * PROGRAMMER: David Welch (welch@cwcom.net) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +Ext2SetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("Ext2SetInformation(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, + IO_NO_INCREMENT); + + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + NTSTATUS Status; + PIO_STACK_LOCATION Param; + PFILE_OBJECT FileObject; + PDEVICE_EXTENSION DeviceExt; + ULONG Length; + PFILE_BASIC_INFORMATION PFileBasicInformation; + PFILE_STANDARD_INFORMATION PFileStandardInformation; + PFILE_INTERNAL_INFORMATION PFileInternalInformation; + PFILE_EA_INFORMATION PFileEaInformation; + PFILE_ACCESS_INFORMATION PFileAccessInformation; + PFILE_NAME_INFORMATION PFileNameInformation; + PFILE_POSITION_INFORMATION PFilePositionInformation; + PVOID Buffer; + + DPRINT("Ext2QueryInformation(DeviceObject %x Irp %x)\n", DeviceObject, Irp); + + Param = IoGetCurrentIrpStackLocation(Irp); + FileObject = Param->FileObject; + DeviceExt = DeviceObject->DeviceExtension; + Length = Param->Parameters.QueryFile.Length; + Buffer = Irp->AssociatedIrp.SystemBuffer; + + switch (Param->Parameters.QueryFile.FileInformationClass) + { + case FileDirectoryInformation: + case FileFullDirectoryInformation: + case FileBothDirectoryInformation: + Status = STATUS_NOT_IMPLEMENTED; + break; + + case FileBasicInformation: + PFileBasicInformation = (PFILE_BASIC_INFORMATION)Buffer; + memset(PFileBasicInformation, 0, sizeof(FILE_BASIC_INFORMATION)); + Status = STATUS_SUCCESS; + break; + + case FileStandardInformation: + PFileStandardInformation = (PFILE_STANDARD_INFORMATION)Buffer; + memset(PFileStandardInformation, 0, sizeof(FILE_STANDARD_INFORMATION)); + Status = STATUS_SUCCESS; + break; + + case FileInternalInformation: + PFileInternalInformation = (PFILE_INTERNAL_INFORMATION)Buffer; + memset(PFileInternalInformation, 0, sizeof(FILE_INTERNAL_INFORMATION)); + Status = STATUS_SUCCESS; + break; + + case FileEaInformation: + PFileEaInformation = (PFILE_EA_INFORMATION)Buffer; + memset(PFileEaInformation, 0, sizeof(FILE_EA_INFORMATION)); + PFileEaInformation->EaSize = 0; + Status = STATUS_SUCCESS; + break; + + case FileAccessInformation: + PFileAccessInformation = (PFILE_ACCESS_INFORMATION)Buffer; + memset(PFileAccessInformation, 0, sizeof(FILE_ACCESS_INFORMATION)); + PFileAccessInformation->AccessFlags = 0; + Status = STATUS_SUCCESS; + break; + + case FileNameInformation: + PFileNameInformation = (PFILE_NAME_INFORMATION)Buffer; + memset(PFileNameInformation, 0, sizeof(FILE_NAME_INFORMATION)); + Status = STATUS_SUCCESS; + break; + + case FilePositionInformation: + PFilePositionInformation = (PFILE_POSITION_INFORMATION)Buffer; + memcpy(PFilePositionInformation, + &FileObject->CurrentByteOffset, + sizeof(FileObject->CurrentByteOffset)); + Status = STATUS_SUCCESS; + break; + + case FileRenameInformation: + Status = STATUS_NOT_IMPLEMENTED; + break; + + default: + Status = STATUS_NOT_SUPPORTED; + } + + + + + Irp->IoStatus.Status = Status; + if (NT_SUCCESS(Status)) + Irp->IoStatus.Information = + Param->Parameters.QueryFile.Length - Length; + else + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, + IO_NO_INCREMENT); + + return(Status); +} diff --git a/rosapps/ext2/blockdev.c b/rosapps/ext2/blockdev.c new file mode 100644 index 00000000000..6792b98efcd --- /dev/null +++ b/rosapps/ext2/blockdev.c @@ -0,0 +1,155 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/blockdev.c + * PURPOSE: Temporary sector reading support + * PROGRAMMER: David Welch (welch@cwcom.net) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS ***************************************************************/ + +BOOLEAN +Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN ULONG SectorCount, + IN PVOID Buffer) +{ + LARGE_INTEGER sectorNumber; + PIRP irp; + IO_STATUS_BLOCK ioStatus; + KEVENT event; + NTSTATUS status; + ULONG sectorSize; + int j; + + DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); + + sectorNumber.u.HighPart = 0; + sectorNumber.u.LowPart = DiskSector * BLOCKSIZE; + + DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n", + (unsigned long) DiskSector, + (unsigned long) BLOCKSIZE, + (unsigned long) sectorNumber.u.HighPart, + (unsigned long) sectorNumber.u.LowPart); + + KeInitializeEvent(&event, NotificationEvent, FALSE); + + sectorSize = BLOCKSIZE*SectorCount; + + + DPRINT("Building synchronous FSD Request...\n"); + irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, + pDeviceObject, + Buffer, + sectorSize, + §orNumber, + &event, + &ioStatus ); + + if (!irp) + { + DbgPrint("READ failed!!!\n"); + return FALSE; + } + + DPRINT("Calling IO Driver...\n"); + status = IoCallDriver(pDeviceObject, irp); + + DPRINT("Waiting for IO Operation...\n"); + if (status == STATUS_PENDING) + { + KeWaitForSingleObject(&event, + Suspended, + KernelMode, + FALSE, + NULL); + DPRINT("Getting IO Status...\n"); + status = ioStatus.Status; + } + + if (!NT_SUCCESS(status)) + { + DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status); + return FALSE; + } + + return TRUE; +} + +BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN ULONG SectorCount, + IN UCHAR* Buffer) +{ + LARGE_INTEGER sectorNumber; + PIRP irp; + IO_STATUS_BLOCK ioStatus; + KEVENT event; + NTSTATUS status; + ULONG sectorSize; + PULONG mbr; + int j; + + DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); + + sectorNumber.u.HighPart = 0; + sectorNumber.u.LowPart = DiskSector * BLOCKSIZE; + + KeInitializeEvent(&event, NotificationEvent, FALSE); + + sectorSize = BLOCKSIZE*SectorCount; + + + DPRINT("Building synchronous FSD Request...\n"); + irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE, + pDeviceObject, + Buffer, + sectorSize, + §orNumber, + &event, + &ioStatus ); + + if (!irp) { + DbgPrint("WRITE failed!!!\n"); + return FALSE; + } + + DPRINT("Calling IO Driver...\n"); + status = IoCallDriver(pDeviceObject, + irp); + + DPRINT("Waiting for IO Operation...\n"); + if (status == STATUS_PENDING) { + KeWaitForSingleObject(&event, + Suspended, + KernelMode, + FALSE, + NULL); + DPRINT("Getting IO Status...\n"); + status = ioStatus.Status; + } + + if (!NT_SUCCESS(status)) { + DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status); + return FALSE; + } + + + ExFreePool(mbr); + DPRINT("Block request succeeded\n"); + return TRUE; +} + diff --git a/rosapps/ext2/dir.c b/rosapps/ext2/dir.c new file mode 100644 index 00000000000..6bfb8ae23c9 --- /dev/null +++ b/rosapps/ext2/dir.c @@ -0,0 +1,338 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/dir.c + * PURPOSE: ext2 filesystem + * PROGRAMMER: David Welch (welch@cwcom.net) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS *****************************************************************/ + + +static VOID Ext2ConvertName(PWSTR Out, PCH In, ULONG Len) +{ + ULONG i; + + for (i=0; iinode, + &inode); + + switch (IoStack->Parameters.QueryDirectory.FileInformationClass) + { + case FileNamesInformation: + FNI = (PFILE_NAMES_INFORMATION)Buffer; + FNI->NextEntryOffset = sizeof(FileDirectoryInformation) + + dir_entry->name_len + 1; + FNI->FileNameLength = dir_entry->name_len; + Ext2ConvertName(FNI->FileName, dir_entry->name, dir_entry->name_len); + Buffer = Buffer + FNI->NextEntryOffset; + break; + + case FileDirectoryInformation: + FDI = (PFILE_DIRECTORY_INFORMATION)Buffer; + FDI->NextEntryOffset = sizeof(FileDirectoryInformation) + + dir_entry->name_len + 1; + FDI->FileIndex = FileIndex; +// FDI->CreationTime = 0; +// FDI->LastAccessTime = 0; +// FDI->LastWriteTime = 0; +// FDI->ChangeTime = 0; + FDI->AllocationSize.QuadPart = FDI->EndOfFile.QuadPart = inode.i_size; + FDI->FileAttributes = 0; + FDI->FileNameLength = dir_entry->name_len; + Ext2ConvertName(FDI->FileName, dir_entry->name, dir_entry->name_len); + Buffer = Buffer + FDI->NextEntryOffset; + break; + + case FileBothDirectoryInformation: + FBI = (PFILE_BOTH_DIRECTORY_INFORMATION)Buffer; + FBI->NextEntryOffset = sizeof(FileBothDirectoryInformation) + + dir_entry->name_len + 1; + FBI->FileIndex = FileIndex; + FBI->AllocationSize.QuadPart = FBI->EndOfFile.QuadPart = inode.i_size; + FBI->FileAttributes = 0; + FBI->FileNameLength = dir_entry->name_len; + Ext2ConvertName(FBI->FileName, dir_entry->name, dir_entry->name_len); + memset(FBI->ShortName, 0, sizeof(FBI->ShortName)); + Buffer = Buffer + FBI->NextEntryOffset; + break; + + default: + UNIMPLEMENTED; + } + return(Buffer); +} + + +NTSTATUS Ext2QueryDirectory(PDEVICE_EXTENSION DeviceExt, + PEXT2_FCB Fcb, + PIRP Irp, + PIO_STACK_LOCATION IoStack) +{ + ULONG Max; + ULONG i; + ULONG StartIndex; + PVOID Buffer = NULL; + struct ext2_dir_entry dir_entry; + + Buffer = Irp->UserBuffer; + DPRINT("Buffer %x\n",Buffer); + DPRINT("IoStack->Flags %x\n",IoStack->Flags); + + if (IoStack->Flags & SL_RETURN_SINGLE_ENTRY) + { + Max = 1; + } + else + { + UNIMPLEMENTED; + } + + DPRINT("Buffer->FileIndex %d\n", + ((PFILE_DIRECTORY_INFORMATION)Buffer)->FileIndex); + if (IoStack->Flags & SL_INDEX_SPECIFIED) + { + StartIndex = ((PFILE_DIRECTORY_INFORMATION)Buffer)->FileIndex; + } + else + { + StartIndex = 0; + } + + if (IoStack->Flags & SL_RESTART_SCAN) + { + StartIndex = 0; + } + + DPRINT("StartIndex %d\n",StartIndex); + + for (i=0; iinode,"*",&dir_entry,&StartIndex)) + { + ((PFILE_DIRECTORY_INFORMATION)Buffer)->NextEntryOffset = 0; + return(STATUS_NO_MORE_FILES); + } + Buffer = Ext2ProcessDirEntry(DeviceExt, + &dir_entry, + IoStack, + Buffer, + StartIndex); + } + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +Ext2DirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + PEXT2_FCB Fcb = (PVOID)FileObject->FsContext; + NTSTATUS Status; + PDEVICE_EXTENSION DeviceExt; + + DPRINT("Ext2DirectoryControl(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); + + DeviceExt = DeviceObject->DeviceExtension; + + switch (Stack->MinorFunction) + { + case IRP_MN_QUERY_DIRECTORY: + Status = Ext2QueryDirectory(DeviceExt, Fcb, Irp, Stack); + break; + + default: + Status = STATUS_UNSUCCESSFUL; + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + +BOOL Ext2ScanDir(PDEVICE_EXTENSION DeviceExt, + struct ext2_inode* dir, + PCH filename, + struct ext2_dir_entry* ret, + PULONG StartIndex) +{ + ULONG i; + char* buffer; + ULONG offset; + char name[255]; + struct ext2_dir_entry* current; + ULONG block; + BOOL b; + + DPRINT("Ext2ScanDir(dir %x, filename %s, ret %x)\n",dir,filename,ret); + + buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE); + + for (i=0; i<((*StartIndex)/BLOCKSIZE); i++); + for (; (block = Ext2BlockMap(DeviceExt, dir, i)) != 0; i++) + { + DPRINT("block %d\n",block); + b = Ext2ReadSectors(DeviceExt->StorageDevice, + block, + 1, + buffer); + if (!b) + { + DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__, __LINE__); + return(FALSE); + } + + offset = (*StartIndex)%BLOCKSIZE; + while (offset < BLOCKSIZE) + { + current = &buffer[offset]; + + strncpy(name,current->name,current->name_len); + name[current->name_len]=0; + + DPRINT("Scanning offset %d inode %d name %s\n", + offset,current->inode,name); + + DPRINT("Comparing %s %s\n",name,filename); + if (strcmp(name,filename)==0 || strcmp(filename,"*")==0) + { + DPRINT("Match found\n"); + *StartIndex = (i*BLOCKSIZE) + offset + current->rec_len; + memcpy(ret,current,sizeof(struct ext2_dir_entry)); + ExFreePool(buffer); + return(TRUE); + } + + offset = offset + current->rec_len; + ASSERT(current->rec_len != 0); + DPRINT("offset %d\n",offset); + } + DPRINT("Onto next block\n"); + } + DPRINT("No match\n"); + ExFreePool(buffer); + return(FALSE); +} + +void unicode_to_ansi(PCH StringA, PWSTR StringW) +{ + while((*StringW)!=0) + { + *StringA = *StringW; + StringA++; + StringW++; + } + *StringA = 0; +} + +NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, + PWSTR FileName) +/* + * FUNCTION: Opens a file + */ +{ + EXT2_INODE parent_inode; + struct ext2_dir_entry entry; + char name[255]; + ULONG current_inode = 2; + char* current_segment; + PEXT2_FCB Fcb; + ULONG StartIndex = 0; + + DPRINT("Ext2OpenFile(DeviceExt %x, FileObject %x, FileName %S)\n", + DeviceExt,FileObject,FileName); + + Fcb = ExAllocatePool(NonPagedPool, sizeof(EXT2_FCB)); + + unicode_to_ansi(name,FileName); + DPRINT("name %s\n",name); + DPRINT("strtok %x\n",strtok); + current_segment = strtok(name,"\\"); + DPRINT("current_segment %x\n", current_segment); + while (current_segment!=NULL) + { + Ext2LoadInode(DeviceExt, + current_inode, + &parent_inode); + if (!Ext2ScanDir(DeviceExt, + parent_inode.inode, + current_segment, + &entry, + &StartIndex)) + { + Ext2ReleaseInode(DeviceExt, + &parent_inode); + ExFreePool(Fcb); + return(STATUS_UNSUCCESSFUL); + } + current_inode = entry.inode; + current_segment = strtok(NULL,"\\"); + StartIndex = 0; + Ext2ReleaseInode(DeviceExt, + &parent_inode); + } + DPRINT("Found file\n"); + + Fcb->inode = current_inode; + CcRosInitializeFileCache(FileObject, &Fcb->Bcb, PAGE_SIZE*3); + FileObject->FsContext = Fcb; + + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +Ext2Create(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + NTSTATUS Status; + PDEVICE_EXTENSION DeviceExt; + + DPRINT("Ext2Create(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); + + DeviceExt = DeviceObject->DeviceExtension; + Status = Ext2OpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} diff --git a/rosapps/ext2/ext2fs.h b/rosapps/ext2/ext2fs.h new file mode 100644 index 00000000000..1dfd8fd0b54 --- /dev/null +++ b/rosapps/ext2/ext2fs.h @@ -0,0 +1,289 @@ +#include +#include + +BOOLEAN Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN ULONG SectorCount, + IN PVOID Buffer); + +#define BLOCKSIZE (1024) + +struct ext2_super_block { + ULONG s_inodes_count; /* Inodes count */ + ULONG s_blocks_count; /* Blocks count */ + ULONG s_r_blocks_count; /* Reserved blocks count */ + ULONG s_free_blocks_count; /* Free blocks count */ + ULONG s_free_inodes_count; /* Free inodes count */ + ULONG s_first_data_block; /* First Data Block */ + ULONG s_log_block_size; /* Block size */ + LONG s_log_frag_size; /* Fragment size */ + ULONG s_blocks_per_group; /* # Blocks per group */ + ULONG s_frags_per_group; /* # Fragments per group */ + ULONG s_inodes_per_group; /* # Inodes per group */ + ULONG s_mtime; /* Mount time */ + ULONG s_wtime; /* Write time */ + USHORT s_mnt_count; /* Mount count */ + SHORT s_max_mnt_count; /* Maximal mount count */ + USHORT s_magic; /* Magic signature */ + USHORT s_state; /* File system state */ + USHORT s_errors; /* Behaviour when detecting errors */ + USHORT s_minor_rev_level; /* minor revision level */ + ULONG s_lastcheck; /* time of last check */ + ULONG s_checkinterval; /* max. time between checks */ + ULONG s_creator_os; /* OS */ + ULONG s_rev_level; /* Revision level */ + USHORT s_def_resuid; /* Default uid for reserved blocks */ + USHORT s_def_resgid; /* Default gid for reserved blocks */ + /* + * These fields are for EXT2_DYNAMIC_REV superblocks only. + * + * Note: the difference between the compatible feature set and + * the incompatible feature set is that if there is a bit set + * in the incompatible feature set that the kernel doesn't + * know about, it should refuse to mount the filesystem. + * + * e2fsck's requirements are more strict; if it doesn't know + * about a feature in either the compatible or incompatible + * feature set, it must abort and not try to meddle with + * things it doesn't understand... + */ + ULONG s_first_ino; /* First non-reserved inode */ + USHORT s_inode_size; /* size of inode structure */ + USHORT s_block_group_nr; /* block group # of this superblock */ + ULONG s_feature_compat; /* compatible feature set */ + ULONG s_feature_incompat; /* incompatible feature set */ + ULONG s_feature_ro_compat; /* readonly-compatible feature set */ + ULONG s_reserved[230]; /* Padding to the end of the block */ +}; + +/* + * Codes for operating systems + */ +#define EXT2_OS_LINUX 0 +#define EXT2_OS_HURD 1 +#define EXT2_OS_MASIX 2 +#define EXT2_OS_FREEBSD 3 +#define EXT2_OS_LITES 4 + +/* + * Revision levels + */ +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ + +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV + +/* + * The second extended file system magic number + */ +#define EXT2_SUPER_MAGIC 0xEF53 + +/* + * Constants relative to the data blocks + */ +#define EXT2_NDIR_BLOCKS 12 +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) + + +/* + * Structure of an inode on the disk + */ +struct ext2_inode { + USHORT i_mode; /* File mode */ + USHORT i_uid; /* Owner Uid */ + ULONG i_size; /* Size in bytes */ + ULONG i_atime; /* Access time */ + ULONG i_ctime; /* Creation time */ + ULONG i_mtime; /* Modification time */ + ULONG i_dtime; /* Deletion Time */ + USHORT i_gid; /* Group Id */ + USHORT i_links_count; /* Links count */ + ULONG i_blocks; /* Blocks count */ + ULONG i_flags; /* File flags */ + union { + struct { + ULONG l_i_reserved1; + } linux1; + struct { + ULONG h_i_translator; + } hurd1; + struct { + ULONG m_i_reserved1; + } masix1; + } osd1; /* OS dependent 1 */ + ULONG i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ + ULONG i_version; /* File version (for NFS) */ + ULONG i_file_acl; /* File ACL */ + ULONG i_dir_acl; /* Directory ACL */ + ULONG i_faddr; /* Fragment address */ + union { + struct { + UCHAR l_i_frag; /* Fragment number */ + UCHAR l_i_fsize; /* Fragment size */ + USHORT i_pad1; + ULONG l_i_reserved2[2]; + } linux2; + struct { + UCHAR h_i_frag; /* Fragment number */ + UCHAR h_i_fsize; /* Fragment size */ + USHORT h_i_mode_high; + USHORT h_i_uid_high; + USHORT h_i_gid_high; + ULONG h_i_author; + } hurd2; + struct { + UCHAR m_i_frag; /* Fragment number */ + UCHAR m_i_fsize; /* Fragment size */ + USHORT m_pad1; + ULONG m_i_reserved2[2]; + } masix2; + } osd2; /* OS dependent 2 */ +}; + +#if defined(__KERNEL__) || defined(__linux__) +#define i_reserved1 osd1.linux1.l_i_reserved1 +#define i_frag osd2.linux2.l_i_frag +#define i_fsize osd2.linux2.l_i_fsize +#define i_reserved2 osd2.linux2.l_i_reserved2 +#endif + +#ifdef __hurd__ +#define i_translator osd1.hurd1.h_i_translator +#define i_frag osd2.hurd2.h_i_frag; +#define i_fsize osd2.hurd2.h_i_fsize; +#define i_uid_high osd2.hurd2.h_i_uid_high +#define i_gid_high osd2.hurd2.h_i_gid_high +#define i_author osd2.hurd2.h_i_author +#endif + +#ifdef __masix__ +#define i_reserved1 osd1.masix1.m_i_reserved1 +#define i_frag osd2.masix2.m_i_frag +#define i_fsize osd2.masix2.m_i_fsize +#define i_reserved2 osd2.masix2.m_i_reserved2 +#endif + +/* + * Constants relative to the data blocks + */ +#define EXT2_NDIR_BLOCKS 12 +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) + +/* + * Inode flags + */ +#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */ +#define EXT2_UNRM_FL 0x00000002 /* Undelete */ +#define EXT2_COMPR_FL 0x00000004 /* Compress file */ +#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */ +#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ +#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ +#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ +#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ + + +/* + * Structure of a blocks group descriptor + */ +struct ext2_group_desc +{ + ULONG bg_block_bitmap; /* Blocks bitmap block */ + ULONG bg_inode_bitmap; /* Inodes bitmap block */ + ULONG bg_inode_table; /* Inodes table block */ + USHORT bg_free_blocks_count; /* Free blocks count */ + USHORT bg_free_inodes_count; /* Free inodes count */ + USHORT bg_used_dirs_count; /* Directories count */ + USHORT bg_pad; + ULONG bg_reserved[3]; +}; + +#define EXT2_NAME_LEN 255 + +struct ext2_dir_entry { + ULONG inode; /* Inode number */ + USHORT rec_len; /* Directory entry length */ + USHORT name_len; /* Name length */ + char name[EXT2_NAME_LEN]; /* File name */ +}; + +typedef struct +{ + PDEVICE_OBJECT StorageDevice; + struct ext2_super_block* superblock; + PFILE_OBJECT FileObject; + PBCB Bcb; +} DEVICE_EXTENSION, *PDEVICE_EXTENSION; + +typedef struct _EXT2_GROUP_DESC +{ + ERESOURCE Lock; + struct ext2_group_desc* desc; + PCACHE_SEGMENT CacheSeg; + PVOID BaseAddress; +} EXT2_GROUP_DESC, *PEXT2_GROUP_DESC; + +PEXT2_GROUP_DESC Ext2LoadGroup(PDEVICE_EXTENSION DeviceExt, + ULONG BlockGrp); +VOID Ext2ReleaseGroup(PDEVICE_EXTENSION DeviceExt, + PEXT2_GROUP_DESC GrpDesc); + +VOID Ext2ReadInode(PDEVICE_EXTENSION DeviceExt, + ULONG ino, + struct ext2_inode* inode); +struct ext2_group_desc* Ext2LoadGroupDesc(PDEVICE_EXTENSION DeviceExt, + ULONG block_group); + +typedef struct _EXT2_INODE +{ + struct ext2_inode* inode; + PVOID BaseAddress; + PCACHE_SEGMENT CacheSeg; +} EXT2_INODE, *PEXT2_INODE; + +typedef struct _EXT2_FCB +{ + ULONG inode; + EXT2_INODE i; + PBCB Bcb; +} EXT2_FCB, *PEXT2_FCB; + +ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt, + struct ext2_inode* inode, + ULONG offset); +NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, + PWSTR FileName); +NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject, + PVOID Buffer, + ULONG Length, + LARGE_INTEGER Offset); +NTSTATUS STDCALL Ext2Create(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2DirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2QueryQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2SetQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2SetSecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2QuerySecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2SetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2Read(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2Write(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2Cleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2FlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL Ext2Shutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS Ext2ReadPage(PDEVICE_EXTENSION DeviceExt, + PEXT2_FCB Fcb, + PVOID Buffer, + ULONG Offset); +VOID Ext2LoadInode(PDEVICE_EXTENSION DeviceExt, + ULONG ino, + PEXT2_INODE Inode); +VOID Ext2ReleaseInode(PDEVICE_EXTENSION DeviceExt, + PEXT2_INODE Inode); + diff --git a/rosapps/ext2/ext2fs.rc b/rosapps/ext2/ext2fs.rc new file mode 100644 index 00000000000..a2e25039fd4 --- /dev/null +++ b/rosapps/ext2/ext2fs.rc @@ -0,0 +1,7 @@ +/* $Id$ */ + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Linux ext2 IFS Driver\0" +#define REACTOS_STR_INTERNAL_NAME "ext2fs\0" +#define REACTOS_STR_ORIGINAL_FILENAME "ext2fs.sys\0" +#include diff --git a/rosapps/ext2/file.c b/rosapps/ext2/file.c new file mode 100644 index 00000000000..a627974254f --- /dev/null +++ b/rosapps/ext2/file.c @@ -0,0 +1,61 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/super.c + * PURPOSE: ext2 filesystem + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include + +#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS ****************************************************************/ + +#define addr_per_block (BLOCKSIZE / sizeof(ULONG)) + +ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt, + struct ext2_inode* inode, + ULONG offset) +{ + ULONG block; + PULONG TempBuffer; + BOOL b; + + DPRINT("Ext2BlockMap(DeviceExt %x, inode %x, offset %d)\n", + DeviceExt,inode,offset); + if (offset < EXT2_NDIR_BLOCKS) + { + block = inode->i_block[offset]; + DPRINT("block %d\n",block); + return(block); + } + offset = offset - EXT2_NDIR_BLOCKS; + if (offset < addr_per_block) + { + block = inode->i_block[EXT2_IND_BLOCK]; + TempBuffer = ExAllocatePool(NonPagedPool, BLOCKSIZE); + b = Ext2ReadSectors(DeviceExt->StorageDevice, + block, + 1, + TempBuffer); + if (!b) + { + DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__, __LINE__); + return(0); + } + block = TempBuffer[offset]; + ExFreePool(TempBuffer); + return(block); + } + offset = offset - addr_per_block; + DbgPrint("Failed at %s:%d\n",__FILE__,__LINE__); + for(;;); +} + diff --git a/rosapps/ext2/inode.c b/rosapps/ext2/inode.c new file mode 100644 index 00000000000..c05ff5176c5 --- /dev/null +++ b/rosapps/ext2/inode.c @@ -0,0 +1,148 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/inode.c + * PURPOSE: Manipulating inodes + * PROGRAMMER: David Welch (welch@cwcom.net) + * UPDATE HISTORY: + * 26/12/98: Created + */ + +/* INCLUDES ****************************************************************/ + +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS ***************************************************************/ + +struct ext2_group_desc* Ext2LoadGroupDesc(PDEVICE_EXTENSION DeviceExt, + ULONG block_group) +{ + struct ext2_group_desc* buffer; + ULONG block; + struct ext2_group_desc* gdp; + + buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE); + + block = block_group / (BLOCKSIZE / sizeof(struct ext2_group_desc)); + + Ext2ReadSectors(DeviceExt->StorageDevice, + 2 + block, + 1, + buffer); + + gdp = &buffer[block_group % (BLOCKSIZE / sizeof(struct ext2_group_desc))]; + + DPRINT("gdp->bg_free_blocks_count %d\n",gdp->bg_free_blocks_count); + DPRINT("gdp->bg_inode_table %d\n",gdp->bg_inode_table); + + return(gdp); + +} + +#define INODES_PER_PAGE (PAGE_SIZE / sizeof(struct ext2_inode)) +#define INODES_PER_BLOCK (BLOCKSIZE / sizeof(struct ext2_inode)) + +VOID Ext2LoadInode(PDEVICE_EXTENSION DeviceExt, + ULONG ino, + PEXT2_INODE Inode) +{ + ULONG block_group; + struct ext2_group_desc* gdp; + ULONG offset; + ULONG dsec; + BOOLEAN Uptodate; + struct ext2_inode* ibuffer; + + DPRINT("Ext2LoadInode(DeviceExt %x, ino %d, Inode %x)\n", + DeviceExt, ino, Inode); + + block_group = (ino - 1) / DeviceExt->superblock->s_inodes_per_group; + + DPRINT("block_group %d\n",block_group); + + gdp = Ext2LoadGroupDesc(DeviceExt, block_group); + + offset = (ino - 1) % DeviceExt->superblock->s_inodes_per_group; + + DPRINT("offset %d\n", offset); + + dsec = (gdp->bg_inode_table + (offset / INODES_PER_BLOCK)) * BLOCKSIZE; + + DPRINT("dsec %d (dsec/BLOCKSIZE) %d PAGE_ROUND_DOWN(dsec) %d\n", + dsec, (dsec/BLOCKSIZE), PAGE_ROUND_DOWN(dsec)); + + CcRequestCachePage(DeviceExt->Bcb, + PAGE_ROUND_DOWN(dsec), + &Inode->BaseAddress, + &Uptodate, + &Inode->CacheSeg); + DPRINT("PAGE_ROUND_DOWN(dsec)/BLOCKSIZE %d\n", + PAGE_ROUND_DOWN(dsec)/BLOCKSIZE); + if (!Uptodate) + { + Ext2ReadSectors(DeviceExt->StorageDevice, + PAGE_ROUND_DOWN(dsec) / BLOCKSIZE, + 4, + Inode->BaseAddress); + } + ibuffer = ((struct ext2_inode *)Inode->BaseAddress) + + (dsec - PAGE_ROUND_DOWN(dsec)); + DPRINT("Inode->BaseAddress 0x%x ibuffer 0x%x\n", + Inode->BaseAddress, ibuffer); + Inode->inode = &ibuffer[offset % INODES_PER_PAGE]; + + DPRINT("inode->i_uid %d\n",Inode->inode->i_uid); + DPRINT("inode->i_links_count %d\n",Inode->inode->i_links_count); + DPRINT("inode->i_blocks %d\n",Inode->inode->i_blocks); + + DPRINT("Ext2LoadInode() finished\n"); +} + +VOID Ext2ReleaseInode(PDEVICE_EXTENSION DeviceExt, + PEXT2_INODE Inode) +{ + CcReleaseCachePage(DeviceExt->Bcb, + Inode->CacheSeg, + TRUE); + Inode->CacheSeg = NULL; + Inode->BaseAddress = NULL; + Inode->inode = NULL; +} + +VOID Ext2ReadInode(PDEVICE_EXTENSION DeviceExt, + ULONG ino, + struct ext2_inode* inode) +{ + ULONG block_group; + struct ext2_group_desc* gdp; + ULONG offset; + struct ext2_inode* buffer; + + DPRINT("Ext2ReadInode(DeviceExt %x, ino %d, inode %x)\n", + DeviceExt,ino,inode); + + block_group = (ino - 1) / DeviceExt->superblock->s_inodes_per_group; + + gdp = Ext2LoadGroupDesc(DeviceExt, block_group); + + + + offset = (ino - 1) % DeviceExt->superblock->s_inodes_per_group; + + buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE); + Ext2ReadSectors(DeviceExt->StorageDevice, + gdp->bg_inode_table + (offset / INODES_PER_BLOCK), + 1, + buffer); + memcpy(inode,&buffer[offset % INODES_PER_BLOCK],sizeof(struct ext2_inode)); + + DPRINT("inode->i_uid %d\n",inode->i_uid); + DPRINT("inode->i_links_count %d\n",inode->i_links_count); + DPRINT("inode->i_blocks %d\n",inode->i_blocks); + +} diff --git a/rosapps/ext2/quota.c b/rosapps/ext2/quota.c new file mode 100644 index 00000000000..2db7af0fed6 --- /dev/null +++ b/rosapps/ext2/quota.c @@ -0,0 +1,49 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/quota.c + * PURPOSE: Quota support + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +Ext2QueryQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + NTSTATUS Status; + + Status = STATUS_NOT_IMPLEMENTED; + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + +NTSTATUS STDCALL +Ext2SetQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + NTSTATUS Status; + + Status = STATUS_NOT_IMPLEMENTED; + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} diff --git a/rosapps/ext2/rw.c b/rosapps/ext2/rw.c new file mode 100644 index 00000000000..1788408eded --- /dev/null +++ b/rosapps/ext2/rw.c @@ -0,0 +1,219 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/super.c + * PURPOSE: ext2 filesystem + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS *****************************************************************/ + +NTSTATUS Ext2ReadPage(PDEVICE_EXTENSION DeviceExt, + PEXT2_FCB Fcb, + PVOID Buffer, + ULONG Offset) +{ + ULONG block, i; + + for (i=0; i<4; i++) + { + block = Ext2BlockMap(DeviceExt, + Fcb->i.inode, + Offset + i); + Ext2ReadSectors(DeviceExt->StorageDevice, + block, + 1, + Buffer + (i*BLOCKSIZE)); + } + return(STATUS_SUCCESS); +} + +NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject, + PVOID Buffer, + ULONG Length, + LARGE_INTEGER OffsetL) +{ + PVOID BaseAddress; + BOOLEAN Uptodate = FALSE; + PCACHE_SEGMENT CacheSeg; + ULONG Offset = (ULONG)OffsetL.u.LowPart; + PEXT2_FCB Fcb; + ULONG block, i, Delta; + DPRINT("Ext2ReadFile(DeviceExt %x, FileObject %x, Buffer %x, Length %d, \n" + "OffsetL %d)\n",DeviceExt,FileObject,Buffer,Length,(ULONG)OffsetL); + + Fcb = (PEXT2_FCB)FileObject->FsContext; + + Ext2LoadInode(DeviceExt, + Fcb->inode, + &Fcb->i); + + if (Offset >= Fcb->i.inode->i_size) + { + DPRINT("Returning end of file\n"); + return(STATUS_END_OF_FILE); + } + if ((Offset + Length) > Fcb->i.inode->i_size) + { + Length = Fcb->i.inode->i_size - Offset; + } + + Ext2ReleaseInode(DeviceExt, + &Fcb->i); + + if ((Offset % PAGE_SIZE) != 0) + { + Delta = min(PAGE_SIZE - (Offset % PAGE_SIZE),Length); + CcRequestCachePage(Fcb->Bcb, + Offset, + &BaseAddress, + &Uptodate, + &CacheSeg); + if (Uptodate == FALSE) + { + Ext2ReadPage(DeviceExt, + Fcb, + BaseAddress, + Offset / BLOCKSIZE); + } + memcpy(Buffer, BaseAddress + (Offset % PAGE_SIZE), Delta); + CcReleaseCachePage(Fcb->Bcb, + CacheSeg, + TRUE); + Length = Length - Delta; + Offset = Offset + Delta; + Buffer = Buffer + Delta; + } + CHECKPOINT; + for (i=0; i<(Length/PAGE_SIZE); i++) + { + CcRequestCachePage(Fcb->Bcb, + Offset, + &BaseAddress, + &Uptodate, + &CacheSeg); + if (Uptodate == FALSE) + { + Ext2ReadPage(DeviceExt, + Fcb, + BaseAddress, + (Offset / BLOCKSIZE)); + } + memcpy(Buffer, BaseAddress, PAGE_SIZE); + CcReleaseCachePage(Fcb->Bcb, + CacheSeg, + TRUE); + Length = Length - PAGE_SIZE; + Offset = Offset + PAGE_SIZE; + Buffer = Buffer + PAGE_SIZE; + } + CHECKPOINT; + if ((Length % PAGE_SIZE) != 0) + { + CcRequestCachePage(Fcb->Bcb, + Offset, + &BaseAddress, + &Uptodate, + &CacheSeg); + if (Uptodate == FALSE) + { + Ext2ReadPage(DeviceExt, + Fcb, + BaseAddress, + (Offset / BLOCKSIZE)); + } + DPRINT("Copying %x to %x Length %d\n",BaseAddress,Buffer,Length); + memcpy(Buffer,BaseAddress,Length); + CcReleaseCachePage(Fcb->Bcb, + CacheSeg, + TRUE); + } + CHECKPOINT; + + return(STATUS_SUCCESS); +} + + +NTSTATUS STDCALL +Ext2Write(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("Ext2Write(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +Ext2FlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("Ext2FlushBuffers(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +Ext2Shutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("Ext2Shutdown(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +Ext2Cleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DbgPrint("Ext2Cleanup(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + + DbgPrint("Ext2Cleanup() finished\n"); + + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +Ext2Read(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + ULONG Length; + PVOID Buffer; + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; + NTSTATUS Status; + + DPRINT("Ext2Read(DeviceObject %x, FileObject %x, Irp %x)\n", + DeviceObject, FileObject, Irp); + + Length = Stack->Parameters.Read.Length; + CHECKPOINT; + Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); + CHECKPOINT; + CHECKPOINT; + + Status = Ext2ReadFile(DeviceExt,FileObject,Buffer,Length, + Stack->Parameters.Read.ByteOffset); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = Length; + IoCompleteRequest(Irp,IO_NO_INCREMENT); + + return(Status); +} diff --git a/rosapps/ext2/security.c b/rosapps/ext2/security.c new file mode 100644 index 00000000000..3862816a48d --- /dev/null +++ b/rosapps/ext2/security.c @@ -0,0 +1,41 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/security.c + * PURPOSE: Security support + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +Ext2QuerySecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("Ext2QuerySecurity(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +Ext2SetSecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("Ext2SetSecurity(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} diff --git a/rosapps/ext2/super.c b/rosapps/ext2/super.c new file mode 100644 index 00000000000..43f921d0341 --- /dev/null +++ b/rosapps/ext2/super.c @@ -0,0 +1,201 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/ext2/super.c + * PURPOSE: ext2 filesystem + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include + +//#define NDEBUG +#include + +#include "ext2fs.h" + +/* GLOBALS *****************************************************************/ + +static PDRIVER_OBJECT DriverObject; + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +Ext2Close(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PFILE_OBJECT FileObject; + PDEVICE_EXTENSION DeviceExtension; + NTSTATUS Status; + PEXT2_FCB Fcb; + + DbgPrint("Ext2Close(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); + + Stack = IoGetCurrentIrpStackLocation(Irp); + FileObject = Stack->FileObject; + DeviceExtension = DeviceObject->DeviceExtension; + + if (FileObject == DeviceExtension->FileObject) + { + Status = STATUS_SUCCESS; + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); + } + + Fcb = (PEXT2_FCB)FileObject->FsContext; + if (Fcb != NULL) + { + if (Fcb->Bcb != NULL) + { + CcRosReleaseFileCache(FileObject, Fcb->Bcb); + } + ExFreePool(Fcb); + FileObject->FsContext = NULL; + } + + Status = STATUS_SUCCESS; + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + +NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount) +{ + PDEVICE_OBJECT DeviceObject; + PDEVICE_EXTENSION DeviceExt; + PVOID BlockBuffer; + struct ext2_super_block* superblock; + + DPRINT("Ext2Mount(DeviceToMount %x)\n",DeviceToMount); + + BlockBuffer = ExAllocatePool(NonPagedPool,BLOCKSIZE); + Ext2ReadSectors(DeviceToMount, + 1, + 1, + BlockBuffer); + superblock = BlockBuffer; + + if (superblock->s_magic != EXT2_SUPER_MAGIC) + { + ExFreePool(BlockBuffer); + return(STATUS_UNRECOGNIZED_VOLUME); + } + DPRINT("Volume recognized\n"); + DPRINT("s_inodes_count %d\n",superblock->s_inodes_count); + DPRINT("s_blocks_count %d\n",superblock->s_blocks_count); + + IoCreateDevice(DriverObject, + sizeof(DEVICE_EXTENSION), + NULL, + FILE_DEVICE_FILE_SYSTEM, + 0, + FALSE, + &DeviceObject); + DPRINT("DeviceObject %x\n",DeviceObject); + DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO; + DeviceExt = (PVOID)DeviceObject->DeviceExtension; + DPRINT("DeviceExt %x\n",DeviceExt); + + DeviceExt->StorageDevice = DeviceToMount; + DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject; + DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice; + DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED; + DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1; + DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; + + DPRINT("DeviceExt->StorageDevice %x\n", DeviceExt->StorageDevice); + DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject); + DeviceExt->superblock = superblock; + CcRosInitializeFileCache(DeviceExt->FileObject, + &DeviceExt->Bcb, + PAGE_SIZE * 3); + + DPRINT("Ext2Mount() = STATUS_SUCCESS\n"); + + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +Ext2FileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PVPB vpb = Stack->Parameters.Mount.Vpb; + PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject; + NTSTATUS Status; + + Status = Ext2Mount(DeviceToMount); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + +NTSTATUS STDCALL +DriverEntry(PDRIVER_OBJECT _DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Called by the system to initalize the driver + * ARGUMENTS: + * DriverObject = object describing this driver + * RegistryPath = path to our configuration entries + * RETURNS: Success or failure + */ +{ + PDEVICE_OBJECT DeviceObject; + NTSTATUS ret; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Ext2Fsd"); + + DbgPrint("Ext2 FSD 0.0.1\n"); + + DriverObject = _DriverObject; + + ret = IoCreateDevice(DriverObject, + 0, + &DeviceName, + FILE_DEVICE_FILE_SYSTEM, + 0, + FALSE, + &DeviceObject); + if (ret!=STATUS_SUCCESS) + { + return(ret); + } + + DeviceObject->Flags=0; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = Ext2Close; + DriverObject->MajorFunction[IRP_MJ_CREATE] = Ext2Create; + DriverObject->MajorFunction[IRP_MJ_READ] = Ext2Read; + DriverObject->MajorFunction[IRP_MJ_WRITE] = Ext2Write; + DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = + Ext2FileSystemControl; + DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = + Ext2DirectoryControl; + DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = + Ext2QueryInformation; + DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = Ext2SetInformation; + DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = Ext2FlushBuffers; + DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = Ext2Shutdown; + DriverObject->MajorFunction[IRP_MJ_CLEANUP] = Ext2Cleanup; + DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = Ext2QuerySecurity; + DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] = Ext2SetSecurity; + DriverObject->MajorFunction[IRP_MJ_QUERY_QUOTA] = Ext2QueryQuota; + DriverObject->MajorFunction[IRP_MJ_SET_QUOTA] = Ext2SetQuota; + + DriverObject->DriverUnload = NULL; + + IoRegisterFileSystem(DeviceObject); + + return(STATUS_SUCCESS); +} + diff --git a/rosapps/gettype/gettype.c b/rosapps/gettype/gettype.c new file mode 100644 index 00000000000..ea98d326e65 --- /dev/null +++ b/rosapps/gettype/gettype.c @@ -0,0 +1,394 @@ +/* + * ReactOS Win32 Applications + * Copyright (C) 2005 ReactOS Team + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS arp utility + * FILE: apps/utils/gettype/gettype.c + * PURPOSE: + * PROGRAMMERS: Brandon Turner (turnerb7@msu.edu) + * REVISIONS: + * GM 30/10/05 Created + * + * FIXME: gettype only supports local computer. + */ +#include +#include +#include +#include +#include + +enum +{ + GETTYPE_ROLE = 0x001, + GETTYPE_HELP = 0x002, + GETTYPE_SP = 0x004, + GETTYPE_VER = 0x008, + GETTYPE_MINV = 0x010, + GETTYPE_MAJV = 0x020, + GETTYPE_TYPE = 0x040, + GETTYPE_BUILD = 0x080 +}; + +INT +GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + INT VersionNumber = 255; + if(pBuf102 != NULL && !bLocal) + { + VersionNumber = pBuf102->sv102_version_major * 1000; + VersionNumber += (pBuf102->sv102_version_minor * 100); + } + else if(bLocal) + { + VersionNumber = osvi->dwMajorVersion * 1000; + VersionNumber += (osvi->dwMinorVersion * 100); + } + + return VersionNumber; +} + +INT +GetMajValue(BOOL Major, BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + INT VersionNumber = 255; + if(pBuf102 != NULL && !bLocal) + { + if(Major) + VersionNumber = pBuf102->sv102_version_major * 1000; + else + VersionNumber = pBuf102->sv102_version_minor * 100; + } + else + { + if(Major) + VersionNumber = osvi->dwMajorVersion * 1000; + else + VersionNumber = osvi->dwMinorVersion * 100; + } + return VersionNumber; +} + +INT +GetSystemRole(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + + if(pBuf102 != NULL && !bLocal) + { + if ((pBuf102->sv102_type & SV_TYPE_DOMAIN_CTRL) || + (pBuf102->sv102_type & SV_TYPE_DOMAIN_BAKCTRL)) + return 1; + else if(pBuf102->sv102_type & SV_TYPE_SERVER_NT) + return 2; + else + return 3; + } + else + { + if(osvi->wProductType == VER_NT_DOMAIN_CONTROLLER) + return 1; + else if(osvi->wProductType == VER_NT_SERVER) + return 2; + else if(osvi->wProductType == VER_NT_WORKSTATION) + return 3; + } + return 255; + +} + +INT +GetServicePack(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102, TCHAR * Server) +{ + INT SPNumber = 255; + if(!bLocal) + { + /* FIXME: Use Registry to get value */ + } + else + { + SPNumber = osvi->wServicePackMajor; + } + return SPNumber; +} + +INT +GetBuildNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + INT BuildNum = 255; + if(!bLocal) + { + /* FIXME: Use Registry to get value */ + } + else + { + BuildNum = osvi->dwBuildNumber; + } + return BuildNum; +} + +INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + if(bLocal) + { + if(osvi->dwMajorVersion == 5) + { + if(osvi->dwMinorVersion == 1) + { + if(osvi->wSuiteMask & VER_SUITE_PERSONAL) + return 1; + else + return 2; + } + else if(osvi->dwMinorVersion == 2) + { + if(osvi->wSuiteMask & VER_SUITE_BLADE) + return 6; + else if(osvi->wSuiteMask & VER_SUITE_DATACENTER) + return 5; + else if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE) + return 4; + else + return 3; + } + } + } + else + { + /* FIXME: Get this value from registry */ + } + return 255; +} + +VOID +GetBasicInfo(LPOSVERSIONINFOEX osvi, TCHAR * HostName, TCHAR * OSName, TCHAR * Version, TCHAR * Role, TCHAR * Components) +{ + /* Host Name - COMPUTERNAME*/ + DWORD bufCharCount = 1024; + GetComputerName(HostName, &bufCharCount); + + + /* OSName - Windows XP Home Editition */ + if(osvi->dwMajorVersion == 4) + { + _tcscpy(OSName, _T("Microsoft Windows NT 4.0 ")); + } + else if(osvi->dwMajorVersion == 5) + { + if(osvi->dwMajorVersion == 0) + { + _tcscpy(OSName, _T("Microsoft Windows 2000 ")); + } + else if(osvi->dwMinorVersion == 1) + { + _tcscpy(OSName, _T("Microsoft Windows XP ")); + } + else if(osvi->dwMinorVersion == 2) + { + _tcscpy(OSName, _T("Microsoft Windows Server 2003 ")); + } + } + else if(osvi->dwMajorVersion == 6) + { + _tcscpy(OSName, _T("Microsoft Windows Vista ")); + } + else + { + _tcscpy(OSName, _T("Microsoft Windows ")); + } + + if(osvi->wSuiteMask & VER_SUITE_BLADE) + _tcscat(OSName, _T("Web Edition")); + if(osvi->wSuiteMask & VER_SUITE_DATACENTER) + _tcscat(OSName, _T("Datacenter")); + if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE) + _tcscat(OSName, _T("Enterprise")); + if(osvi->wSuiteMask & VER_SUITE_EMBEDDEDNT) + _tcscat(OSName, _T("Embedded")); + if(osvi->wSuiteMask & VER_SUITE_PERSONAL) + _tcscat(OSName, _T("Home Edition")); + if(osvi->wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED && osvi->wSuiteMask & VER_SUITE_SMALLBUSINESS) + _tcscat(OSName, _T("Small Bussiness Edition")); + + /* Version - 5.1 Build 2600 Serivce Pack 2 */ + _stprintf(Version, _T("%d.%d Build %d %s"),(int)osvi->dwMajorVersion,(int)osvi->dwMinorVersion,(int)osvi->dwBuildNumber, osvi->szCSDVersion); + + /* Role - Workgroup / Server / Domain Controller */ + if(osvi->wProductType == VER_NT_DOMAIN_CONTROLLER) + _tcscpy(Role, _T("Domain Controller")); + else if(osvi->wProductType == VER_NT_SERVER) + _tcscpy(Role, _T("Server")); + else if(osvi->wProductType == VER_NT_WORKSTATION) + _tcscpy(Role, _T("Workgroup")); + + /* Components - FIXME: what is something that might be installed? */ + _tcscat(Components, _T("Not Installed")); + +} + +INT +main (VOID) +{ + DWORD Operations = 0; + INT ret = 255; + INT i = 0; + INT argc = 0; + /* True if the target is local host */ + BOOL bLocal = TRUE; + DWORD nStatus = 0; + TCHAR ServerName[32]; + TCHAR RemoteResource[32]; + TCHAR UserName[32] = _T(""); + TCHAR Password[32] = _T(""); + LPOSVERSIONINFOEX osvi = NULL; + LPSERVER_INFO_102 pBuf102 = NULL; + LPTSTR * argv; + osvi = (LPOSVERSIONINFOEX)malloc(sizeof(LPOSVERSIONINFOEX)); + pBuf102 = (LPSERVER_INFO_102)malloc(sizeof(LPSERVER_INFO_102)); + + /* Get the command line correctly since it is unicode */ + argv = CommandLineToArgvW(GetCommandLineW(), &argc); + + + /* Process flags */ + if(argc) + { + for (i = 1; i < argc; i++) + { + if(!_tcsicmp(argv[i], _T("/ROLE")) && !Operations) + Operations |= GETTYPE_ROLE; + else if(!_tcsicmp(argv[i], _T("/VER")) && !Operations) + Operations |= GETTYPE_VER; + else if(!_tcsicmp(argv[i], _T("/MAJV")) && !Operations) + Operations |= GETTYPE_MAJV; + else if(!_tcsicmp(argv[i], _T("/MINV")) && !Operations) + Operations |= GETTYPE_MINV; + else if(!_tcsicmp(argv[i], _T("/SP")) && !Operations) + Operations |= GETTYPE_SP; + else if(!_tcsicmp(argv[i], _T("/BUILD")) && !Operations) + Operations |= GETTYPE_BUILD; + else if(!_tcsicmp(argv[i], _T("/TYPE")) && !Operations) + Operations |= GETTYPE_TYPE; + else if(!_tcsicmp(argv[i], _T("/?")) && !Operations) + Operations |= GETTYPE_HELP; + else if(!_tcsicmp(argv[i], _T("/S")) && i + 1 < argc) + { + _tcscpy(ServerName,argv[++i]); + bLocal = FALSE; + } + else if(!wcsicmp(argv[i], L"/U") && i + 1 < argc) + _tcscpy(UserName,argv[++i]); + else if(!wcsicmp(argv[i], L"/P") && i + 1 < argc) + _tcscpy(Password,argv[++i]); + else + { + wprintf(L"Error in paramters, please see usage\n"); + return 255; + } + } + } + + /* Some debug info */ + //_tprintf(_T("%s - %s - %s - %d"), ServerName, UserName, Password, (int)Operations); + + if(!bLocal) + { + NETRESOURCE nr; + + + /* \\*IP or Computer Name*\*Share* */ + _stprintf(RemoteResource, _T("\\\\%s\\IPC$"), ServerName); + + nr.dwType = RESOURCETYPE_ANY; + nr.lpLocalName = NULL; + nr.lpProvider= NULL; + nr.lpRemoteName = RemoteResource; + + /* open a connection to the server with difference user/pass. */ + nStatus = WNetAddConnection2(&nr, UserName[0]?UserName:NULL,Password[0]?Password:NULL, CONNECT_INTERACTIVE | CONNECT_COMMANDLINE); + + if(nStatus != NO_ERROR) + { + _tprintf(_T("Error:%d-%d\n"),(int)nStatus,GetLastError()); + return 255; + } + } + + /* Use GetVersionEx for anything that we are looking for locally */ + if(bLocal) + { + osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if(!GetVersionEx((LPOSVERSIONINFO)osvi)) + { + _tprintf(_T("Failed to get local information\n")); + return 255; + } + } + else + { + nStatus = NetServerGetInfo(NULL,102,(LPBYTE *)&pBuf102); + if (nStatus != NERR_Success) + { + _tprintf(_T("Failed to connection to remote machine\n")); + return 255; + } + + } + + if(Operations & GETTYPE_VER) + { + ret = GetVersionNumber(bLocal, osvi, pBuf102); + } + else if(Operations & GETTYPE_MAJV) + { + ret = GetMajValue(TRUE, bLocal, osvi, pBuf102); + } + else if(Operations & GETTYPE_MINV) + { + ret = GetMajValue(FALSE, bLocal, osvi, pBuf102); + } + else if(Operations & GETTYPE_ROLE) + { + ret = GetSystemRole(bLocal, osvi, pBuf102); + } + else if(Operations & GETTYPE_SP) + { + ret = GetServicePack(bLocal, osvi, pBuf102, ServerName); + } + else if(Operations & GETTYPE_BUILD) + { + ret = GetBuildNumber(bLocal, osvi, pBuf102); + } + else if(Operations & GETTYPE_TYPE) + { + ret = GetType(bLocal, osvi, pBuf102); + } + else if(Operations & GETTYPE_HELP) + { + wprintf(L"GETTYPE [/ROLE | /SP | /VER | /MAJV | /MINV | /TYPE | /BUILD]"); + ret = 0; + } + else if(!Operations && bLocal) + { + /* FIXME: what happens when no flags except remote machine, does it + it print this info for the remote server? */ + TCHAR HostName[1024] = _T(""); + TCHAR OSName[1024] = _T(""); + TCHAR VersionInfo[1024] = _T(""); + TCHAR Role[1024] = _T(""); + TCHAR Components[1024] = _T(""); + GetBasicInfo(osvi, HostName, OSName, VersionInfo, Role, Components); + _tprintf(_T("\nHostname: %s\nName: %s\nVersion:%s\n") ,HostName, OSName, VersionInfo); + _tprintf(_T("Role: %s\nComponent: %s\n"), Role, Components); + ret = 0; + } + + /* Clean up some stuff that that was opened */ + if(pBuf102) + NetApiBufferFree(pBuf102); + LocalFree(argv); + if(!bLocal) + { + WNetCancelConnection2(RemoteResource,0,TRUE); + } + return ret; +} diff --git a/rosapps/gettype/gettype.rbuild b/rosapps/gettype/gettype.rbuild new file mode 100644 index 00000000000..3ea425f17d0 --- /dev/null +++ b/rosapps/gettype/gettype.rbuild @@ -0,0 +1,12 @@ + + . + 0x0501 + + + + kernel32 + shell32 + mpr + netapi32 + gettype.c + diff --git a/rosapps/green/createclose.c b/rosapps/green/createclose.c new file mode 100644 index 00000000000..ef8f6658a17 --- /dev/null +++ b/rosapps/green/createclose.c @@ -0,0 +1,38 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/createclose.c + * PURPOSE: IRP_MJ_CREATE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP operations + * PROGRAMMERS: Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +NTSTATUS +GreenCreate( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT("IRP_MJ_CREATE\n"); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +NTSTATUS +GreenClose( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + DPRINT("IRP_MJ_CLOSE\n"); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} diff --git a/rosapps/green/dispatch.c b/rosapps/green/dispatch.c new file mode 100644 index 00000000000..d40df5c54c9 --- /dev/null +++ b/rosapps/green/dispatch.c @@ -0,0 +1,105 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/dispatch.c + * PURPOSE: Dispatch routines + * PROGRAMMERS: Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +NTSTATUS NTAPI +GreenDispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + ULONG MajorFunction; + GREEN_DEVICE_TYPE DeviceType; + ULONG_PTR Information; + NTSTATUS Status; + + MajorFunction = IoGetCurrentIrpStackLocation(Irp)->MajorFunction; + DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; + + Information = Irp->IoStatus.Information; + Status = Irp->IoStatus.Status; + + DPRINT("Dispatching major function 0x%lx, DeviceType %u\n", + MajorFunction, DeviceType); + + if (DeviceType == PassThroughFDO) + { + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp); + } + else if (MajorFunction == IRP_MJ_CREATE && (DeviceType == GreenFDO || DeviceType == KeyboardPDO || DeviceType == ScreenPDO)) + return GreenCreate(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_CLOSE && (DeviceType == GreenFDO || DeviceType == KeyboardPDO || DeviceType == ScreenPDO)) + return GreenClose(DeviceObject, Irp); + else if ((MajorFunction == IRP_MJ_CREATE || MajorFunction == IRP_MJ_CLOSE || MajorFunction == IRP_MJ_CLEANUP) + && (DeviceType == KeyboardFDO || DeviceType == ScreenFDO)) + { + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp); + } + else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == GreenFDO) + { + return KeyboardInternalDeviceControl( + ((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->KeyboardFdo, + Irp); + } + else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == KeyboardFDO) + return KeyboardInternalDeviceControl(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == GreenFDO) + { + return ScreenDeviceControl( + ((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ScreenFdo, + Irp); + } + else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == ScreenFDO) + return ScreenDeviceControl(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_WRITE && DeviceType == ScreenFDO) + return ScreenWrite(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_PNP && (DeviceType == KeyboardFDO || DeviceType == ScreenFDO)) + { + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp); + } + else if (MajorFunction == IRP_MJ_PNP && (DeviceType == GreenFDO || DeviceType == KeyboardPDO || DeviceType == ScreenPDO)) + return GreenPnp(DeviceObject, Irp); + else if (MajorFunction == IRP_MJ_POWER && DeviceType == GreenFDO) + return GreenPower(DeviceObject, Irp); + else + { + DPRINT1("Unknown combination: MajorFunction 0x%lx, DeviceType %d\n", + MajorFunction, DeviceType); + switch (DeviceType) + { + case KeyboardFDO: + case ScreenFDO: + { + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp); + } + case GreenFDO: + { + PDRIVER_OBJECT DriverObject; + PGREEN_DRIVER_EXTENSION DriverExtension; + DriverObject = DeviceObject->DriverObject; + DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DriverExtension->LowerDevice, Irp); + } + default: + ASSERT(FALSE); + } + } + + Irp->IoStatus.Information = Information; + Irp->IoStatus.Status = Status; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return Status; +} diff --git a/rosapps/green/green.c b/rosapps/green/green.c new file mode 100644 index 00000000000..5834f3bfcb0 --- /dev/null +++ b/rosapps/green/green.c @@ -0,0 +1,68 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/green.c + * PURPOSE: Driver entry point + * PROGRAMMERS: Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +VOID NTAPI +DriverUnload(IN PDRIVER_OBJECT DriverObject) +{ + // nothing to do here yet +} + +/* + * Standard DriverEntry method. + */ +NTSTATUS NTAPI +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath) +{ + PGREEN_DRIVER_EXTENSION DriverExtension; + ULONG i; + NTSTATUS Status; + + Status = IoAllocateDriverObjectExtension( + DriverObject, + DriverObject, + sizeof(GREEN_DRIVER_EXTENSION), + (PVOID*)&DriverExtension); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoAllocateDriverObjectExtension() failed with status 0x%08lx\n", Status); + return Status; + } + RtlZeroMemory(DriverExtension, sizeof(GREEN_DRIVER_EXTENSION)); + + Status = RtlDuplicateUnicodeString( + 0, + RegistryPath, + &DriverExtension->RegistryPath); + if (!NT_SUCCESS(Status)) + { + DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status); + return Status; + } + + Status = ReadRegistryEntries(RegistryPath, DriverExtension); + if (!NT_SUCCESS(Status)) + { + DPRINT("ReadRegistryEntries() failed with status 0x%08lx\n", Status); + return Status; + } + + DriverObject->DriverUnload = DriverUnload; + DriverObject->DriverExtension->AddDevice = GreenAddDevice; + + for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) + DriverObject->MajorFunction[i] = GreenDispatch; + + return STATUS_SUCCESS; +} diff --git a/rosapps/green/green.h b/rosapps/green/green.h new file mode 100644 index 00000000000..b54fa961c2d --- /dev/null +++ b/rosapps/green/green.h @@ -0,0 +1,192 @@ +#include +#include +#include +#include +#define WINBASEAPI +typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES; +#include +#include +#include +#include + +NTSYSAPI +NTSTATUS +NTAPI +RtlDuplicateUnicodeString( + IN ULONG Flags, + IN PCUNICODE_STRING SourceString, + OUT PUNICODE_STRING DestinationString +); +#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1 + +#define INFINITE -1 +#define KEYBOARD_BUFFER_SIZE 100 + +typedef enum +{ + GreenPDO, + ScreenPDO, + KeyboardPDO, + GreenFDO, + ScreenFDO, + KeyboardFDO, + PassThroughFDO, +} GREEN_DEVICE_TYPE; + +typedef struct _COMMON_DEVICE_EXTENSION +{ + GREEN_DEVICE_TYPE Type; +} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION; + +/* For PassThroughFDO devices */ +typedef struct _COMMON_FDO_DEVICE_EXTENSION +{ + GREEN_DEVICE_TYPE Type; + PDEVICE_OBJECT LowerDevice; +} COMMON_FDO_DEVICE_EXTENSION, *PCOMMON_FDO_DEVICE_EXTENSION; + +/* For KeyboardFDO devices */ +typedef struct _KEYBOARD_DEVICE_EXTENSION +{ + COMMON_FDO_DEVICE_EXTENSION Common; + PDEVICE_OBJECT Green; + + CONNECT_DATA ClassInformation; + HANDLE WorkerThreadHandle; + KDPC KeyboardDpc; + + ULONG ActiveQueue; + ULONG InputDataCount[2]; + KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE]; +} KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION; + +/* For ScreenFDO devices */ +typedef struct _SCREEN_DEVICE_EXTENSION +{ + COMMON_FDO_DEVICE_EXTENSION Common; + PDEVICE_OBJECT Green; + + PUCHAR VideoMemory; /* Pointer to video memory */ + USHORT CharAttribute; /* Current color attribute */ + ULONG Mode; + UCHAR ScanLines; /* Height of a text line */ + UCHAR Rows; /* Number of rows */ + UCHAR Columns; /* Number of columns */ + UCHAR TabWidth; + + ULONG LogicalOffset; /* Position of the cursor */ + + UCHAR SendBuffer[1024]; + ULONG SendBufferPosition; + PDEVICE_OBJECT PreviousBlue; +} SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION; + +/* For GreenFDO devices */ +typedef struct _GREEN_DEVICE_EXTENSION +{ + COMMON_FDO_DEVICE_EXTENSION Common; + PDEVICE_OBJECT Serial; + + SERIAL_LINE_CONTROL LineControl; + SERIAL_TIMEOUTS Timeouts; + + PDEVICE_OBJECT KeyboardPdo; + PDEVICE_OBJECT ScreenPdo; + PDEVICE_OBJECT KeyboardFdo; + PDEVICE_OBJECT ScreenFdo; +} GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION; + +typedef struct _GREEN_DRIVER_EXTENSION +{ + UNICODE_STRING RegistryPath; + + UNICODE_STRING AttachedDeviceName; + ULONG DeviceReported; + ULONG SampleRate; + + PDEVICE_OBJECT GreenMainDO; + PDEVICE_OBJECT LowerDevice; +} GREEN_DRIVER_EXTENSION, *PGREEN_DRIVER_EXTENSION; + +/************************************ createclose.c */ + +NTSTATUS +GreenCreate( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +NTSTATUS +GreenClose( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ dispatch.c */ + +NTSTATUS NTAPI +GreenDispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ keyboard.c */ + +NTSTATUS +KeyboardAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo); + +NTSTATUS +KeyboardInternalDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ misc.c */ + +NTSTATUS +GreenDeviceIoControl( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG CtlCode, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferSize, + IN OUT PVOID OutputBuffer OPTIONAL, + IN OUT PULONG OutputBufferSize); + +NTSTATUS +ReadRegistryEntries( + IN PUNICODE_STRING RegistryPath, + IN PGREEN_DRIVER_EXTENSION DriverExtension); + +/************************************ pnp.c */ + +NTSTATUS NTAPI +GreenAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo); + +NTSTATUS +GreenPnp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ power.c */ + +NTSTATUS +GreenPower( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +/************************************ screen.c */ + +NTSTATUS +ScreenAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo); + +NTSTATUS +ScreenWrite( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); + +NTSTATUS +ScreenDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp); diff --git a/rosapps/green/green.inf b/rosapps/green/green.inf new file mode 100644 index 00000000000..805fbda8207 --- /dev/null +++ b/rosapps/green/green.inf @@ -0,0 +1,96 @@ +; GREEN.INF + +; Installation file for Green (VT100 server emulator) driver + +[Version] +Signature = "$Windows NT$" +;Signature = "$ReactOS$" +LayoutFile = layout.inf +Class = System +ClassGUID = {4D36E97D-E325-11CE-BFC1-08002BE10318} +Provider = %ReactOS% +DriverVer = 12/7/2005,1.00 + +[DestinationDirs] +DefaultDestDir = 12 + +[Manufacturer] +%ReactOSMfg% = ReactOSMfg + +[ReactOSMfg] +%KEYBOARD.DeviceDesc% = Keyboard_Inst,GREEN\KEYBOARD +%SCREEN.DeviceDesc% = Screen_Inst,GREEN\SCREEN + +;----------------------------- GREEN DRIVER ----------------------------- + +[DefaultInstall.NT] +CopyFiles = Green_CopyFiles.NT +AddReg = Green_AddReg.NT + +[Green_CopyFiles.NT] +green.sys + +[DefaultInstall.NT.Services] +AddService = green, 0x00000002, green_Service_Inst + +[green_Service_Inst] +ServiceType = 1 +StartType = 1 +ErrorControl = 0 +ServiceBinary = %12%\green.sys +LoadOrderGroup = Extended base +Description = %GREEN.DriverDesc% +Dependencies = blue, serial + +[Green_AddReg.NT] +HKLM,"SYSTEM\CurrentControlSet\Services\green\Parameters","AttachedDevice",0x00000000,"\Device\Serial1" + +[DefaultUninstall.NT] +DelFiles = Green_DelFiles.NT +DelReg = Green_DelReg.NT + +[DefaultUninstall.NT.Services] +DelService = green, 0x00000200 + +[Green_DelFiles.NT] +green.sys,,,0x00000001 + +[Green_DelReg.NT] +HKLM,"SYSTEM\CurrentControlSet\Services\green\Parameters" + +;---------------------------- KEYBOARD DEVICE --------------------------- + +[Keyboard_Inst.NT] +CopyFiles = Green_CopyFiles.NT +Include = keyboard.inf +Needs = STANDARD_Inst + +[Keyboard_Inst.NT.HW] +AddReg = Keyboard_AddReg.NT + +[Keyboard_AddReg.NT] +HKR, , "UpperFilters", 0x00010000, "kbdclass" + +[Keyboard_Inst.NT.Services] +AddService = green, 0x00000002, green_Service_Inst +Include = msmouse.inf +Needs = PS2_Inst.Services + +;----------------------------- SCREEN DEVICE ---------------------------- + +[Screen_Inst.NT] +CopyFiles = Green_CopyFiles.NT + +[Screen_Inst.NT.Services] +AddService = green, 0x00000002, green_Service_Inst + +;-------------------------------- STRINGS ------------------------------- + +[Strings] +ReactOS = "ReactOS Team" + +GREEN.DriverDesc = "VT100 server emulator" + +ReactOSMfg = "(ReactOS Team)" +KEYBOARD.DeviceDesc = "Keyboard for remote console" +SCREEN.DeviceDesc = "Screen for remote console" diff --git a/rosapps/green/green.rbuild b/rosapps/green/green.rbuild new file mode 100644 index 00000000000..1c0b6a8edb9 --- /dev/null +++ b/rosapps/green/green.rbuild @@ -0,0 +1,16 @@ + + + + ntoskrnl + hal + createclose.c + dispatch.c + green.c + keyboard.c + misc.c + pnp.c + power.c + screen.c + green.rc + green.h + diff --git a/rosapps/green/green.rc b/rosapps/green/green.rc new file mode 100644 index 00000000000..7096b7dfd1d --- /dev/null +++ b/rosapps/green/green.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "VT100 Server Driver\0" +#define REACTOS_STR_INTERNAL_NAME "green\0" +#define REACTOS_STR_ORIGINAL_FILENAME "green.sys\0" +#include diff --git a/rosapps/green/keyboard.c b/rosapps/green/keyboard.c new file mode 100644 index 00000000000..0a4b1950154 --- /dev/null +++ b/rosapps/green/keyboard.c @@ -0,0 +1,321 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/dd/green/keyboard.c + * PURPOSE: Keyboard part of green management + * PROGRAMMERS: Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +static BOOLEAN +TranslateCharToScanCodes( + IN PUCHAR InputBuffer, + IN ULONG InputBufferSize, + OUT KEYBOARD_INPUT_DATA* OutputBuffer, + OUT PULONG OutputBufferSize, + OUT PULONG BytesConsumed) +{ + BOOLEAN NormalKey = FALSE; + USHORT MakeCode; + + if (InputBufferSize == 0) + return FALSE; + + switch (*InputBuffer) + { + case 0x1b: MakeCode = 0x01; NormalKey = TRUE; break; /* ESC */ + + case '1': MakeCode = 0x02; NormalKey = TRUE; break; + case '2': MakeCode = 0x03; NormalKey = TRUE; break; + case '3': MakeCode = 0x04; NormalKey = TRUE; break; + case '4': MakeCode = 0x05; NormalKey = TRUE; break; + case '5': MakeCode = 0x06; NormalKey = TRUE; break; + case '6': MakeCode = 0x07; NormalKey = TRUE; break; + case '7': MakeCode = 0x08; NormalKey = TRUE; break; + case '8': MakeCode = 0x09; NormalKey = TRUE; break; + case '9': MakeCode = 0x0a; NormalKey = TRUE; break; + case '0': MakeCode = 0x0b; NormalKey = TRUE; break; + case '-': MakeCode = 0x0c; NormalKey = TRUE; break; + case '=': MakeCode = 0x0d; NormalKey = TRUE; break; + case '\b': MakeCode = 0x0e; NormalKey = TRUE; break; + + case '\t': MakeCode = 0x0f; NormalKey = TRUE; break; + case 'q': MakeCode = 0x10; NormalKey = TRUE; break; + case 'w': MakeCode = 0x11; NormalKey = TRUE; break; + case 'e': MakeCode = 0x12; NormalKey = TRUE; break; + case 'r': MakeCode = 0x13; NormalKey = TRUE; break; + case 't': MakeCode = 0x14; NormalKey = TRUE; break; + case 'y': MakeCode = 0x15; NormalKey = TRUE; break; + case 'u': MakeCode = 0x16; NormalKey = TRUE; break; + case 'i': MakeCode = 0x17; NormalKey = TRUE; break; + case 'o': MakeCode = 0x18; NormalKey = TRUE; break; + case 'p': MakeCode = 0x19; NormalKey = TRUE; break; + case '[': MakeCode = 0x1a; NormalKey = TRUE; break; + case ']': MakeCode = 0x1b; NormalKey = TRUE; break; + + case '\r': MakeCode = 0x1c; NormalKey = TRUE; break; + + case 'a': MakeCode = 0x1e; NormalKey = TRUE; break; + case 's': MakeCode = 0x1f; NormalKey = TRUE; break; + case 'd': MakeCode = 0x20; NormalKey = TRUE; break; + case 'f': MakeCode = 0x21; NormalKey = TRUE; break; + case 'g': MakeCode = 0x22; NormalKey = TRUE; break; + case 'h': MakeCode = 0x23; NormalKey = TRUE; break; + case 'j': MakeCode = 0x24; NormalKey = TRUE; break; + case 'k': MakeCode = 0x25; NormalKey = TRUE; break; + case 'l': MakeCode = 0x26; NormalKey = TRUE; break; + case ';': MakeCode = 0x27; NormalKey = TRUE; break; + case '\'': MakeCode = 0x28; NormalKey = TRUE; break; + + case '`': MakeCode = 0x29; NormalKey = TRUE; break; + + case '\\': MakeCode = 0x2b; NormalKey = TRUE; break; + + case 'z': MakeCode = 0x2c; NormalKey = TRUE; break; + case 'x': MakeCode = 0x2d; NormalKey = TRUE; break; + case 'c': MakeCode = 0x2e; NormalKey = TRUE; break; + case 'v': MakeCode = 0x2f; NormalKey = TRUE; break; + case 'b': MakeCode = 0x30; NormalKey = TRUE; break; + case 'n': MakeCode = 0x31; NormalKey = TRUE; break; + case 'm': MakeCode = 0x32; NormalKey = TRUE; break; + case ',': MakeCode = 0x33; NormalKey = TRUE; break; + case '.': MakeCode = 0x34; NormalKey = TRUE; break; + case '/': MakeCode = 0x35; NormalKey = TRUE; break; + + case ' ': MakeCode = 0x39; NormalKey = TRUE; break; + } + if (NormalKey && *OutputBufferSize >= 2) + { + OutputBuffer[0].MakeCode = MakeCode; + OutputBuffer[0].Flags = KEY_MAKE; + OutputBuffer[1].MakeCode = MakeCode; + OutputBuffer[1].Flags = KEY_BREAK; + *BytesConsumed = 2; + return TRUE; + } + + /* Consume strange character by ignoring it */ + DPRINT1("Strange byte received 0x%02x ('%c')\n", + *InputBuffer, *InputBuffer >= 32 ? *InputBuffer : '.'); + *BytesConsumed = 1; + return TRUE; +} + +NTSTATUS +KeyboardAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo) +{ + PDEVICE_OBJECT Fdo; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + NTSTATUS Status; + + DPRINT("KeyboardInitialize() called\n"); + + Status = IoCreateDevice(DriverObject, + sizeof(KEYBOARD_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_KEYBOARD, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + if (!NT_SUCCESS(Status)) + return Status; + + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION)); + DeviceExtension->Common.Type = KeyboardFDO; + DeviceExtension->Common.LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo); + DeviceExtension->Green = ((PGREEN_DRIVER_EXTENSION)IoGetDriverObjectExtension(DriverObject, DriverObject))->GreenMainDO; + ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->KeyboardFdo = Fdo; + Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO; + Fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + return STATUS_SUCCESS; +} + +static VOID NTAPI +KeyboardDpcSendData( + IN PKDPC Dpc, + IN PVOID pDeviceExtension, /* real type PKEYBOARD_DEVICE_EXTENSION */ + IN PVOID Unused1, + IN PVOID Unused2) +{ + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + ULONG Queue; + ULONG InputDataConsumed; + + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pDeviceExtension; + + Queue = DeviceExtension->ActiveQueue % 2; + InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue); + (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.ClassService)( + DeviceExtension->ClassInformation.ClassDeviceObject, + DeviceExtension->KeyboardInputData[Queue], + DeviceExtension->KeyboardInputData[Queue] + DeviceExtension->InputDataCount[Queue], + &InputDataConsumed); + + DeviceExtension->InputDataCount[Queue] = 0; +} + +static VOID NTAPI +KeyboardDeviceWorker( + PVOID Context) +{ + PDEVICE_OBJECT DeviceObject; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + PGREEN_DEVICE_EXTENSION GreenDeviceExtension; + PDEVICE_OBJECT LowerDevice; + UCHAR Buffer[16]; /* Arbitrary size */ + ULONG BufferSize; + LARGE_INTEGER Zero; + PIRP Irp; + IO_STATUS_BLOCK ioStatus; + KEVENT event; + KIRQL OldIrql; + ULONG i, Queue; + ULONG SpaceInQueue; + ULONG BytesConsumed = 0; + PKEYBOARD_INPUT_DATA Input; + NTSTATUS Status; + + DPRINT("KeyboardDeviceWorker() called\n"); + + DeviceObject = (PDEVICE_OBJECT)Context; + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension; + LowerDevice = GreenDeviceExtension->Serial; + BufferSize = sizeof(Buffer); + Zero.QuadPart = 0; + + /* Initialize device extension */ + DeviceExtension->ActiveQueue = 0; + DeviceExtension->InputDataCount[0] = 0; + DeviceExtension->InputDataCount[1] = 0; + KeInitializeDpc(&DeviceExtension->KeyboardDpc, KeyboardDpcSendData, DeviceExtension); + RtlZeroMemory(&DeviceExtension->KeyboardInputData, sizeof(DeviceExtension->KeyboardInputData)); + + /* main read loop */ + while (TRUE) + { + KeInitializeEvent(&event, NotificationEvent, FALSE); + Irp = IoBuildSynchronousFsdRequest( + IRP_MJ_READ, + LowerDevice, + Buffer, BufferSize, + &Zero, + &event, + &ioStatus); + if (!Irp) + { + /* no memory actually, try later */ + CHECKPOINT; + KeStallExecutionProcessor(10); + continue; + } + + Status = IoCallDriver(LowerDevice, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL); + Status = ioStatus.Status; + } + if (!NT_SUCCESS(Status)) + continue; + + /* Read all available data and process */ + i = 0; + while (i < ioStatus.Information) + { + Queue = DeviceExtension->ActiveQueue % 2; + + Input = &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]]; + + /* Translate current chars to scan codes */ + SpaceInQueue = KEYBOARD_BUFFER_SIZE - DeviceExtension->InputDataCount[Queue]; + if (TranslateCharToScanCodes( + &Buffer[i], /* input buffer */ + ioStatus.Information - i, /* input buffer size */ + Input, /* output buffer */ + &SpaceInQueue, /* output buffer size */ + &BytesConsumed)) /* bytes consumed in input buffer */ + { + DPRINT("Got char 0x%02x (%c)\n", Buffer[i], Buffer[i] >= 32 ? Buffer[i] : ' '); + DeviceExtension->InputDataCount[Queue] += BytesConsumed; + + /* Send the data to the keyboard class driver */ + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + KeInsertQueueDpc(&DeviceExtension->KeyboardDpc, NULL, NULL); + KeLowerIrql(OldIrql); + i += BytesConsumed; + } + else + { + /* TranslateCharToScanCodes failed. Possible reasons: + * - not enough bytes in input buffer (escape control code; wait next received bytes) + * - not enough room in output buffer (wait for the Dpc to empty it) + * + * The best way to resolve this is to try later. + */ + i++; + } + } + } + + PsTerminateSystemThread(STATUS_SUCCESS); +} + +NTSTATUS +KeyboardInternalDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PKEYBOARD_DEVICE_EXTENSION DeviceExtension; + NTSTATUS Status; + + Stack = IoGetCurrentIrpStackLocation(Irp); + Irp->IoStatus.Information = 0; + DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + switch (Stack->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_INTERNAL_KEYBOARD_CONNECT: + { + DPRINT("IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n"); + if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) + { + Status = STATUS_INVALID_PARAMETER; + break; + } + + DeviceExtension->ClassInformation = + *((PCONNECT_DATA)Stack->Parameters.DeviceIoControl.Type3InputBuffer); + + /* Start read loop */ + Status = PsCreateSystemThread( + &DeviceExtension->WorkerThreadHandle, + (ACCESS_MASK)0L, + NULL, + NULL, + NULL, + KeyboardDeviceWorker, + DeviceObject); + break; + } + default: + { + DPRINT("IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n", + Stack->Parameters.DeviceIoControl.IoControlCode); + Status = STATUS_INVALID_DEVICE_REQUEST; + } + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return Status; +} diff --git a/rosapps/green/misc.c b/rosapps/green/misc.c new file mode 100644 index 00000000000..b467146a742 --- /dev/null +++ b/rosapps/green/misc.c @@ -0,0 +1,114 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/misc.c + * PURPOSE: Misceallenous operations + * PROGRAMMERS: Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +NTSTATUS +GreenDeviceIoControl( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG CtlCode, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferSize, + IN OUT PVOID OutputBuffer OPTIONAL, + IN OUT PULONG OutputBufferSize) +{ + KEVENT Event; + PIRP Irp; + IO_STATUS_BLOCK IoStatus; + NTSTATUS Status; + + KeInitializeEvent (&Event, NotificationEvent, FALSE); + + Irp = IoBuildDeviceIoControlRequest(CtlCode, + DeviceObject, + InputBuffer, + InputBufferSize, + OutputBuffer, + (OutputBufferSize) ? *OutputBufferSize : 0, + FALSE, + &Event, + &IoStatus); + if (Irp == NULL) + { + DPRINT("IoBuildDeviceIoControlRequest() failed\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Status = IoCallDriver(DeviceObject, Irp); + + if (Status == STATUS_PENDING) + { + DPRINT("Operation pending\n"); + KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); + Status = IoStatus.Status; + } + + if (OutputBufferSize) + { + *OutputBufferSize = IoStatus.Information; + } + + return Status; +} + +NTSTATUS +ReadRegistryEntries( + IN PUNICODE_STRING RegistryPath, + IN PGREEN_DRIVER_EXTENSION DriverExtension) +{ + UNICODE_STRING ParametersRegistryKey; + RTL_QUERY_REGISTRY_TABLE Parameters[4]; + NTSTATUS Status; + + ULONG DefaultDeviceReported = 0; + ULONG DefaultSampleRate = 1200; + + ParametersRegistryKey.Length = 0; + ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL); + ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength); + if (!ParametersRegistryKey.Buffer) + { + DPRINT("ExAllocatePool() failed\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath); + RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters"); + ParametersRegistryKey.Buffer[ParametersRegistryKey.Length / sizeof(WCHAR)] = UNICODE_NULL; + + RtlZeroMemory(Parameters, sizeof(Parameters)); + + Parameters[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parameters[0].Name = L"AttachedDevice"; + Parameters[0].EntryContext = &DriverExtension->AttachedDeviceName; + + Parameters[1].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_REGISTRY_OPTIONAL; + Parameters[1].Name = L"DeviceReported"; + Parameters[1].EntryContext = &DriverExtension->DeviceReported; + Parameters[1].DefaultType = REG_DWORD; + Parameters[1].DefaultData = &DefaultDeviceReported; + Parameters[1].DefaultLength = sizeof(ULONG); + + Parameters[2].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_REGISTRY_OPTIONAL; + Parameters[2].Name = L"SampleRate"; + Parameters[2].EntryContext = &DriverExtension->SampleRate; + Parameters[2].DefaultType = REG_DWORD; + Parameters[2].DefaultData = &DefaultSampleRate; + Parameters[2].DefaultLength = sizeof(ULONG); + + Status = RtlQueryRegistryValues( + RTL_REGISTRY_ABSOLUTE, + ParametersRegistryKey.Buffer, + Parameters, + NULL, + NULL); + + return Status; +} diff --git a/rosapps/green/pnp.c b/rosapps/green/pnp.c new file mode 100644 index 00000000000..51fce9ec270 --- /dev/null +++ b/rosapps/green/pnp.c @@ -0,0 +1,562 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/pnp.c + * PURPOSE: IRP_MJ_PNP operations + * PROGRAMMERS: Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +static NTSTATUS +CreateGreenFdo( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT GreenPdo) +{ + PGREEN_DRIVER_EXTENSION DriverExtension = NULL; + PGREEN_DEVICE_EXTENSION DeviceExtension = NULL; + OBJECT_ATTRIBUTES ObjectAttributes; + ULONG Fcr; + HANDLE LocalHandle = 0; + ACCESS_MASK DesiredAccess = FILE_ANY_ACCESS; + NTSTATUS Status; + + DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); + + Status = IoCreateDevice( + DriverObject, + sizeof(GREEN_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_TERMSRV, + FILE_DEVICE_SECURE_OPEN, + FALSE, + &DriverExtension->GreenMainDO); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateDevice() failed with status %08lx\n", Status); + goto cleanup; + } + + DeviceExtension = (PGREEN_DEVICE_EXTENSION)DriverExtension->GreenMainDO->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(GREEN_DEVICE_EXTENSION)); + DeviceExtension->Common.Type = GreenFDO; + DriverExtension->GreenMainDO->Flags |= DO_POWER_PAGABLE; + DriverExtension->LowerDevice = IoAttachDeviceToDeviceStack(DriverExtension->GreenMainDO, GreenPdo); + + /* Initialize serial port */ + InitializeObjectAttributes(&ObjectAttributes, &DriverExtension->AttachedDeviceName, OBJ_KERNEL_HANDLE, NULL, NULL); + Status = ObOpenObjectByName( + &ObjectAttributes, + IoFileObjectType, + KernelMode, + NULL, + DesiredAccess, + NULL, + &LocalHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT("ObOpenObjectByName() failed with status %08lx\n", Status); + goto cleanup; + } + Status = ObReferenceObjectByHandle( + LocalHandle, + DesiredAccess, + NULL, + KernelMode, + (PVOID*)&DeviceExtension->Serial, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("ObReferenceObjectByHandle() failed with status %08lx\n", Status); + goto cleanup; + } + Fcr = 0; + Status = GreenDeviceIoControl(DeviceExtension->Serial, IOCTL_SERIAL_SET_FIFO_CONTROL, + &Fcr, sizeof(Fcr), NULL, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("GreenDeviceIoControl() failed with status %08lx\n", Status); + goto cleanup; + } + Status = GreenDeviceIoControl(DeviceExtension->Serial, IOCTL_SERIAL_SET_BAUD_RATE, + &DriverExtension->SampleRate, sizeof(DriverExtension->SampleRate), NULL, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("GreenDeviceIoControl() failed with status %08lx\n", Status); + goto cleanup; + } + DeviceExtension->LineControl.WordLength = 8; + DeviceExtension->LineControl.Parity = NO_PARITY; + DeviceExtension->LineControl.StopBits = STOP_BIT_1; + Status = GreenDeviceIoControl(DeviceExtension->Serial, IOCTL_SERIAL_SET_LINE_CONTROL, + &DeviceExtension->LineControl, sizeof(SERIAL_LINE_CONTROL), NULL, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("GreenDeviceIoControl() failed with status %08lx\n", Status); + goto cleanup; + } + RtlZeroMemory(&DeviceExtension->Timeouts, sizeof(SERIAL_TIMEOUTS)); + DeviceExtension->Timeouts.ReadIntervalTimeout = 100; + Status = GreenDeviceIoControl(DeviceExtension->Serial, IOCTL_SERIAL_SET_TIMEOUTS, + &DeviceExtension->Timeouts, sizeof(SERIAL_TIMEOUTS), NULL, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("GreenDeviceIoControl() failed with status %08lx\n", Status); + goto cleanup; + } + + DriverExtension->GreenMainDO->Flags |= DO_BUFFERED_IO; + DriverExtension->GreenMainDO->Flags &= ~DO_DEVICE_INITIALIZING; + + Status = STATUS_SUCCESS; + +cleanup: + if (LocalHandle != 0) + ZwClose(LocalHandle); + if (!NT_SUCCESS(Status)) + { + if (DeviceExtension && DeviceExtension->Serial) + ObDereferenceObject(DeviceExtension->Serial); + if (DriverExtension) + { + if (DriverExtension->LowerDevice) + { + IoDetachDevice(DriverExtension->LowerDevice); + DriverExtension->LowerDevice = NULL; + } + if (DriverExtension->GreenMainDO) + { + IoDeleteDevice(DriverExtension->GreenMainDO); + DriverExtension->GreenMainDO = NULL; + } + } + } + return Status; +} + +static NTSTATUS +ReportGreenPdo( + IN PDRIVER_OBJECT DriverObject, + IN PGREEN_DRIVER_EXTENSION DriverExtension) +{ + PDEVICE_OBJECT GreenPdo = NULL; + NTSTATUS Status; + + /* Create green PDO */ + Status = IoReportDetectedDevice( + DriverObject, + InterfaceTypeUndefined, -1, -1, + NULL, NULL, TRUE, + &GreenPdo); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoReportDetectedDevice() failed with status 0x%lx\n", Status); + goto cleanup; + } + + /* Create green FDO */ + Status = CreateGreenFdo(DriverObject, GreenPdo); + + IoInvalidateDeviceRelations(GreenPdo, BusRelations); + + /* FIXME: Update registry, set "DeviceReported" to 1 */ + + Status = STATUS_SUCCESS; + +cleanup: + if (!NT_SUCCESS(Status)) + { + if (DriverExtension->GreenMainDO) + IoDeleteDevice(DriverExtension->GreenMainDO); + } + return Status; +} + +NTSTATUS NTAPI +GreenAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo) +{ + PGREEN_DRIVER_EXTENSION DriverExtension; + + DPRINT("AddDevice(DriverObject %p, Pdo %p)\n", DriverObject, Pdo); + + DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); + + if (Pdo == NULL) + { + if (DriverExtension->DeviceReported) + /* Green Pdo has already been reported during a previous boot. + * We will get another AddDevice call soon. + */ + return STATUS_SUCCESS; + else + return ReportGreenPdo(DriverObject, DriverExtension); + } + else if (DriverExtension->GreenMainDO == NULL) + { + return CreateGreenFdo(DriverObject, Pdo); + } + else + { + PGREEN_DEVICE_EXTENSION GreenDeviceExtension; + + GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DriverExtension->GreenMainDO->DeviceExtension; + if (Pdo == GreenDeviceExtension->KeyboardPdo) + return KeyboardAddDevice(DriverObject, Pdo); + else if (Pdo == GreenDeviceExtension->ScreenPdo) + return ScreenAddDevice(DriverObject, Pdo); + else + /* Strange PDO. We don't know it */ + ASSERT(FALSE); + return STATUS_UNSUCCESSFUL; + } +} + +static NTSTATUS +GreenQueryBusRelations( + IN PDEVICE_OBJECT DeviceObject, + OUT PDEVICE_RELATIONS* pDeviceRelations) +{ + PGREEN_DEVICE_EXTENSION DeviceExtension; + PDEVICE_RELATIONS DeviceRelations = NULL; + NTSTATUS Status; + + DeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + /* Create PDOs for keyboard and screen */ + if (DeviceExtension->KeyboardPdo == NULL) + { + Status = IoCreateDevice( + DeviceObject->DriverObject, + sizeof(COMMON_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_KEYBOARD, + FILE_AUTOGENERATED_DEVICE_NAME | FILE_DEVICE_SECURE_OPEN, + FALSE, + &DeviceExtension->KeyboardPdo); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateDevice() failed with status 0x%lx\n", Status); + goto cleanup; + } + ((PCOMMON_DEVICE_EXTENSION)DeviceExtension->KeyboardPdo->DeviceExtension)->Type = KeyboardPDO; + DeviceExtension->KeyboardPdo->Flags |= DO_POWER_PAGABLE | DO_BUS_ENUMERATED_DEVICE; + DeviceExtension->KeyboardPdo->Flags &= ~DO_DEVICE_INITIALIZING; + } + + if (DeviceExtension->ScreenPdo == NULL) + { + Status = IoCreateDevice( + DeviceObject->DriverObject, + sizeof(COMMON_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_SCREEN, + FILE_AUTOGENERATED_DEVICE_NAME | FILE_DEVICE_SECURE_OPEN, + FALSE, + &DeviceExtension->ScreenPdo); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateDevice() failed with status 0x%lx\n", Status); + goto cleanup; + } + ((PCOMMON_DEVICE_EXTENSION)DeviceExtension->ScreenPdo->DeviceExtension)->Type = ScreenPDO; + DeviceExtension->ScreenPdo->Flags |= DO_POWER_PAGABLE | DO_BUS_ENUMERATED_DEVICE; + DeviceExtension->ScreenPdo->Flags &= ~DO_DEVICE_INITIALIZING; + } + + /* Allocate return structure */ + DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool( + PagedPool, + FIELD_OFFSET(DEVICE_RELATIONS, Objects) + 2 * sizeof(PDEVICE_OBJECT)); + if (!DeviceRelations) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Fill return structure */ + DeviceRelations->Count = 2; + ObReferenceObject(DeviceExtension->KeyboardPdo); + ObReferenceObject(DeviceExtension->ScreenPdo); + DeviceRelations->Objects[0] = DeviceExtension->KeyboardPdo; + DeviceRelations->Objects[1] = DeviceExtension->ScreenPdo; + + *pDeviceRelations = DeviceRelations; + Status = STATUS_SUCCESS; + +cleanup: + if (!NT_SUCCESS(Status)) + { + if (DeviceRelations) + { + ULONG i; + for (i = 0; i < DeviceRelations->Count; i++) + ObDereferenceObject(DeviceRelations->Objects[i]); + ExFreePool(DeviceRelations); + } + if (DeviceExtension->KeyboardPdo) + { + IoDeleteDevice(DeviceExtension->KeyboardPdo); + DeviceExtension->KeyboardPdo = NULL; + } + if (DeviceExtension->ScreenPdo) + { + IoDeleteDevice(DeviceExtension->ScreenPdo); + DeviceExtension->ScreenPdo = NULL; + } + } + return Status; +} + +static NTSTATUS +GreenQueryId( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + OUT ULONG_PTR* Information) +{ + GREEN_DEVICE_TYPE Type; + ULONG IdType; + NTSTATUS Status = Irp->IoStatus.Status; + + Type = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; + IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType; + + switch (IdType) + { + case BusQueryDeviceID: + { + LPCWSTR Source = NULL; + + if (Type == ScreenPDO) + Source = L"GREEN\\SCREEN"; + else if (Type == KeyboardPDO) + Source = L"GREEN\\KEYBOARD"; + else + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceId / Unknown type 0x%lx\n", + Type); + ASSERT(FALSE); + } + + if (Source) + { + UNICODE_STRING SourceU, String; + RtlInitUnicodeString(&SourceU, Source); + Status = RtlDuplicateUnicodeString( + RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, + &SourceU, + &String); + *Information = (ULONG_PTR)String.Buffer; + } + break; + } + case BusQueryHardwareIDs: + { + UNICODE_STRING SourceU = { 0, }; + + if (Type == ScreenPDO) + { + RtlInitUnicodeString(&SourceU, L"GREEN\\SCREEN\0"); + /* We can add the two \0 that are at the end of the string */ + SourceU.Length = SourceU.MaximumLength = SourceU.Length + 2 * sizeof(WCHAR); + } + else if (Type == KeyboardPDO) + { + RtlInitUnicodeString(&SourceU, L"GREEN\\KEYBOARD\0"); + /* We can add the two \0 that are at the end of the string */ + SourceU.Length = SourceU.MaximumLength = SourceU.Length + 2 * sizeof(WCHAR); + } + else + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs / Unknown type 0x%lx\n", + Type); + ASSERT(FALSE); + } + + if (SourceU.Length) + { + UNICODE_STRING String; + Status = RtlDuplicateUnicodeString( + RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, + &SourceU, + &String); + *Information = (ULONG_PTR)String.Buffer; + } + break; + } + case BusQueryCompatibleIDs: + { + /* We don't have any compatible ID */ + break; + } + case BusQueryInstanceID: + { + /* We don't have any instance ID */ + break; + } + default: + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType); + } + } + + return Status; +} + +NTSTATUS +GreenPnp( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + GREEN_DEVICE_TYPE Type; + PIO_STACK_LOCATION Stack; + ULONG_PTR Information = Irp->IoStatus.Information; + NTSTATUS Status = Irp->IoStatus.Status; + + Type = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; + Stack = IoGetCurrentIrpStackLocation(Irp); + + switch (Stack->MinorFunction) + { + case IRP_MN_START_DEVICE: /* 0x00 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); + if (Type == GreenFDO || Type == KeyboardPDO || Type == ScreenPDO) + Status = STATUS_SUCCESS; + else + { + DPRINT1("IRP_MJ_PNP / IRP_MN_START_DEVICE / Unknown type 0x%lx\n", + Type); + ASSERT(FALSE); + } + break; + } + case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS\n"); + switch (Stack->Parameters.QueryDeviceRelations.Type) + { + case BusRelations: + { + if (Type == GreenFDO) + { + PDEVICE_RELATIONS DeviceRelations = NULL; + Status = GreenQueryBusRelations(DeviceObject, &DeviceRelations); + Information = (ULONG_PTR)DeviceRelations; + } + else if (Type == KeyboardPDO || Type == ScreenPDO) + { + PDEVICE_RELATIONS DeviceRelations = NULL; + DeviceRelations = ExAllocatePool(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS, Objects)); + if (!DeviceRelations) + Status = STATUS_INSUFFICIENT_RESOURCES; + else + { + DeviceRelations->Count = 0; + Status = STATUS_SUCCESS; + Information = (ULONG_PTR)DeviceRelations; + } + } + else + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations / Unknown type 0x%lx\n", + Type); + ASSERT(FALSE); + } + break; + } + default: + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", + Stack->Parameters.QueryDeviceRelations.Type); + break; + } + } + break; + } + case IRP_MN_QUERY_RESOURCES: /* 0x0a */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n"); + /* We don't need resources */ + break; + } + case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0x0b */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n"); + /* We don't need resources */ + break; + } + case IRP_MN_QUERY_DEVICE_TEXT: /* 0x0c */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT\n"); + switch (Stack->Parameters.QueryDeviceText.DeviceTextType) + { + case DeviceTextDescription: + { + LPCWSTR Description = NULL; + if (Type == GreenFDO) + Description = L"Green device"; + else if (Type == ScreenPDO) + Description = L"Green screen"; + else if (Type == KeyboardPDO) + Description = L"Green keyboard"; + + if (Description != NULL) + { + LPWSTR Destination = ExAllocatePool(PagedPool, wcslen(Description) * sizeof(WCHAR) + sizeof(UNICODE_NULL)); + if (!Destination) + Status = STATUS_INSUFFICIENT_RESOURCES; + else + { + wcscpy(Destination, Description); + Information = (ULONG_PTR)Description; + Status = STATUS_SUCCESS; + } + } + else + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription / Unknown type 0x%lx\n", + Type); + ASSERT(FALSE); + } + break; + } + case DeviceTextLocationInformation: + { + /* We don't have any text location to report, + * and this query is optional, so ignore it. + */ + break; + } + default: + { + DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n", + Stack->Parameters.QueryDeviceText.DeviceTextType); + ASSERT(FALSE); + break; + } + } + break; + } + case IRP_MN_QUERY_ID: /* 0x13 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID\n"); + Status = GreenQueryId(DeviceObject, Irp, &Information); + break; + } + default: + { + DPRINT1("IRP_MJ_PNP / unknown minor function 0x%lx\n", Stack->MinorFunction); + break; + } + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = Information; + if (Status != STATUS_PENDING) + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + diff --git a/rosapps/green/power.c b/rosapps/green/power.c new file mode 100644 index 00000000000..b4a7cb5b182 --- /dev/null +++ b/rosapps/green/power.c @@ -0,0 +1,58 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/power.c + * PURPOSE: IRP_MJ_POWER operations + * PROGRAMMERS: Copyright 2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +NTSTATUS +GreenPower( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + GREEN_DEVICE_TYPE Type; + PIO_STACK_LOCATION Stack; + ULONG_PTR Information = Irp->IoStatus.Information; + NTSTATUS Status = Irp->IoStatus.Status; + + Type = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; + Stack = IoGetCurrentIrpStackLocation(Irp); + + switch (Stack->MinorFunction) + { + case IRP_MN_SET_POWER: /* 0x02 */ + { + DPRINT("IRP_MJ_POWER / IRP_MN_SET_POWER\n"); + if (Type == GreenFDO) + { + PoStartNextPowerIrp(Irp); + Status = STATUS_SUCCESS; + } + else + { + DPRINT1("IRP_MJ_POWER / IRP_MN_SET_POWER / Unknown type 0x%lx\n", + Type); + ASSERT(FALSE); + } + break; + } + default: + { + DPRINT1("IRP_MJ_POWER / unknown minor function 0x%lx\n", Stack->MinorFunction); + break; + } + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = Information; + if (Status != STATUS_PENDING) + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} diff --git a/rosapps/green/screen.c b/rosapps/green/screen.c new file mode 100644 index 00000000000..6851442d45b --- /dev/null +++ b/rosapps/green/screen.c @@ -0,0 +1,674 @@ +/* + * PROJECT: ReactOS VT100 emulator + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/base/green/screen.c + * PURPOSE: IRP_MJ_PNP operations + * PROGRAMMERS: Copyright 2005 Eric Kohl (ekohl@abo.rhein-zeitung.de) + * Copyright 2005 Art Yerkes + * Copyright 2005-2006 Herv Poussineau (hpoussin@reactos.org) + */ + +#include "green.h" + +#define NDEBUG +#include + +#define ESC ((UCHAR)0x1b) + +/* Force a move of the cursor on each printer char. + * Very useful for debug, but it is very slow... + */ +//#define FORCE_POSITION + +/* UCHAR is promoted to int when passed through '...', + * so we get int with va_arg and cast them back to UCHAR. + */ +static VOID +AddToSendBuffer( + IN PSCREEN_DEVICE_EXTENSION DeviceExtension, + IN ULONG NumberOfChars, + ... /* IN int */) +{ + PIRP Irp; + IO_STATUS_BLOCK ioStatus; + va_list args; + PDEVICE_OBJECT SerialDevice; + ULONG SizeLeft; + int CurrentInt; + UCHAR CurrentChar; + NTSTATUS Status; + LARGE_INTEGER ZeroOffset; + + ZeroOffset.QuadPart = 0; + + SizeLeft = sizeof(DeviceExtension->SendBuffer) - DeviceExtension->SendBufferPosition; + if (SizeLeft < NumberOfChars * 2 || NumberOfChars == 0) + { + SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial; + Irp = IoBuildSynchronousFsdRequest( + IRP_MJ_WRITE, + SerialDevice, + DeviceExtension->SendBuffer, DeviceExtension->SendBufferPosition, + &ZeroOffset, + NULL, /* Event */ + &ioStatus); + if (!Irp) + { + DPRINT1("IoBuildSynchronousFsdRequest() failed. Unable to flush output buffer\n"); + return; + } + + Status = IoCallDriver(SerialDevice, Irp); + + if (!NT_SUCCESS(Status) && Status != STATUS_PENDING) + { + DPRINT1("IoCallDriver() failed. Status = 0x%08lx\n", Status); + return; + } + DeviceExtension->SendBufferPosition = 0; + SizeLeft = sizeof(DeviceExtension->SendBuffer); + } + + va_start(args, NumberOfChars); + while (NumberOfChars-- > 0) + { + CurrentInt = va_arg(args, int); + + if (CurrentInt > 0) + { + CurrentChar = (UCHAR)CurrentInt; + + /* Why 0xff chars are printed on a 'dir' ? */ + if (CurrentChar == 0xff) CurrentChar = ' '; + + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = CurrentChar; + SizeLeft--; + } + else if (CurrentInt == 0) + { + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = '0'; + SizeLeft--; + } + else + { + CurrentInt = -CurrentInt; + ASSERT(CurrentInt < 100); + if (CurrentInt >= 10) + { + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = + (CurrentInt / 10) % 10 + '0'; + SizeLeft--; + } + DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = + CurrentInt % 10 + '0'; + SizeLeft--; + } + } + va_end(args); +} + +NTSTATUS +ScreenAddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT Pdo) +{ + /* We want to be an upper filter of Blue, if it is existing. + * We also *have to* create a Fdo on top of the given Pdo. + * Hence, we have 2 cases: + * - Blue doesn't exist -> Create a unique Fdo (named Blue) at + * the top of the given Pdo + * - Blue does exist -> Create a Fdo at the top of the existing + * DO, and create a "pass to Green" FDO at the top of the Pdo + */ + PDEVICE_OBJECT Fdo = NULL; + PDEVICE_OBJECT PassThroughFdo = NULL; + PDEVICE_OBJECT LowerDevice = NULL; + PDEVICE_OBJECT PreviousBlue = NULL; + PSCREEN_DEVICE_EXTENSION DeviceExtension = NULL; + UNICODE_STRING BlueScreenName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen"); + NTSTATUS Status; + + DPRINT("ScreenInitialize() called\n"); + + /* Try to create a unique Fdo */ + Status = IoCreateDevice( + DriverObject, + sizeof(SCREEN_DEVICE_EXTENSION), + &BlueScreenName, + FILE_DEVICE_SCREEN, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + + if (Status == STATUS_OBJECT_NAME_COLLISION) + { + DPRINT("Attaching to old blue\n"); + + /* Suggested by hpoussin .. Hide previous blue device + * This makes us able to coexist with blue, and install + * when loaded */ + Status = IoCreateDevice( + DriverObject, + sizeof(SCREEN_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_SCREEN, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &Fdo); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateDevice() failed with status 0x%08lx\n", Status); + goto cleanup; + } + + /* Initialize some fields, as IoAttachDevice will trigger the + * sending of IRP_MJ_CLEANUP/IRP_MJ_CLOSE. We have to know where to + * dispatch these IRPs... */ + ((PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension)->Common.Type = ScreenPDO; + Status = IoAttachDevice( + Fdo, + &BlueScreenName, + &LowerDevice); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoAttachDevice() failed with status 0x%08lx\n", Status); + goto cleanup; + } + PreviousBlue = LowerDevice; + + /* Attach a faked FDO to PDO */ + Status = IoCreateDevice( + DriverObject, + sizeof(COMMON_FDO_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_SCREEN, + FILE_DEVICE_SECURE_OPEN, + TRUE, + &PassThroughFdo); + if (!NT_SUCCESS(Status)) + { + DPRINT("IoCreateDevice() failed with status 0x%08lx\n", Status); + goto cleanup; + } + ((PCOMMON_FDO_DEVICE_EXTENSION)PassThroughFdo->DeviceExtension)->Type = PassThroughFDO; + ((PCOMMON_FDO_DEVICE_EXTENSION)PassThroughFdo->DeviceExtension)->LowerDevice = Fdo; + PassThroughFdo->StackSize = Fdo->StackSize + 1; + } + else if (NT_SUCCESS(Status)) + { + /* Attach the named Fdo on top of Pdo */ + LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo); + } + else + { + DPRINT("IoCreateDevice() failed with status 0x%08lx\n", Status); + return Status; + } + + /* We definately have a device object. PreviousBlue may or may + * not be null */ + DeviceExtension = (PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension; + RtlZeroMemory(DeviceExtension, sizeof(SCREEN_DEVICE_EXTENSION)); + DeviceExtension->Common.Type = ScreenFDO; + DeviceExtension->Common.LowerDevice = LowerDevice; + DeviceExtension->Green = ((PGREEN_DRIVER_EXTENSION)IoGetDriverObjectExtension(DriverObject, DriverObject))->GreenMainDO; + ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->ScreenFdo = Fdo; + DeviceExtension->PreviousBlue = PreviousBlue; + IoAttachDeviceToDeviceStack(PassThroughFdo ? PassThroughFdo : Fdo, Pdo); + + /* initialize screen */ + DeviceExtension->Columns = 80; + DeviceExtension->Rows = 25; + DeviceExtension->ScanLines = 16; + DeviceExtension->VideoMemory = (PUCHAR)ExAllocatePool( + PagedPool, + 2 * DeviceExtension->Columns * DeviceExtension->Rows * sizeof(UCHAR)); + if (!DeviceExtension->VideoMemory) + { + DPRINT("ExAllocatePool() failed\n"); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto cleanup; + } + DeviceExtension->TabWidth = 8; + + /* more initialization */ + DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT | + ENABLE_WRAP_AT_EOL_OUTPUT; + + /* initialize screen at next write */ + AddToSendBuffer(DeviceExtension, 2, ESC, 'c'); /* reset device */ + AddToSendBuffer(DeviceExtension, 4, ESC, '[', '7', 'l'); /* disable line wrap */ + AddToSendBuffer(DeviceExtension, 4, ESC, '[', '3', 'g'); /* clear all tabs */ + + Fdo->Flags |= DO_POWER_PAGABLE; + Fdo->Flags &= ~DO_DEVICE_INITIALIZING; + + Status = STATUS_SUCCESS; + +cleanup: + if (!NT_SUCCESS(Status)) + { + if (DeviceExtension) + ExFreePool(DeviceExtension->VideoMemory); + if (LowerDevice) + IoDetachDevice(LowerDevice); + if (Fdo) + IoDeleteDevice(Fdo); + if (PassThroughFdo) + IoDeleteDevice(PassThroughFdo); + } + + return Status; +} + +NTSTATUS +ScreenWrite( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PUCHAR Buffer; + PSCREEN_DEVICE_EXTENSION DeviceExtension; + PDEVICE_OBJECT SerialDevice; + PUCHAR VideoMemory; /* FIXME: is it useful? */ + ULONG VideoMemorySize; /* FIXME: is it useful? */ + + ULONG Columns, Rows; + ULONG CursorX, CursorY; + ULONG i, j; + + DPRINT("ScreenWrite() called\n"); + + Stack = IoGetCurrentIrpStackLocation (Irp); + Buffer = Irp->UserBuffer; + DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + VideoMemory = DeviceExtension->VideoMemory; + + SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial; + if (!SerialDevice) + { + DPRINT1("Calling blue\n"); + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DeviceExtension->PreviousBlue, Irp); + } + + Columns = DeviceExtension->Columns; + Rows = DeviceExtension->Rows; + CursorX = (DeviceExtension->LogicalOffset / 2) % Columns + 1; + CursorY = (DeviceExtension->LogicalOffset / 2) / Columns + 1; + VideoMemorySize = Columns * Rows * 2 * sizeof(UCHAR); + + if (!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT)) + { + /* raw output mode */ + CHECKPOINT; + Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + + return STATUS_NOT_SUPPORTED; + } + else + { + for (i = 0; i < Stack->Parameters.Write.Length; i++, Buffer++) + { + switch (*Buffer) + { + case '\b': + { + if (CursorX > 1) + { + CursorX--; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + AddToSendBuffer(DeviceExtension, 1, ' '); + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + } + else if (CursorY > 1) + { + CursorX = Columns; + CursorY--; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + } + break; + } + case '\n': + { + CursorY++; + CursorX = 1; + AddToSendBuffer(DeviceExtension, 1, '\n'); + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H'); + break; + } + case '\r': + { + if (CursorX > 1) + { + AddToSendBuffer(DeviceExtension, 4, ESC, '[', -(int)(CursorX-1), 'D'); + CursorX = 1; + } + break; + } + case '\t': + { + ULONG Offset = DeviceExtension->TabWidth - (CursorX % DeviceExtension->TabWidth); + for (j = 0; j < Offset; j++) + { +#ifdef FORCE_POSITION + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); +#endif + AddToSendBuffer(DeviceExtension, 1, ' '); + CursorX++; + if (CursorX > Columns) + { + CursorX = 1; + CursorY++; + } + } + break; + } + default: + { +#ifdef FORCE_POSITION + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); +#endif + AddToSendBuffer(DeviceExtension, 1, *Buffer); + CursorX++; + if (CursorX > Columns) + { + CursorX = 1; + DPRINT("Y: %lu -> %lu\n", CursorY, CursorY + 1); + CursorY++; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H'); + + } + } + } + if (CursorY >= Rows) + { + DPRINT("Y: %lu -> %lu\n", CursorY, CursorY - 1); + CursorY--; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)1, ';', -(int)(Rows), 'r'); + AddToSendBuffer(DeviceExtension, 2, ESC, 'D'); + AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H'); + } + } + } + + DeviceExtension->LogicalOffset = ((CursorX-1) + (CursorY-1) * Columns) * 2; + + /* flush output buffer */ + AddToSendBuffer(DeviceExtension, 0); + + /* Call lower driver */ + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DeviceExtension->Common.LowerDevice, Irp); +} + +NTSTATUS +ScreenDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION Stack; + PSCREEN_DEVICE_EXTENSION DeviceExtension; + PDEVICE_OBJECT SerialDevice; + NTSTATUS Status; + + Stack = IoGetCurrentIrpStackLocation(Irp); + DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial; + if (!SerialDevice) + { + DPRINT1("Calling blue\n"); + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DeviceExtension->PreviousBlue, Irp); + } + + switch (Stack->Parameters.DeviceIoControl.IoControlCode) + { +#if 0 + case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO: + { + PCONSOLE_SCREEN_BUFFER_INFO pcsbi; + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO\n"); + + pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer; + + pcsbi->dwSize.X = DeviceExtension->Columns; + pcsbi->dwSize.Y = DeviceExtension->Rows; + + pcsbi->dwCursorPosition.X = (SHORT)(DeviceExtension->LogicalOffset % DeviceExtension->Columns); + pcsbi->dwCursorPosition.Y = (SHORT)(DeviceExtension->LogicalOffset / DeviceExtension->Columns); + + pcsbi->wAttributes = DeviceExtension->CharAttribute; + + pcsbi->srWindow.Left = 1; + pcsbi->srWindow.Right = DeviceExtension->Columns; + pcsbi->srWindow.Top = 1; + pcsbi->srWindow.Bottom = DeviceExtension->Rows; + + pcsbi->dwMaximumWindowSize.X = DeviceExtension->Columns; + pcsbi->dwMaximumWindowSize.Y = DeviceExtension->Rows; + + Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO); + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO: + { + PCONSOLE_SCREEN_BUFFER_INFO pcsbi; + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO\n"); + + pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer; + /* FIXME: remove */ { pcsbi->dwCursorPosition.X++; } + /* FIXME: remove */ { pcsbi->dwCursorPosition.Y++; } + ASSERT(pcsbi->dwCursorPosition.X >= 1); + ASSERT(pcsbi->dwCursorPosition.Y >= 1); + ASSERT(pcsbi->dwCursorPosition.X <= DeviceExtension->Columns); + ASSERT(pcsbi->dwCursorPosition.Y <= DeviceExtension->Rows); + + DeviceExtension->LogicalOffset = ( + (pcsbi->dwCursorPosition.Y-1) * DeviceExtension->Columns + + (pcsbi->dwCursorPosition.X-1)) * 2; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', + -(int)pcsbi->dwCursorPosition.Y, ';', + -(int)pcsbi->dwCursorPosition.X, 'H'); + + /* flush buffer */ + AddToSendBuffer(DeviceExtension, 0); + + DeviceExtension->CharAttribute = pcsbi->wAttributes; + + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_GET_CURSOR_INFO: + { + PCONSOLE_CURSOR_INFO pcci = (PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer; + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_CURSOR_INFO\n"); + + pcci->dwSize = 1; + pcci->bVisible = TRUE; + + Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO); + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_GET_MODE: + { + PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer; + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_MODE\n"); + + pcm->dwMode = DeviceExtension->Mode; + + Irp->IoStatus.Information = sizeof(CONSOLE_MODE); + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_SET_MODE: + { + PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer; + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_MODE\n"); + + DeviceExtension->Mode = pcm->dwMode; + + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE */ + break; + } + case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE */ + break; + } + case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE */ + break; + } + case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE: + { + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE\n"); + + DeviceExtension->CharAttribute = (WORD)*(PWORD)Irp->AssociatedIrp.SystemBuffer; + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } + case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME:IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER */ + break; + } + case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_CHARACTER\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_CHARACTER */ + break; + } + case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER\n"); + Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER */ + break; + } + case IOCTL_CONSOLE_DRAW: + { + PCONSOLE_DRAW ConsoleDraw; + PUCHAR Video; + ULONG x, y; + BOOLEAN DoOptimization = FALSE; + DPRINT("IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_DRAW\n"); + + ConsoleDraw = (PCONSOLE_DRAW)MmGetSystemAddressForMdl(Irp->MdlAddress); + /* FIXME: remove */ { ConsoleDraw->X++; ConsoleDraw->CursorX++; } + /* FIXME: remove */ { ConsoleDraw->Y++; ConsoleDraw->CursorY++; } + DPRINT1("%lu %lu %lu %lu\n", + ConsoleDraw->X, ConsoleDraw->Y, + ConsoleDraw->SizeX, ConsoleDraw->SizeY); + ASSERT(ConsoleDraw->X >= 1); + ASSERT(ConsoleDraw->Y >= 1); + ASSERT(ConsoleDraw->X <= DeviceExtension->Columns); + ASSERT(ConsoleDraw->Y <= DeviceExtension->Rows); + ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX >= 1); + ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY >= 1); + ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX - 1 <= DeviceExtension->Columns); + ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY - 1 <= DeviceExtension->Rows); + ASSERT(ConsoleDraw->CursorX >= 1); + ASSERT(ConsoleDraw->CursorY >= 1); + ASSERT(ConsoleDraw->CursorX <= DeviceExtension->Columns); + ASSERT(ConsoleDraw->CursorY <= DeviceExtension->Rows); + +#if 0 + if (ConsoleDraw->X == 1 + && ConsoleDraw->Y == 1 + && ConsoleDraw->SizeX == DeviceExtension->Columns + && ConsoleDraw->SizeY == DeviceExtension->Rows) + { + CHECKPOINT1; + /* search if we need to clear all screen */ + DoOptimization = TRUE; + Video = (PUCHAR)(ConsoleDraw + 1); + x = 0; + while (DoOptimization && x < DeviceExtension->Columns * DeviceExtension->Rows) + { + if (Video[x++] != ' ') + { + CHECKPOINT1; + DoOptimization = FALSE; + } + /*if (Video[x++] != DeviceExtension->CharAttribute) DoOptimization = FALSE; */ + } + if (DoOptimization) + { + CHECKPOINT1; + AddToSendBuffer(DeviceExtension, 4, ESC, '[', '2', 'J'); + } + } +#endif + /* add here more optimizations if needed */ + + if (!DoOptimization) + { + for (y = 0; y < ConsoleDraw->SizeY; y++) + { + AddToSendBuffer(DeviceExtension, 6, ESC, '[', + -(int)(ConsoleDraw->Y + y), ';', + -(int)(ConsoleDraw->X), 'H'); + Video = (PUCHAR)(ConsoleDraw + 1); + Video = &Video[((ConsoleDraw->Y + y) * /*DeviceExtension->Columns +*/ ConsoleDraw->X) * 2]; + for (x = 0; x < ConsoleDraw->SizeX; x++) + { + AddToSendBuffer(DeviceExtension, 1, Video[x * 2]); + } + } + } + + DeviceExtension->LogicalOffset = ( + (ConsoleDraw->CursorY-1) * DeviceExtension->Columns + + (ConsoleDraw->CursorX-1)) * 2; + AddToSendBuffer(DeviceExtension, 6, ESC, '[', + -(int)(ConsoleDraw->CursorY), ';', + -(int)(ConsoleDraw->CursorX), 'H'); + + /* flush buffer */ + AddToSendBuffer(DeviceExtension, 0); + + Irp->IoStatus.Information = 0; + Status = STATUS_SUCCESS; + break; + } +#endif + default: + { + DPRINT1("IRP_MJ_DEVICE_CONTROL / unknown ioctl code 0x%lx\n", + Stack->Parameters.DeviceIoControl.IoControlCode); + /* Call lower driver */ + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DeviceExtension->Common.LowerDevice, Irp); + } + } + + if (!NT_SUCCESS(Status)) + { + /* Don't call blue (if any), as we encountered an error */ + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } + else + { + /* Call lower driver */ + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DeviceExtension->Common.LowerDevice, Irp); + } +} diff --git a/rosapps/imagesoft/about.c b/rosapps/imagesoft/about.c new file mode 100644 index 00000000000..a53af44d64e --- /dev/null +++ b/rosapps/imagesoft/about.c @@ -0,0 +1,54 @@ +#include + +INT_PTR CALLBACK +AboutDialogProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + HWND hLicenseEditWnd; + HICON hIcon = NULL; + TCHAR strLicense[700]; + + switch (message) + { + case WM_INITDIALOG: + + hIcon = (HICON) LoadImage(hInstance, + MAKEINTRESOURCE(IDI_IMAGESOFTICON), + IMAGE_ICON, + 16, + 16, + 0); + + SendMessage(hDlg, + WM_SETICON, + ICON_SMALL, + (LPARAM)hIcon); + + hLicenseEditWnd = GetDlgItem(hDlg, + IDC_LICENSE_EDIT); + + LoadString(hInstance, + IDS_LICENSE, + strLicense, + sizeof(strLicense) / sizeof(TCHAR)); + + SetWindowText(hLicenseEditWnd, + strLicense); + return TRUE; + + case WM_COMMAND: + if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) + { + DestroyIcon(hIcon); + EndDialog(hDlg, + LOWORD(wParam)); + return TRUE; + } + + break; + } + + return FALSE; +} diff --git a/rosapps/imagesoft/adjust.c b/rosapps/imagesoft/adjust.c new file mode 100644 index 00000000000..da58637e48a --- /dev/null +++ b/rosapps/imagesoft/adjust.c @@ -0,0 +1,525 @@ +#include + + +BOOL +DisplayBlackAndWhite(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap) +{ + BITMAPINFO bi; + BITMAP bitmap; + BOOL bRes; + DWORD Count = 0; + INT i, j; + PBYTE pBits; + RECT rc; + + GetObject(hBitmap, + sizeof(BITMAP), + &bitmap); + + /* Bitmap header */ + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = bitmap.bmWidth; + bi.bmiHeader.biHeight = bitmap.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + /* Buffer */ + pBits = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + if (!pBits) + return FALSE; + + /* get the bits from the original bitmap */ + bRes = GetDIBits(hdcMem, + hBitmap, + 0, + bitmap.bmHeight, + pBits, + &bi, + DIB_RGB_COLORS); + + for (i = 0; i < bitmap.bmHeight; i++) + { + for (j = 0; j < bitmap.bmWidth; j++) + { + DWORD Val = 0; + INT b, g, r; + + CopyMemory(&Val, + &pBits[Count], + 4); + + /* Get pixels in reverse order */ + b = GetRValue(Val); + g = GetGValue(Val); + r = GetBValue(Val); + + /* get the average color value */ + Val = (r + g + b) / 3; + + /* assign to RGB color */ + Val = RGB(Val, Val, Val); + CopyMemory(&pBits[Count], + &Val, + 4); + + Count+=4; + } + } + + /* Set the new pixel bits */ + SetDIBits(hdcMem, + hBitmap, + 0, + bRes, + pBits, + &bi, + DIB_RGB_COLORS); + + HeapFree(ProcessHeap, + 0, + pBits); + + GetClientRect(hwnd, + &rc); + + InvalidateRect(hwnd, + &rc, + FALSE); + + return TRUE; +} + + +BOOL +DisplayInvertedColors(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap) +{ + BITMAPINFO bi; + BITMAP bitmap; + BOOL bRes; + DWORD Count = 0; + INT i, j; + PBYTE pBits; + RECT rc; + + GetObject(hBitmap, + sizeof(BITMAP), + &bitmap); + + /* Bitmap header */ + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = bitmap.bmWidth; + bi.bmiHeader.biHeight = bitmap.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + /* Buffer */ + pBits = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + if (!pBits) + return FALSE; + + /* get the bits from the original bitmap */ + bRes = GetDIBits(hdcMem, + hBitmap, + 0, + bitmap.bmHeight, + pBits, + &bi, + DIB_RGB_COLORS); + + for (i = 0; i < bitmap.bmHeight; i++) + { + for (j = 0; j < bitmap.bmWidth; j++) + { + DWORD Val = 0; + INT b, g, r; + + CopyMemory(&Val, + &pBits[Count], + 4); + + b = 255 - GetRValue(Val); + g = 255 - GetGValue(Val); + r = 255 - GetBValue(Val); + + Val = RGB(b, g, r); + + CopyMemory(&pBits[Count], + &Val, + 4); + + Count+=4; + } + } + + /* Set the new pixel bits */ + SetDIBits(hdcMem, + hBitmap, + 0, + bRes, + pBits, + &bi, + DIB_RGB_COLORS); + + HeapFree(ProcessHeap, + 0, + pBits); + + GetClientRect(hwnd, + &rc); + + InvalidateRect(hwnd, + &rc, + FALSE); + + return TRUE; +} + + + +BOOL +DisplayBlur(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap) +{ + BITMAPINFO bi; + BITMAP bitmap; + BOOL bRes; + DWORD Count = 0; + INT i, j; + PBYTE pBits, pBitsTemp; + RECT rc; + + GetObject(hBitmap, + sizeof(BITMAP), + &bitmap); + + /* Bitmap header */ + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = bitmap.bmWidth; + bi.bmiHeader.biHeight = bitmap.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + /* Buffer */ + pBits = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + pBitsTemp = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + if (!pBits || !pBitsTemp) + return FALSE; + + /* get the bits from the original bitmap */ + bRes = GetDIBits(hdcMem, + hBitmap, + 0, + bitmap.bmHeight, + pBits, + &bi, + DIB_RGB_COLORS); + + for (i = 0; i < bitmap.bmHeight; i++) + { + for (j = 0; j < bitmap.bmWidth; j++) + { + LONG Val = 0; + INT b, g, r; + INT c1, c2, c3, c4, c5; + + CopyMemory(&Val, + &pBits[Count], + 4); + + b = GetRValue(Val); + g = GetGValue(Val); + r = GetBValue(Val); + + c1 = r; + /* Red */ + if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) && + (Count > (bitmap.bmWidth * 4lu))) + { + CopyMemory(&Val, &pBits[Count - (bitmap.bmWidth * 4)], 4); + c2 = GetBValue(Val); + + CopyMemory(&Val, &pBits[Count + 4], 4); + c3 = GetBValue(Val); + + CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4))], 4); + c4 = GetBValue(Val); + + CopyMemory(&Val, &pBits[Count - 4], 4); + c5 = GetBValue(Val); + + r = (c1 + c2 + c3 + c4 + c5) / 5; + } + + /* Green */ + c1 = g; + if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) && + (Count > (bitmap.bmWidth * 4lu))) + { + CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4lu))], 4); + c2 = GetGValue(Val); + + CopyMemory(&Val, &pBits[Count + 4], 4); + c3 = GetGValue(Val); + + CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4lu))], 4); + c4 = GetGValue(Val); + + CopyMemory(&Val, &pBits[Count-4], 4); + c5 = GetGValue(Val); + + g = (c1 + c2 + c3 + c4 + c5) / 5; + } + + /* Blue */ + c1 = b; + if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) && + (Count > (bitmap.bmWidth * 4lu))) + { + CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4); + c2 = GetRValue(Val); + + CopyMemory(&Val, &pBits[Count + 4], 4); + c3 = GetRValue(Val); + + CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4l))], 4); + c4 = GetRValue(Val); + + CopyMemory(&Val, &pBits[Count-4], 4); + c5 = GetRValue(Val); + + b = (c1 + c2 + c3 + c4 + c5) / 5; + } + + Val = RGB(b, g, r); + + CopyMemory(&pBitsTemp[Count], + &Val, + 4); + + Count+=4; + } + } + + /* Set the new pixel bits */ + SetDIBits(hdcMem, + hBitmap, + 0, + bRes, + pBitsTemp, + &bi, + DIB_RGB_COLORS); + + HeapFree(ProcessHeap, + 0, + pBits); + HeapFree(ProcessHeap, + 0, + pBitsTemp); + + GetClientRect(hwnd, + &rc); + + InvalidateRect(hwnd, + &rc, + FALSE); + + return TRUE; +} + + + +BOOL +DisplaySharpness(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap) +{ + BITMAPINFO bi; + BITMAP bitmap; + BOOL bRes; + DWORD Count = 0; + INT i, j; + PBYTE pBits, pBitsTemp; + RECT rc; + + GetObject(hBitmap, + sizeof(BITMAP), + &bitmap); + + /* Bitmap header */ + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = bitmap.bmWidth; + bi.bmiHeader.biHeight = bitmap.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + /* Buffer */ + pBits = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + pBitsTemp = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + if (!pBits || !pBitsTemp) + return FALSE; + + /* get the bits from the original bitmap */ + bRes = GetDIBits(hdcMem, + hBitmap, + 0, + bitmap.bmHeight, + pBits, + &bi, + DIB_RGB_COLORS); + + for (i = 0; i < bitmap.bmHeight; i++) + { + for (j = 0; j < bitmap.bmWidth; j++) + { + LONG Val = 0; + INT b, g, r; + INT c1, c2, c3, c4, c5; + + CopyMemory(&Val, + &pBits[Count], + 4); + + b = GetRValue(Val); + g = GetGValue(Val); + r = GetBValue(Val); + + c1 = r; + /* Red */ + if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) && + (Count > (bitmap.bmWidth * 4lu))) + { + CopyMemory(&Val, &pBits[Count - (bitmap.bmWidth * 4l)], 4); + c2 = GetBValue(Val); + + CopyMemory(&Val, &pBits[Count + 4], 4); + c3 = GetBValue(Val); + + CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4l))], 4); + c4 = GetBValue(Val); + + CopyMemory(&Val, &pBits[Count - 4], 4); + c5 = GetBValue(Val); + + r = (c1 * 5) - (c2 + c3 + c4 + c5); + } + + /* Green */ + c1 = g; + if ((Count < ((bitmap.bmHeight - 1)* bitmap.bmWidth * 4lu)) && + (Count > (bitmap.bmWidth * 4lu))) + { + CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4); + c2 = GetGValue(Val); + + CopyMemory(&Val, &pBits[Count + 4], 4); + c3 = GetGValue(Val); + + CopyMemory(&Val, &pBits[(Count + (bitmap.bmWidth * 4l))], 4); + c4 = GetGValue(Val); + + CopyMemory(&Val, &pBits[Count - 4], 4); + c5 = GetGValue(Val); + + g = (c1 * 5) - (c2 + c3 + c4 + c5); + } + + /* Blue */ + c1 = b; + if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) && + (Count > (bitmap.bmWidth * 4lu))) + { + CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4); + c2 = GetRValue(Val); + + CopyMemory(&Val, &pBits[Count + 4], 4); + c3 = GetRValue(Val); + + CopyMemory(&Val, &pBits[(Count+(bitmap.bmWidth * 4l))], 4); + c4 = GetRValue(Val); + + CopyMemory(&Val, &pBits[Count - 4], 4); + c5 = GetRValue(Val); + + b = (c1 * 5) - (c2 + c3 + c4 + c5); + } + + /* Red */ + if (r > 255) r = 255; + if (r < 0) r = 0; + + /* Green */ + if (g > 255) g = 255; + if (g < 0)g = 0; + + /* Blue */ + if (b > 255) b = 255; + if (b < 0) b = 0; + + Val = RGB(b, g, r); + + CopyMemory(&pBitsTemp[Count], + &Val, + 4); + + Count+=4; + } + } + + /* Set the new pixel bits */ + SetDIBits(hdcMem, + hBitmap, + 0, + bRes, + pBitsTemp, + &bi, + DIB_RGB_COLORS); + + HeapFree(ProcessHeap, + 0, + pBits); + HeapFree(ProcessHeap, + 0, + pBitsTemp); + + GetClientRect(hwnd, + &rc); + + InvalidateRect(hwnd, + &rc, + FALSE); + + return TRUE; +} diff --git a/rosapps/imagesoft/brightness.c b/rosapps/imagesoft/brightness.c new file mode 100644 index 00000000000..59b2398f33c --- /dev/null +++ b/rosapps/imagesoft/brightness.c @@ -0,0 +1,379 @@ +#include "precomp.h" + +#define BASECOLOUR 100 + + +VOID +AdjustBrightness(HBITMAP hOrigBitmap, + HBITMAP hNewBitmap, + HWND hwnd, + HDC hdcMem, + INT RedVal, + INT GreenVal, + INT BlueVal) +{ + BITMAPINFO bi; + BITMAP bitmap; + BOOL bRes; + DWORD Count = 0; + INT i, j; + PBYTE pBits; + RECT rc; + + GetObject(hNewBitmap, + sizeof(BITMAP), + &bitmap); + + /* Bitmap header */ + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = bitmap.bmWidth; + bi.bmiHeader.biHeight = bitmap.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + /* Buffer */ + pBits = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + if (!pBits) + return; + + /* get the bits from the original bitmap */ + bRes = GetDIBits(hdcMem, + hOrigBitmap, + 0, + bitmap.bmHeight, + pBits, + &bi, + DIB_RGB_COLORS); + + for (i = 0; i < bitmap.bmHeight; i++) + { + for (j = 0; j < bitmap.bmWidth; j++) + { + DWORD Val = 0; + INT b, g, r; + + CopyMemory(&Val, + &pBits[Count], + 4); + + /* Get pixels in reverse order */ + b = GetRValue(Val); + g = GetGValue(Val); + r = GetBValue(Val); + + /* Red */ + r += RedVal; + if (r > 255) r = 255; + else if (r < 0) r = 0; + + /* Green */ + g += GreenVal; + if (g > 255) g = 255; + else if (g < 0) g = 0; + + /* Blue */ + b += BlueVal; + if (b > 255) b = 255; + else if (b < 0) b = 0; + + /* Store in reverse order */ + Val = RGB(b, g, r); + CopyMemory(&pBits[Count], + &Val, + 4); + + /* RGB color take 4 bytes.The high-order byte must be zero */ + Count += 4; + } + } + + /* Set the new pixel bits */ + SetDIBits(hdcMem, + hNewBitmap, + 0, + bRes, + pBits, + &bi, + DIB_RGB_COLORS); + + HeapFree(ProcessHeap, + 0, + pBits); + + GetClientRect(hwnd, + &rc); + + InvalidateRect(hwnd, + &rc, + FALSE); +} + + +static PIMAGEADJUST +Bri_OnInitDialog(PIMAGEADJUST pImgAdj, + HWND hDlg, + LPARAM lParam) +{ + pImgAdj = (IMAGEADJUST*) HeapAlloc(ProcessHeap, + 0, + sizeof(IMAGEADJUST)); + if (!pImgAdj) + return NULL; + + + pImgAdj->Info = (PMAIN_WND_INFO)lParam; + if (!pImgAdj->Info->ImageEditors) + goto fail; + + + pImgAdj->hPicPrev = GetDlgItem(hDlg, IDC_PICPREVIEW); + GetClientRect(pImgAdj->hPicPrev, + &pImgAdj->ImageRect); + + /* Make a static copy of the main image */ + pImgAdj->hBitmap = (HBITMAP) CopyImage(pImgAdj->Info->ImageEditors->hBitmap, + IMAGE_BITMAP, + pImgAdj->ImageRect.right, + pImgAdj->ImageRect.bottom, + LR_CREATEDIBSECTION); + if (!pImgAdj->hBitmap) + goto fail; + + /* Make a copy which will be updated */ + pImgAdj->hPreviewBitmap = (HBITMAP) CopyImage(pImgAdj->Info->ImageEditors->hBitmap, + IMAGE_BITMAP, + pImgAdj->ImageRect.right, + pImgAdj->ImageRect.bottom, + LR_CREATEDIBSECTION); + if (!pImgAdj->hPreviewBitmap) + goto fail; + + + pImgAdj->RedVal = pImgAdj->BlueVal = pImgAdj->GreenVal = 0; + + /* setup dialog */ + SendDlgItemMessage(hDlg, + IDC_BRI_FULL, + BM_SETCHECK, + BST_CHECKED, + 0); + SendDlgItemMessage(hDlg, + IDC_BRI_TRACKBAR, + TBM_SETRANGE, + TRUE, + (LPARAM)MAKELONG(0, 200)); + SendDlgItemMessage(hDlg, + IDC_BRI_TRACKBAR, + TBM_SETPOS, + TRUE, + (LPARAM)BASECOLOUR); + SetDlgItemText(hDlg, + IDC_BRI_EDIT, + _T("100")); + + return pImgAdj; + +fail: + HeapFree(ProcessHeap, + 0, + pImgAdj); + return NULL; +} + + +static VOID +Bri_OnDrawItem(PIMAGEADJUST pImgAdj, + LPARAM lParam) +{ + LPDRAWITEMSTRUCT lpDrawItem; + HDC hdcMem; + + lpDrawItem = (LPDRAWITEMSTRUCT)lParam; + + hdcMem = CreateCompatibleDC(lpDrawItem->hDC); + + if(lpDrawItem->CtlID == IDC_PICPREVIEW) + { + SelectObject(hdcMem, + pImgAdj->hPreviewBitmap); + + BitBlt(lpDrawItem->hDC, + pImgAdj->ImageRect.left, + pImgAdj->ImageRect.top, + pImgAdj->ImageRect.right, + pImgAdj->ImageRect.bottom, + hdcMem, + 0, + 0, + SRCCOPY); + + DeleteDC(hdcMem); + } +} + + +static VOID +Bri_OnTrackBar(PIMAGEADJUST pImgAdj, + HWND hDlg) +{ + HDC hdcMem; + DWORD TrackPos; + + TrackPos = (DWORD)SendDlgItemMessage(hDlg, + IDC_BRI_TRACKBAR, + TBM_GETPOS, + 0, + 0); + + SetDlgItemInt(hDlg, + IDC_BRI_EDIT, + TrackPos, + FALSE); + + if (IsDlgButtonChecked(hDlg, IDC_BRI_FULL) == BST_CHECKED) + { + pImgAdj->RedVal = pImgAdj->GreenVal = pImgAdj->BlueVal = TrackPos - BASECOLOUR; + } + else if (IsDlgButtonChecked(hDlg, IDC_BRI_RED) == BST_CHECKED) + { + pImgAdj->RedVal = TrackPos - BASECOLOUR; + } + else if (IsDlgButtonChecked(hDlg, IDC_BRI_GREEN) == BST_CHECKED) + { + pImgAdj->GreenVal = TrackPos - BASECOLOUR; + } + else if (IsDlgButtonChecked(hDlg, IDC_BRI_BLUE) == BST_CHECKED) + { + pImgAdj->BlueVal = TrackPos - BASECOLOUR; + } + + hdcMem = GetDC(pImgAdj->hPicPrev); + + AdjustBrightness(pImgAdj->hBitmap, + pImgAdj->hPreviewBitmap, + pImgAdj->hPicPrev, + hdcMem, + pImgAdj->RedVal, + pImgAdj->GreenVal, + pImgAdj->BlueVal); + + ReleaseDC(pImgAdj->hPicPrev, hdcMem); +} + + +static BOOL +Bri_OnCommand(PIMAGEADJUST pImgAdj, + HWND hDlg, + UINT uID) +{ + switch (uID) + { + case IDOK: + { + HDC hdcMem; + + hdcMem = GetDC(pImgAdj->Info->ImageEditors->hSelf); + + AdjustBrightness(pImgAdj->Info->ImageEditors->hBitmap, + pImgAdj->Info->ImageEditors->hBitmap, + pImgAdj->Info->ImageEditors->hSelf, + hdcMem, + pImgAdj->RedVal, + pImgAdj->GreenVal, + pImgAdj->BlueVal); + + ReleaseDC(pImgAdj->Info->ImageEditors->hSelf, + hdcMem); + + EndDialog(hDlg, + uID); + + return TRUE; + } + + case IDCANCEL: + { + EndDialog(hDlg, + uID); + return TRUE; + } + } + + return FALSE; +} + + +INT_PTR CALLBACK +BrightnessProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + static PIMAGEADJUST pImgAdj = NULL; + + switch (message) + { + case WM_INITDIALOG: + { + pImgAdj = Bri_OnInitDialog(pImgAdj, + hDlg, + lParam); + if (!pImgAdj) + { + EndDialog(hDlg, -1); + return FALSE; + } + + return TRUE; + } + + case WM_DRAWITEM: + { + Bri_OnDrawItem(pImgAdj, + lParam); + return TRUE; + } + + case WM_HSCROLL: + { + if (LOWORD(wParam) == TB_THUMBTRACK || + LOWORD(wParam) == TB_ENDTRACK) + { + Bri_OnTrackBar(pImgAdj, + hDlg); + } + + return TRUE; + } + + case WM_COMMAND: + { + return Bri_OnCommand(pImgAdj, + hDlg, + LOWORD(wParam)); + } + + case WM_DESTROY: + { + if (pImgAdj) + { + if (pImgAdj->hBitmap) + DeleteObject(pImgAdj->hBitmap); + if (pImgAdj->hPreviewBitmap) + DeleteObject(pImgAdj->hPreviewBitmap); + + HeapFree(ProcessHeap, + 0, + pImgAdj); + } + } + } + + return FALSE; +} diff --git a/rosapps/imagesoft/contrast.c b/rosapps/imagesoft/contrast.c new file mode 100644 index 00000000000..aaa1933ff49 --- /dev/null +++ b/rosapps/imagesoft/contrast.c @@ -0,0 +1,380 @@ +#include "precomp.h" + +#define BASECOLOUR 100 + + +VOID +AdjustContrast(HBITMAP hOrigBitmap, + HBITMAP hNewBitmap, + HWND hwnd, + HDC hdcMem, + INT RedVal, + INT GreenVal, + INT BlueVal) +{ + BITMAPINFO bi; + BITMAP bitmap; + BOOL bRes; + DWORD Count = 0; + INT i, j; + PBYTE pBits; + RECT rc; + + GetObject(hNewBitmap, + sizeof(BITMAP), + &bitmap); + + /* Bitmap header */ + bi.bmiHeader.biSize = sizeof(bi.bmiHeader); + bi.bmiHeader.biWidth = bitmap.bmWidth; + bi.bmiHeader.biHeight = bitmap.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * 4; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + + /* Buffer */ + pBits = (PBYTE)HeapAlloc(ProcessHeap, + 0, + bitmap.bmWidth * bitmap.bmHeight * 4); + if (!pBits) + return; + + /* get the bits from the original bitmap */ + bRes = GetDIBits(hdcMem, + hOrigBitmap, + 0, + bitmap.bmHeight, + pBits, + &bi, + DIB_RGB_COLORS); + + for (i = 0; i < bitmap.bmHeight; i++) + { + for (j = 0; j < bitmap.bmWidth; j++) + { + DWORD Val = 0; + INT b, g, r; + + CopyMemory(&Val, + &pBits[Count], + 4); + + /* Get pixels in reverse order */ + b = GetRValue(Val); + g = GetGValue(Val); + r = GetBValue(Val); + + r = ((r - 128) * RedVal) / 100 + 128; + g = ((g - 128) * GreenVal) / 100 + 128; + b = ((b - 128) * BlueVal) / 100 + 128; + + /* Red */ + if (r > 255) r = 255; + else if (r < 0) r = 0; + + /* Green */ + if (g > 255) g = 255; + else if (g < 0) g = 0; + + /* Blue */ + if (b > 255) b = 255; + else if (b < 0) b = 0; + + /* Store in reverse order */ + Val = RGB(b, g, r); + CopyMemory(&pBits[Count], + &Val, + 4); + + /* RGB color take 4 bytes.The high-order byte must be zero */ + Count += 4; + } + } + + /* Set the new pixel bits */ + SetDIBits(hdcMem, + hNewBitmap, + 0, + bRes, + pBits, + &bi, + DIB_RGB_COLORS); + + HeapFree(ProcessHeap, + 0, + pBits); + + GetClientRect(hwnd, + &rc); + + InvalidateRect(hwnd, + &rc, + FALSE); +} + + +static PIMAGEADJUST +Cont_OnInitDialog(PIMAGEADJUST pImgAdj, + HWND hDlg, + LPARAM lParam) +{ + pImgAdj = (IMAGEADJUST*) HeapAlloc(ProcessHeap, + 0, + sizeof(IMAGEADJUST)); + if (!pImgAdj) + return NULL; + + + pImgAdj->Info = (PMAIN_WND_INFO)lParam; + if (!pImgAdj->Info->ImageEditors) + goto fail; + + + pImgAdj->hPicPrev = GetDlgItem(hDlg, IDC_PICPREVIEW); + GetClientRect(pImgAdj->hPicPrev, + &pImgAdj->ImageRect); + + /* Make a static copy of the main image */ + pImgAdj->hBitmap = (HBITMAP) CopyImage(pImgAdj->Info->ImageEditors->hBitmap, + IMAGE_BITMAP, + pImgAdj->ImageRect.right, + pImgAdj->ImageRect.bottom, + LR_CREATEDIBSECTION); + if (!pImgAdj->hBitmap) + goto fail; + + /* Make a copy which will be updated */ + pImgAdj->hPreviewBitmap = (HBITMAP) CopyImage(pImgAdj->Info->ImageEditors->hBitmap, + IMAGE_BITMAP, + pImgAdj->ImageRect.right, + pImgAdj->ImageRect.bottom, + LR_CREATEDIBSECTION); + if (!pImgAdj->hPreviewBitmap) + goto fail; + + + pImgAdj->RedVal = pImgAdj->BlueVal = pImgAdj->GreenVal = 100; + + /* setup dialog */ + SendDlgItemMessage(hDlg, + IDC_BRI_FULL, + BM_SETCHECK, + BST_CHECKED, + 0); + SendDlgItemMessage(hDlg, + IDC_BRI_TRACKBAR, + TBM_SETRANGE, + TRUE, + (LPARAM)MAKELONG(0, 200)); + SendDlgItemMessage(hDlg, + IDC_BRI_TRACKBAR, + TBM_SETPOS, + TRUE, + (LPARAM)BASECOLOUR); + SetDlgItemText(hDlg, + IDC_BRI_EDIT, + _T("100")); + + return pImgAdj; + +fail: + HeapFree(ProcessHeap, + 0, + pImgAdj); + return NULL; +} + + +static VOID +Cont_OnDrawItem(PIMAGEADJUST pImgAdj, + LPARAM lParam) +{ + LPDRAWITEMSTRUCT lpDrawItem; + HDC hdcMem; + + lpDrawItem = (LPDRAWITEMSTRUCT)lParam; + + hdcMem = CreateCompatibleDC(lpDrawItem->hDC); + + if(lpDrawItem->CtlID == IDC_PICPREVIEW) + { + SelectObject(hdcMem, + pImgAdj->hPreviewBitmap); + + BitBlt(lpDrawItem->hDC, + pImgAdj->ImageRect.left, + pImgAdj->ImageRect.top, + pImgAdj->ImageRect.right, + pImgAdj->ImageRect.bottom, + hdcMem, + 0, + 0, + SRCCOPY); + + DeleteDC(hdcMem); + } +} + + +static VOID +Cont_OnTrackBar(PIMAGEADJUST pImgAdj, + HWND hDlg) +{ + HDC hdcMem; + DWORD TrackPos; + + TrackPos = (DWORD)SendDlgItemMessage(hDlg, + IDC_BRI_TRACKBAR, + TBM_GETPOS, + 0, + 0); + + SetDlgItemInt(hDlg, + IDC_BRI_EDIT, + TrackPos, + FALSE); + + if (IsDlgButtonChecked(hDlg, IDC_BRI_FULL) == BST_CHECKED) + { + pImgAdj->RedVal = pImgAdj->GreenVal = pImgAdj->BlueVal = TrackPos - BASECOLOUR + 100; + } + else if (IsDlgButtonChecked(hDlg, IDC_BRI_RED) == BST_CHECKED) + { + pImgAdj->RedVal = TrackPos - BASECOLOUR + 100; + } + else if (IsDlgButtonChecked(hDlg, IDC_BRI_GREEN) == BST_CHECKED) + { + pImgAdj->GreenVal = TrackPos - BASECOLOUR + 100; + } + else if (IsDlgButtonChecked(hDlg, IDC_BRI_BLUE) == BST_CHECKED) + { + pImgAdj->BlueVal = TrackPos - BASECOLOUR + 100; + } + + hdcMem = GetDC(pImgAdj->hPicPrev); + + AdjustContrast(pImgAdj->hBitmap, + pImgAdj->hPreviewBitmap, + pImgAdj->hPicPrev, + hdcMem, + pImgAdj->RedVal, + pImgAdj->GreenVal, + pImgAdj->BlueVal); + + ReleaseDC(pImgAdj->hPicPrev, hdcMem); +} + + +static BOOL +Cont_OnCommand(PIMAGEADJUST pImgAdj, + HWND hDlg, + UINT uID) +{ + switch (uID) + { + case IDOK: + { + HDC hdcMem; + + hdcMem = GetDC(pImgAdj->Info->ImageEditors->hSelf); + + AdjustContrast(pImgAdj->Info->ImageEditors->hBitmap, + pImgAdj->Info->ImageEditors->hBitmap, + pImgAdj->Info->ImageEditors->hSelf, + hdcMem, + pImgAdj->RedVal, + pImgAdj->GreenVal, + pImgAdj->BlueVal); + + ReleaseDC(pImgAdj->Info->ImageEditors->hSelf, + hdcMem); + + EndDialog(hDlg, + uID); + + return TRUE; + } + + case IDCANCEL: + { + EndDialog(hDlg, + uID); + return TRUE; + } + } + + return FALSE; +} + + +INT_PTR CALLBACK +ContrastProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + static PIMAGEADJUST pImgAdj = NULL; + + switch (message) + { + case WM_INITDIALOG: + { + pImgAdj = Cont_OnInitDialog(pImgAdj, + hDlg, + lParam); + if (!pImgAdj) + { + EndDialog(hDlg, -1); + return FALSE; + } + + return TRUE; + } + + case WM_DRAWITEM: + { + Cont_OnDrawItem(pImgAdj, + lParam); + return TRUE; + } + + case WM_HSCROLL: + { + if (LOWORD(wParam) == TB_THUMBTRACK || + LOWORD(wParam) == TB_ENDTRACK) + { + Cont_OnTrackBar(pImgAdj, + hDlg); + } + + return TRUE; + } + + case WM_COMMAND: + { + return Cont_OnCommand(pImgAdj, + hDlg, + LOWORD(wParam)); + } + + case WM_DESTROY: + { + if (pImgAdj) + { + if (pImgAdj->hBitmap) + DeleteObject(pImgAdj->hBitmap); + if (pImgAdj->hPreviewBitmap) + DeleteObject(pImgAdj->hPreviewBitmap); + + HeapFree(ProcessHeap, + 0, + pImgAdj); + } + } + } + + return FALSE; +} diff --git a/rosapps/imagesoft/custcombo.c b/rosapps/imagesoft/custcombo.c new file mode 100644 index 00000000000..df8397d9b75 --- /dev/null +++ b/rosapps/imagesoft/custcombo.c @@ -0,0 +1,213 @@ +#include + + +LRESULT WINAPI +FlatComboProc(HWND hwnd, + UINT msg, + WPARAM wParam, + LPARAM lParam) +{ + HDC hdc; + PAINTSTRUCT ps; + RECT rect, rect2; + POINT pt; + + WNDPROC OldComboProc = (WNDPROC)GetWindowLong(hwnd, GWL_USERDATA); + + static BOOL fMouseDown = FALSE; + static BOOL fButtonDown = FALSE; + + switch(msg) + { + case WM_PAINT: + { + if(wParam == 0) hdc = BeginPaint(hwnd, &ps); + else hdc = (HDC)wParam; + + /* mask off the borders and draw ComboBox normally */ + GetClientRect(hwnd, &rect); + + InflateRect(&rect, + -GetSystemMetrics(SM_CXEDGE)*2, + -GetSystemMetrics(SM_CYEDGE)*2); + + rect.right -= GetSystemMetrics(SM_CXVSCROLL); + + IntersectClipRect(hdc, + rect.left, + rect.top, + rect.right, + rect.bottom); + + /* Draw the ComboBox */ + CallWindowProc(OldComboProc, + hwnd, + msg, + (WPARAM)hdc, + lParam); + + /* Now mask off inside and draw the borders */ + SelectClipRgn(hdc, + NULL); + rect.right += GetSystemMetrics(SM_CXVSCROLL); + + ExcludeClipRect(hdc, + rect.left, + rect.top, + rect.right, + rect.bottom); + + /* draw borders */ + GetClientRect(hwnd, + &rect2); + FillRect(hdc, + &rect2, + //CreateSolidBrush(RGB(0,0,0))); + GetSysColorBrush(COLOR_3DFACE)); + + /* now draw the button */ + SelectClipRgn(hdc, + NULL); + rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL); + + if(fButtonDown) + { + HBRUSH oldBrush; + HPEN oldPen; + POINT pt[3]; + + FillRect(hdc, &rect, CreateSolidBrush(RGB(182,189,210))); + rect.top -= 1; + rect.bottom += 1; + FrameRect(hdc, &rect, GetStockBrush(WHITE_BRUSH)); + + pt[0].x = rect.right - ((GetSystemMetrics(SM_CXVSCROLL) / 2) + 2); + pt[0].y = rect.bottom / 2; + pt[1].x = pt[0].x + 4; + pt[1].y = pt[0].y; + pt[2].x = pt[1].x - 2; + pt[2].y = pt[1].y + 2; + + oldPen = (HPEN) SelectObject(hdc, GetStockPen(WHITE_PEN)); + oldBrush = (HBRUSH) SelectObject(hdc, GetStockBrush(WHITE_BRUSH)); + Polygon(hdc, pt, 3); + + SelectObject(hdc, oldPen); + SelectObject(hdc, oldBrush); + } + else + { + HBRUSH oldBrush; + POINT pt[3]; + + FillRect(hdc, &rect, GetSysColorBrush(COLOR_3DFACE)); + rect.top -= 1; + rect.bottom += 1; + FrameRect(hdc, &rect, GetStockBrush(WHITE_BRUSH)); + + pt[0].x = rect.right - ((GetSystemMetrics(SM_CXVSCROLL) / 2) + 2); + pt[0].y = rect.bottom / 2; + pt[1].x = pt[0].x + 4; + pt[1].y = pt[0].y; + pt[2].x = pt[1].x - 2; + pt[2].y = pt[1].y + 2; + + oldBrush = (HBRUSH) SelectObject(hdc, GetStockBrush(BLACK_BRUSH)); + Polygon(hdc, pt, 3); + + SelectObject(hdc, oldBrush); + } + + + if(wParam == 0) + EndPaint(hwnd, &ps); + + return 0; + } + + /* check if mouse is within drop-arrow area, toggle + * a flag to say if the mouse is up/down. Then invalidate + * the window so it redraws to show the changes. */ + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + { + + pt.x = (short)LOWORD(lParam); + pt.y = (short)HIWORD(lParam); + + GetClientRect(hwnd, &rect); + + InflateRect(&rect, + -GetSystemMetrics(SM_CXEDGE), + -GetSystemMetrics(SM_CYEDGE)); + rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL); + + if(PtInRect(&rect, pt)) + { + /* we *should* call SetCapture, but the ComboBox does it for us */ + fMouseDown = TRUE; + fButtonDown = TRUE; + InvalidateRect(hwnd, 0, 0); + } + } + break; + + /* mouse has moved. Check to see if it is in/out of the drop-arrow */ + case WM_MOUSEMOVE: + { + + pt.x = (short)LOWORD(lParam); + pt.y = (short)HIWORD(lParam); + + if(fMouseDown && (wParam & MK_LBUTTON)) + { + GetClientRect(hwnd, &rect); + + InflateRect(&rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE)); + rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL); + + if(fButtonDown != PtInRect(&rect, pt)) + { + fButtonDown = PtInRect(&rect, pt); + InvalidateRect(hwnd, 0, 0); + } + } + } + break; + + case WM_LBUTTONUP: + { + + if(fMouseDown) + { + /* No need to call ReleaseCapture, the ComboBox does it for us */ + fMouseDown = FALSE; + fButtonDown = FALSE; + InvalidateRect(hwnd, 0, 0); + } + } + break; + } + + return CallWindowProc(OldComboProc, + hwnd, + msg, + wParam, + lParam); +} + +VOID MakeFlatCombo(HWND hwndCombo) +{ + LONG OldComboProc; + + /* Remember old window procedure */ + OldComboProc = GetWindowLongPtr(hwndCombo, GWL_WNDPROC); + SetWindowLongPtr(hwndCombo, + GWL_USERDATA, + OldComboProc); + + /* Perform the subclass */ + SetWindowLongPtr(hwndCombo, + GWL_WNDPROC, + (LONG_PTR)FlatComboProc); +} diff --git a/rosapps/imagesoft/floatwindow.c b/rosapps/imagesoft/floatwindow.c new file mode 100644 index 00000000000..14d6bf4c29a --- /dev/null +++ b/rosapps/imagesoft/floatwindow.c @@ -0,0 +1,629 @@ +#include "precomp.h" + +static const TCHAR szFloatWndClass[] = TEXT("ImageSoftFloatWndClass"); + +#define ID_TIMER1 1 +#define ID_TIMER2 2 +#define ID_TIMER3 3 + +TBBUTTON ToolsButtons[] = { +/* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */ + {TBICON_RECTSEL, ID_RECTSEL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* rectangle select */ + {TBICON_MOVESEL, ID_MOVESEL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* move selected pixels */ + {TBICON_LASOO, ID_LASOO, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* lasso select */ + {TBICON_MOVE, ID_MOVE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* move selection */ + {TBICON_ECLIPSESEL, ID_ECLIPSESEL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* elipse select */ + {TBICON_ZOOM, ID_ZOOM, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* zoom */ + {TBICON_MAGICWAND, ID_MAGICWAND, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* magic wand */ + {TBICON_TEXT, ID_TEXT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* text */ + {TBICON_PAINTBRUSH, ID_PAINTBRUSH, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* paintbrush */ + {TBICON_ERASER, ID_ERASER, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* eraser */ + {TBICON_PENCIL, ID_PENCIL, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* pencil */ + {TBICON_COLORPICKER, ID_COLORPICKER, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* color picker */ + {TBICON_CLONESTAMP, ID_CLONESTAMP, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* clone stamp */ + {TBICON_RECOLORING, ID_RECOLORING, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* recolor */ + {TBICON_PAINTBUCKET, ID_PAINTBUCKET, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* paint bucket */ + {TBICON_LINE, ID_LINE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* line */ + {TBICON_RECTANGLE, ID_RECTANGLE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* rectangle */ + {TBICON_ROUNDRECT, ID_ROUNDRECT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* round rectangle */ + {TBICON_ECLIPSE, ID_ECLIPSE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* elipse */ + {TBICON_FREEFORM, ID_FREEFORM, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0}, /* free form */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, +}; + +TBBUTTON HistoryButtons[] = { + {TBICON_BACKSM, ID_BACK, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* back */ + {TBICON_UNDOSM, ID_UNDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* undo */ + {TBICON_REDOSM, ID_REDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* redo */ + {TBICON_FORWARDSM, ID_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* forward */ + {TBICON_DELETESM, ID_DELETE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* delete */ +}; + + +BOOL +ShowHideWindow(HWND hwnd) +{ + if (IsWindowVisible(hwnd)) + return ShowWindow(hwnd, SW_HIDE); + else + return ShowWindow(hwnd, SW_SHOW); +} + + +BOOL +FloatToolbarCreateToolsGui(PMAIN_WND_INFO Info) +{ + HWND hTb; + HIMAGELIST hImageList; + INT NumButtons; + + NumButtons = sizeof(ToolsButtons) / sizeof(ToolsButtons[0]); + + hTb = CreateWindowEx(0, + TOOLBARCLASSNAME, + NULL, + WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_WRAPABLE | CCS_NODIVIDER, + 0, 0, 32, 200, + Info->fltTools->hSelf, + NULL, + hInstance, + NULL); + if (hTb != NULL) + { + SendMessage(hTb, + TB_SETEXTENDEDSTYLE, + 0, + TBSTYLE_EX_HIDECLIPPEDBUTTONS); + + SendMessage(hTb, + TB_BUTTONSTRUCTSIZE, + sizeof(ToolsButtons[0]), + 0); + + SendMessage(hTb, + TB_SETBITMAPSIZE, + 0, + (LPARAM)MAKELONG(16, 16)); + + hImageList = InitImageList(NumButtons, + IDB_TOOLSRECTSEL); + + ImageList_Destroy((HIMAGELIST)SendMessage(hTb, + TB_SETIMAGELIST, + 0, + (LPARAM)hImageList)); + + SendMessage(hTb, + TB_ADDBUTTONS, + NumButtons, + (LPARAM)ToolsButtons); + + SendMessage(hTb, + TB_AUTOSIZE, + 0, + 0); + + return TRUE; + } + + return FALSE; +} + + +VOID +FloatWindowPaintColorPicker(HWND hColorPicker) +{ + HDC hdc; + RECT rect; + + InvalidateRect(hColorPicker, + NULL, + TRUE); + UpdateWindow(hColorPicker); + + hdc = GetDC(hColorPicker); + + GetClientRect(hColorPicker, + &rect); + + Ellipse(hdc, + rect.left, + rect.top, + rect.right, + rect.bottom); + + ReleaseDC(hColorPicker, + hdc); + +} + +VOID +FloatWindowPaintHueSlider(HWND hHueSlider) +{ + HDC hdc; + RECT rect; + + InvalidateRect(hHueSlider, + NULL, + TRUE); + UpdateWindow(hHueSlider); + + hdc = GetDC(hHueSlider); + + GetClientRect(hHueSlider, + &rect); + + Rectangle(hdc, + rect.left, + rect.top, + rect.right, + rect.bottom); + + ReleaseDC(hHueSlider, + hdc); + +} + + +BOOL +FloatToolbarCreateColorsGui(PMAIN_WND_INFO Info) +{ + HWND hColorPicker; + HWND hHueSlider; + HWND hMouseButton; + HWND hMore; + RECT rect; + HBITMAP hMoreBitmap; + + GetClientRect(Info->fltColors->hSelf, + &rect); + + hColorPicker = CreateWindowEx(0, + WC_STATIC, + NULL, + WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, + 2, + 2, + (int) (rect.right * 0.65), + rect.bottom - 2, + Info->fltColors->hSelf, + NULL, + hInstance, + NULL); + if (hColorPicker == NULL) + return FALSE; + + hHueSlider = CreateWindowEx(0, + WC_STATIC, + NULL, + WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, + 145, + 35, + 25, + 135, + Info->fltColors->hSelf, + NULL, + hInstance, + NULL); + if (hHueSlider == NULL) + return FALSE; + + hMouseButton = CreateWindowEx(0, + WC_COMBOBOX, + NULL, + WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, + 118, 5, 75, 25, + Info->fltColors->hSelf, + NULL, + hInstance, + NULL); + if (hMouseButton == NULL) + return FALSE; + + MakeFlatCombo(hMouseButton); + + /* temp, just testing */ + SendMessage(hMouseButton, CB_ADDSTRING, 0, (LPARAM)_T("Primary")); + SendMessage(hMouseButton, CB_ADDSTRING, 0, (LPARAM)_T("Secondary")); + SendMessage(hMouseButton, CB_SETCURSEL, 0, 0); + + + hMore = CreateWindowEx(WS_EX_STATICEDGE, + WC_BUTTON, + NULL, + WS_CHILD | WS_VISIBLE | BS_BITMAP, + rect.right - 15, + rect.bottom - 15, + 15, 15, + Info->fltColors->hSelf, + NULL, + hInstance, + NULL); + if (hMore == NULL) + return FALSE; + + hMoreBitmap = (HBITMAP)LoadImage(hInstance, + MAKEINTRESOURCE(IDB_COLORSMORE), + IMAGE_BITMAP, + 12, + 11, + LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS); + if (hMoreBitmap != NULL) + { + SendMessage(hMore, + BM_SETIMAGE, + IMAGE_BITMAP, + (LPARAM)hMoreBitmap); + } + + + /* temp functions for playing about with possible layouts */ + FloatWindowPaintHueSlider(hHueSlider); + FloatWindowPaintColorPicker(hColorPicker); + + if (hColorPicker != NULL) + { + HDC hDc = GetDC(hColorPicker); + TextOut(hDc, 8, 75, _T("Possible layout?"), 16); + ReleaseDC(hColorPicker, hDc); + } + + return TRUE; + +} + + +BOOL +FloatToolbarCreateHistoryGui(PMAIN_WND_INFO Info) +{ + HWND hList; + HWND hButtons; + HIMAGELIST hImageList; + INT NumButtons; + + hList = CreateWindowEx(0, + WC_LISTBOX, + NULL, + WS_CHILD | WS_VISIBLE | LBS_EXTENDEDSEL, + 0, 0, 143, 100, + Info->fltHistory->hSelf, + NULL, + hInstance, + NULL); + if (hList == NULL) + return FALSE; + + NumButtons = sizeof(HistoryButtons) / sizeof(HistoryButtons[0]); + hButtons = CreateWindowEx(0, + TOOLBARCLASSNAME, + NULL, + WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | CCS_BOTTOM | CCS_NODIVIDER, + 0, 0, 0, 0, + Info->fltHistory->hSelf, + NULL, + hInstance, + NULL); + if (hButtons != NULL) + { + SendMessage(hButtons, + TB_BUTTONSTRUCTSIZE, + sizeof(ToolsButtons[0]), + 0); + + SendMessage(hButtons, + TB_SETBITMAPSIZE, + 0, + (LPARAM)MAKELONG(10, 10)); + + hImageList = InitImageList(NumButtons, + IDB_HISTBACK); + + ImageList_Destroy((HIMAGELIST)SendMessage(hButtons, + TB_SETIMAGELIST, + 0, + (LPARAM)hImageList)); + + SendMessage(hButtons, + TB_SETBUTTONSIZE, + 0, + MAKELONG(18, 16)); + + SendMessage(hButtons, + TB_ADDBUTTONS, + NumButtons, + (LPARAM)HistoryButtons); + + return TRUE; + } + + return FALSE; +} + + +static VOID +DoTimer(PFLT_WND FltInfo, + UINT idTimer) +{ + switch (idTimer) + { + /* timer to check if cursor is in toolbar coords */ + case ID_TIMER1: + { + POINT pt; + + /* kill timer if toobar is not opaque */ + if (FltInfo->bOpaque != TRUE) + { + KillTimer(FltInfo->hSelf, + ID_TIMER1); + break; + } + + if (GetCursorPos(&pt)) + { + RECT rect; + + if (GetWindowRect(FltInfo->hSelf, + &rect)) + { + if (!PtInRect(&rect, + pt)) + { + KillTimer(FltInfo->hSelf, + ID_TIMER1); + KillTimer(FltInfo->hSelf, + ID_TIMER2); + + /* timer to fade out toolbar */ + SetTimer(FltInfo->hSelf, + ID_TIMER3, + 50, + NULL); + } + } + } + } + break; + + /* timer to fade in toolbar */ + case ID_TIMER2: + { + SetLayeredWindowAttributes(FltInfo->hSelf, + 0, + (255 * FltInfo->Transparancy) / 100, + LWA_ALPHA); + + /* increment transparancy until it is opaque (100) */ + FltInfo->Transparancy += 5; + + if (FltInfo->Transparancy == 100) + { + SetWindowLongPtr(FltInfo->hSelf, + GWL_EXSTYLE, + GetWindowLongPtr(FltInfo->hSelf, + GWL_EXSTYLE) & ~WS_EX_LAYERED); + + FltInfo->bOpaque = TRUE; + + KillTimer(FltInfo->hSelf, + ID_TIMER2); + } + } + break; + + case ID_TIMER3: + { + LONG Style; + + Style = GetWindowLongPtr(FltInfo->hSelf, + GWL_EXSTYLE); + + if (Style & ~WS_EX_LAYERED) + { + SetWindowLongPtr(FltInfo->hSelf, + GWL_EXSTYLE, + Style | WS_EX_LAYERED); + } + + FltInfo->Transparancy -= 5; + + if (FltInfo->Transparancy >= 60) + { + /* set the tranclucency to 60% */ + SetLayeredWindowAttributes(FltInfo->hSelf, + 0, + (255 * FltInfo->Transparancy) / 100, + LWA_ALPHA); + + if (FltInfo->Transparancy == 60) + { + FltInfo->bOpaque = FALSE; + + KillTimer(FltInfo->hSelf, + ID_TIMER3); + } + + } + } + break; + } +} + +LRESULT CALLBACK +FloatToolbarWndProc(HWND hwnd, + UINT Message, + WPARAM wParam, + LPARAM lParam) +{ + PFLT_WND FltInfo; + + /* Get the window context */ + FltInfo = (PFLT_WND)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (FltInfo == NULL && Message != WM_CREATE) + { + goto HandleDefaultMessage; + } + + switch(Message) + { + case WM_CREATE: + { + FltInfo = (PFLT_WND)(((LPCREATESTRUCT)lParam)->lpCreateParams); + + /*FIXME: read this from registry */ +// FltInfo->bShow = TRUE; + + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + (LONG_PTR)FltInfo); + + FltInfo->bOpaque = FALSE; + + SetWindowLongPtr(hwnd, + GWL_EXSTYLE, + GetWindowLongPtr(hwnd, + GWL_EXSTYLE) | WS_EX_LAYERED); + + /* set the tranclucency to 60% */ + FltInfo->Transparancy = 60; + SetLayeredWindowAttributes(hwnd, + 0, + (255 * FltInfo->Transparancy) / 100, + LWA_ALPHA); + } + break; + + case WM_TIMER: + { + DoTimer(FltInfo, + wParam); + } + break; + + case WM_NCMOUSEMOVE: + case WM_MOUSEMOVE: + { + if (FltInfo->bOpaque == FALSE) + { + + RedrawWindow(hwnd, + NULL, + NULL, + RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); + + FltInfo->bOpaque = TRUE; + //MessageBox(NULL, _T("in"), _T("Hit test"), MB_OK | MB_ICONEXCLAMATION); + + /* timer to check if cursor is in toolbar coords */ + SetTimer(hwnd, + ID_TIMER1, + 200, + NULL); + + /* timer to fade in the toolbars */ + SetTimer(hwnd, + ID_TIMER2, + 50, + NULL); + } + } + break; + + case WM_CLOSE: + ShowHideWindow(FltInfo->hSelf); + break; + + case WM_COMMAND: + { + if (LOWORD(wParam) == IDCANCEL) + ShowHideWindow(FltInfo->hSelf); + + switch(LOWORD(wParam)) + { + case ID_NEW: + MessageBox(hwnd, _T("Kapow!"), _T("Hit test"), MB_OK | MB_ICONEXCLAMATION); + break; + + case ID_CLONESTAMP: + case ID_COLORPICKER: + case ID_ECLIPSE: + case ID_ECLIPSESEL: + case ID_ERASER: + case ID_FREEFORM: + case ID_LASOO: + case ID_LINE: + case ID_MAGICWAND: + case ID_MOVE: + case ID_MOVESEL: + case ID_PAINTBRUSH: + case ID_PAINTBUCKET: + case ID_PENCIL: + case ID_RECOLORING: + case ID_RECTANGLE: + case ID_ROUNDRECT: + case ID_TEXT: + case ID_ZOOM: + /*SendMessage(Info->hSelf, + LOWORD(wParam), + wParam, + lParam);*/ + break; + } + } + break; + + case WM_NCACTIVATE: + /* FIXME: needs fully implementing */ + return DefWindowProc(hwnd, + Message, + TRUE, + lParam); + break; + + case WM_DESTROY: + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + 0); + break; + + default: +HandleDefaultMessage: + return DefWindowProc(hwnd, + Message, + wParam, + lParam); + } + + return 0; +} + + +BOOL +InitFloatWndClass(VOID) +{ + WNDCLASSEX wc = {0}; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = FloatToolbarWndProc; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = LoadCursor(NULL, + IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszClassName = szFloatWndClass; + wc.hIconSm = NULL; + + return RegisterClassEx(&wc) != (ATOM)0; +} + +VOID +UninitFloatWndImpl(VOID) +{ + UnregisterClass(szFloatWndClass, + hInstance); +} + + diff --git a/rosapps/imagesoft/font.c b/rosapps/imagesoft/font.c new file mode 100644 index 00000000000..972798c398d --- /dev/null +++ b/rosapps/imagesoft/font.c @@ -0,0 +1,178 @@ +#include + +int CALLBACK +EnumFontSizes(ENUMLOGFONTEX *lpelfe, + NEWTEXTMETRICEX *lpntme, + DWORD FontType, + LPARAM lParam) +{ + static int ttsizes[] = { 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 }; + TCHAR ach[100]; + + BOOL fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE; + + HWND hwndCombo = (HWND)lParam; + INT i, idx; + + if (fTrueType) + { + for (i = 0; i < (sizeof(ttsizes) / sizeof(ttsizes[0])); i++) + { + wsprintf(ach, _T("%d"), ttsizes[i]); + + idx = (INT)SendMessage(hwndCombo, + CB_ADDSTRING, + 0, + (LPARAM)ach); + + SendMessage(hwndCombo, + CB_SETITEMDATA, + idx, + ttsizes[i]); + } + return 0; + } + + return 1; +} + + +/* Font-enumeration callback */ +int CALLBACK +EnumFontNames(ENUMLOGFONTEX *lpelfe, + NEWTEXTMETRICEX *lpntme, + DWORD FontType, + LPARAM lParam) +{ + HWND hwndCombo = (HWND)lParam; + TCHAR *pszName = lpelfe->elfLogFont.lfFaceName; + + /* make sure font doesn't already exist in our list */ + if(SendMessage(hwndCombo, + CB_FINDSTRING, + 0, + (LPARAM)pszName) == CB_ERR) + { + INT idx; + BOOL fFixed; + BOOL fTrueType; + + /* add the font */ + idx = (INT)SendMessage(hwndCombo, + CB_ADDSTRING, + 0, + (LPARAM)pszName); + + /* record the font's attributes (Fixedwidth and Truetype) */ + fFixed = (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH) ? TRUE : FALSE; + fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE; + + /* store this information in the list-item's userdata area */ + SendMessage(hwndCombo, + CB_SETITEMDATA, + idx, + MAKEWPARAM(fFixed, fTrueType)); + } + + return 1; +} + + +VOID +FillFontSizeComboList(HWND hwndCombo) +{ + LOGFONT lf = { 0 }; + HDC hdc = GetDC(hwndCombo); + + /* default size */ + INT cursize = 12; + INT i, count, nearest = 0; + + HFONT hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT); + + SendMessage(hwndCombo, + WM_SETFONT, + (WPARAM)hFont, + 0); + + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfPitchAndFamily = 0; + + /* empty the list */ + SendMessage(hwndCombo, + CB_RESETCONTENT, + 0, + 0); + + /* enumerate font sizes */ + EnumFontFamiliesEx(hdc, + &lf, + (FONTENUMPROC)EnumFontSizes, + (LPARAM)hwndCombo, + 0); + + /* set selection to first item */ + count = (INT)SendMessage(hwndCombo, + CB_GETCOUNT, + 0, + 0); + + for(i = 0; i < count; i++) + { + INT n = (INT)SendMessage(hwndCombo, + CB_GETITEMDATA, + i, + 0); + + if (n <= cursize) + nearest = i; + } + + SendMessage(hwndCombo, + CB_SETCURSEL, + nearest, + 0); + + ReleaseDC(hwndCombo, + hdc); +} + + +/* Initialize the font-list by enumeration all system fonts */ +VOID +FillFontStyleComboList(HWND hwndCombo) +{ + HDC hdc = GetDC(hwndCombo); + LOGFONT lf; + + /* FIXME: draw each font in its own style */ + HFONT hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT); + SendMessage(hwndCombo, + WM_SETFONT, + (WPARAM)hFont, + 0); + + /* FIXME: set this in relation to the widest string */ + SendMessage(hwndCombo, CB_SETDROPPEDWIDTH, 150, 0); + + lf.lfCharSet = ANSI_CHARSET; // DEFAULT_CHARSET; + lf.lfFaceName[0] = _T('\0'); // all fonts + lf.lfPitchAndFamily = 0; + + /* store the list of fonts in the combo */ + EnumFontFamiliesEx(hdc, + &lf, + (FONTENUMPROC)EnumFontNames, + (LPARAM)hwndCombo, 0); + + ReleaseDC(hwndCombo, + hdc); + + /* set default to Arial */ + SendMessage(hwndCombo, + CB_SELECTSTRING, + -1, + (LPARAM)_T("Arial")); + + +} diff --git a/rosapps/imagesoft/imageprop.h b/rosapps/imagesoft/imageprop.h new file mode 100644 index 00000000000..2baafb75344 --- /dev/null +++ b/rosapps/imagesoft/imageprop.h @@ -0,0 +1,49 @@ + +typedef struct _IMAGEADJUST +{ + PMAIN_WND_INFO Info; + HWND hPicPrev; + HBITMAP hBitmap; + HBITMAP hPreviewBitmap; + RECT ImageRect; + INT RedVal; + INT GreenVal; + INT BlueVal; +} IMAGEADJUST, *PIMAGEADJUST; + + +INT_PTR CALLBACK ImagePropDialogProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam); + +INT_PTR CALLBACK BrightnessProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam); + +INT_PTR CALLBACK ContrastProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam); + +VOID AdjustBrightness(HBITMAP hOrigBitmap, + HBITMAP hNewBitmap, + HWND hwnd, + HDC hdcMem, + INT RedVal, + INT GreenVal, + INT BlueVal); + +BOOL DisplayBlackAndWhite(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap); +BOOL DisplayInvertedColors(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap); +BOOL DisplayBlur(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap); +BOOL DisplaySharpness(HWND hwnd, + HDC hdcMem, + HBITMAP hBitmap); diff --git a/rosapps/imagesoft/imagesoft.c b/rosapps/imagesoft/imagesoft.c new file mode 100644 index 00000000000..5672fc0a3af --- /dev/null +++ b/rosapps/imagesoft/imagesoft.c @@ -0,0 +1,100 @@ +#include + +HINSTANCE hInstance; +HANDLE ProcessHeap; + +int WINAPI +WinMain(HINSTANCE hThisInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + LPTSTR lpAppName, lpVersion, lpTitle; + HWND hMainWnd; + MSG Msg; + BOOL bRet; + int Ret = 1, len; + INITCOMMONCONTROLSEX icex; + + hInstance = hThisInstance; + ProcessHeap = GetProcessHeap(); + + icex.dwSize = sizeof(INITCOMMONCONTROLSEX); + icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES; + InitCommonControlsEx(&icex); + + if (!AllocAndLoadString(&lpAppName, hInstance, IDS_APPNAME) || + !AllocAndLoadString(&lpVersion, hInstance, IDS_VERSION) ) + { + return Ret; + } + + len = (int)_tcslen(lpAppName) + (int)_tcslen(lpVersion); + lpTitle = HeapAlloc(ProcessHeap, + 0, + (len + 2) * sizeof(TCHAR)); + if (lpTitle == NULL) + { + LocalFree((HLOCAL)lpAppName); + LocalFree((HLOCAL)lpVersion); + return Ret; + } + + wsprintf(lpTitle, + _T("%s %s"), + lpAppName, + lpVersion); + + LocalFree((HLOCAL)lpAppName); + LocalFree((HLOCAL)lpVersion); + + if (TbdInitImpl()) + { + if (InitMainWindowImpl()) + { + if (InitImageEditWindowImpl()) + { + if (InitFloatWndClass()) + { + hMainWnd = CreateMainWindow(lpTitle, + nCmdShow); + if (hMainWnd != NULL) + { + /* pump the message queue */ + while((bRet = GetMessage(&Msg, + NULL, + 0, + 0) != 0)) + { + if (bRet != (BOOL)-1) + { + if (!MainWndTranslateMDISysAccel(hMainWnd, + &Msg)) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + } + } + + Ret = 0; + } + + UninitImageEditWindowImpl(); + } + + UninitFloatWndImpl(); + } + + UninitMainWindowImpl(); + } + + TbdUninitImpl(); + } + + HeapFree(GetProcessHeap(), + 0, + lpTitle); + + return Ret; +} diff --git a/rosapps/imagesoft/imagesoft.rbuild b/rosapps/imagesoft/imagesoft.rbuild new file mode 100644 index 00000000000..0eec8a139c1 --- /dev/null +++ b/rosapps/imagesoft/imagesoft.rbuild @@ -0,0 +1,36 @@ + + + + . + + + + 0x0600 + 0x0501 + kernel32 + gdi32 + user32 + advapi32 + version + comctl32 + shell32 + comdlg32 + + about.c + adjust.c + brightness.c + contrast.c + custcombo.c + floatwindow.c + font.c + imagesoft.c + imgedwnd.c + mainwnd.c + opensave.c + tooldock.c + misc.c + + imagesoft.rc + precomp.h + + diff --git a/rosapps/imagesoft/imagesoft.rc b/rosapps/imagesoft/imagesoft.rc new file mode 100644 index 00000000000..ef23924ece8 --- /dev/null +++ b/rosapps/imagesoft/imagesoft.rc @@ -0,0 +1,75 @@ +#include +#include +#include "resource.h" + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS image editor\0" +#define REACTOS_STR_INTERNAL_NAME "imagesoft\0" +#define REACTOS_STR_ORIGINAL_FILENAME "imagesoft.exe\0" +//#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +1 24 DISCARDABLE "manifest.xml" + +IDI_IMAGESOFTICON ICON "res/imagesoft.ico" + +/* main toolbar icons */ +IDB_MAINCOPYICON BITMAP DISCARDABLE "res/icons/std/MainCopyIcon.bmp" +IDB_MAINCUTICON BITMAP DISCARDABLE "res/icons/std/MainCutIcon.bmp" +IDB_MAINPASTEICON BITMAP DISCARDABLE "res/icons/std/MainPasteIcon.bmp" +IDB_MAINREDOICON BITMAP DISCARDABLE "res/icons/std/MainRedoIcon.bmp" +IDB_MAINUNDOICON BITMAP DISCARDABLE "res/icons/std/MainUndoIcon.bmp" +IDB_MAINNEWICON BITMAP DISCARDABLE "res/icons/std/MainNewIcon.bmp" +IDB_MAINOPENICON BITMAP DISCARDABLE "res/icons/std/MainOpenIcon.bmp" +IDB_MAINPRINTICON BITMAP DISCARDABLE "res/icons/std/MainPrintIcon.bmp" +IDB_MAINPRINTPREICON BITMAP DISCARDABLE "res/icons/std/MainPrintPreIcon.bmp" +IDB_MAINSAVEICON BITMAP DISCARDABLE "res/icons/std/MainSaveIcon.bmp" + +/* text toolbar icons */ +IDB_TEXTBOLD BITMAP DISCARDABLE "res/icons/text/TextBoldIcon.bmp" +IDB_TEXTITALIC BITMAP DISCARDABLE "res/icons/text/TextItalicIcon.bmp" +IDB_TEXTULINE BITMAP DISCARDABLE "res/icons/text/TextUnderlineIcon.bmp" +IDB_TEXTLEFT BITMAP DISCARDABLE "res/icons/text/TextAlignLeftIcon.bmp" +IDB_TEXTCENTER BITMAP DISCARDABLE "res/icons/text/TextAlignCenterIcon.bmp" +IDB_TEXTRIGHT BITMAP DISCARDABLE "res/icons/text/TextAlignRightIcon.bmp" + +/* tools window icons */ +IDB_TOOLSCLONESTAMP BITMAP DISCARDABLE "res/icons/tools/ToolsCloneStamp.bmp" +IDB_TOOLSCOLORPICKER BITMAP DISCARDABLE "res/icons/tools/ToolsColorPicker.bmp" +IDB_TOOLSECLIPSE BITMAP DISCARDABLE "res/icons/tools/ToolsEllipse.bmp" +IDB_TOOLSECLIPSESEL BITMAP DISCARDABLE "res/icons/tools/ToolsEllipseSelect.bmp" +IDB_TOOLSERASER BITMAP DISCARDABLE "res/icons/tools/ToolsEraser.bmp" +IDB_TOOLSFREEFORM BITMAP DISCARDABLE "res/icons/tools/ToolsFreeformShape.bmp" +IDB_TOOLSLASOO BITMAP DISCARDABLE "res/icons/tools/ToolsLassoSelect.bmp" +IDB_TOOLSLINE BITMAP DISCARDABLE "res/icons/tools/ToolsLine.bmp" +IDB_TOOLSMAGICWAND BITMAP DISCARDABLE "res/icons/tools/ToolsMagicWand.bmp" +IDB_TOOLSMOVE BITMAP DISCARDABLE "res/icons/tools/ToolsMove.bmp" +IDB_TOOLSMOVESEL BITMAP DISCARDABLE "res/icons/tools/ToolsMoveSelection.bmp" +IDB_TOOLSPAINTBRUSH BITMAP DISCARDABLE "res/icons/tools/ToolsPaintBrush.bmp" +IDB_TOOLSPAINTBUCKET BITMAP DISCARDABLE "res/icons/tools/ToolsPaintBucket.bmp" +IDB_TOOLSPENCIL BITMAP DISCARDABLE "res/icons/tools/ToolsPencil.bmp" +IDB_TOOLSRECOLORING BITMAP DISCARDABLE "res/icons/tools/ToolsRecoloring.bmp" +IDB_TOOLSRECTANGLE BITMAP DISCARDABLE "res/icons/tools/ToolsRectangle.bmp" +IDB_TOOLSRECTSEL BITMAP DISCARDABLE "res/icons/tools/ToolsRectangleSelect.bmp" +IDB_TOOLSROUNDRECT BITMAP DISCARDABLE "res/icons/tools/ToolsRoundedRectangle.bmp" +IDB_TOOLSTEXT BITMAP DISCARDABLE "res/icons/tools/ToolsText.bmp" +IDB_TOOLSZOOM BITMAP DISCARDABLE "res/icons/tools/ToolsZoom.bmp" + +/* history window icons */ +IDB_HISTBACK BITMAP DISCARDABLE "res/icons/hist/HistBack.bmp" +IDB_HISTUNDO BITMAP DISCARDABLE "res/icons/hist/HistUndo.bmp" +IDB_HISTREDO BITMAP DISCARDABLE "res/icons/hist/HistRedo.bmp" +IDB_HISTFORWARD BITMAP DISCARDABLE "res/icons/hist/HistForward.bmp" +IDB_HISTDELETE BITMAP DISCARDABLE "res/icons/hist/HistDelete.bmp" + +/* colors window icons */ +IDB_COLORSMORE BITMAP DISCARDABLE "res/icons/color/ColorMore.bmp" +IDB_COLORSLESS BITMAP DISCARDABLE "res/icons/color/ColorLess.bmp" + +/* cursors */ +IDC_PAINTBRUSHCURSOR CURSOR DISCARDABLE "res/cursors/PaintBrushToolCursor.cur" +IDC_PAINTBRUSHCURSORMOUSEDOWN CURSOR DISCARDABLE "res/cursors/PaintBrushToolCursorMouseDown.cur" + +#include "rsrc.rc" + + diff --git a/rosapps/imagesoft/imgedwnd.c b/rosapps/imagesoft/imgedwnd.c new file mode 100644 index 00000000000..3a7feed5068 --- /dev/null +++ b/rosapps/imagesoft/imgedwnd.c @@ -0,0 +1,542 @@ +#include "precomp.h" + +static const TCHAR szImageEditWndClass[] = TEXT("ImageSoftEditWndClass"); + +#define IMAGE_FRAME_SIZE 1 + +static VOID +EditWndUpdateScrollInfo(PEDIT_WND_INFO Info) +{ + SCROLLINFO si; + RECT rcClient; + + GetClientRect(Info->hSelf, + &rcClient); + + si.cbSize = sizeof(si); + si.fMask = SIF_PAGE | SIF_RANGE; + si.nPage = rcClient.right - (2 * IMAGE_FRAME_SIZE); + si.nMin = 0; + si.nMax = Info->Width; + + SetScrollInfo(Info->hSelf, + SB_HORZ, + &si, + TRUE); + + si.nPage = rcClient.bottom - (2 * IMAGE_FRAME_SIZE); + si.nMax = Info->Height; + SetScrollInfo(Info->hSelf, + SB_VERT, + &si, + TRUE); +} + + +static BOOL +LoadBlankCanvas(PEDIT_WND_INFO Info) +{ + /* FIXME: convert this to a DIB Section */ + /* set bitmap dimensions */ + Info->Width = Info->OpenInfo->New.Width; + Info->Height = Info->OpenInfo->New.Height; + + return TRUE; +} + +static BOOL +LoadDIBImage(PEDIT_WND_INFO Info) +{ + BITMAPFILEHEADER bmfh; + HANDLE hFile; + BITMAP bitmap; + DWORD BytesRead; + BOOL bSuccess, bRet = FALSE; + + hFile = CreateFile(Info->OpenInfo->Open.lpImagePath, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL); + if (hFile == INVALID_HANDLE_VALUE) + return bRet; + + bSuccess = ReadFile(hFile, + &bmfh, + sizeof(BITMAPFILEHEADER), + &BytesRead, + NULL); + + if (bSuccess && (BytesRead == sizeof(BITMAPFILEHEADER)) + && (bmfh.bfType == *(WORD *)"BM")) + { + DWORD InfoSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER); + + Info->pbmi = HeapAlloc(ProcessHeap, + 0, + InfoSize); + if (Info->pbmi) + { + bSuccess = ReadFile(hFile, + Info->pbmi, + InfoSize, + &BytesRead, + NULL); + + if (bSuccess && (BytesRead == InfoSize)) + { + Info->hBitmap = CreateDIBSection(NULL, + Info->pbmi, + DIB_RGB_COLORS, + (VOID *)&Info->pBits, + NULL, + 0); + if (Info->hBitmap != NULL) + { + ReadFile(hFile, + Info->pBits, + bmfh.bfSize - bmfh.bfOffBits, + &BytesRead, + NULL); + + GetObject(Info->hBitmap, + sizeof(BITMAP), + &bitmap); + + Info->Width = bitmap.bmWidth; + Info->Height = bitmap.bmHeight; + + bRet = TRUE; + } + } + } + } + else if (!bSuccess) + { + GetError(0); + } + + CloseHandle(hFile); + + return bRet; +} + + +static BOOL +InitEditWnd(PEDIT_WND_INFO Info) +{ + //BOOL bRet = FALSE; + + Info->Zoom = 100; + + if (Info->OpenInfo != NULL) + { + HDC hDC; + + if (Info->hDCMem) + { + DeleteObject(Info->hDCMem); + Info->hDCMem = NULL; + } + + hDC = GetDC(Info->hSelf); + Info->hDCMem = CreateCompatibleDC(hDC); + ReleaseDC(Info->hSelf, hDC); + + if (Info->OpenInfo->CreateNew) + { + LoadBlankCanvas(Info); + } + else + { + LoadDIBImage(Info); + } + + Info->OpenInfo = NULL; + } + + EditWndUpdateScrollInfo(Info); + + /* Add image editor to the list */ + Info->Next = Info->MainWnd->ImageEditors; + Info->MainWnd->ImageEditors = Info; + + InvalidateRect(Info->hSelf, + NULL, + TRUE); + + /* FIXME - if returning FALSE, remove the image editor from the list! */ + return TRUE; +} + +static VOID +DestroyEditWnd(PEDIT_WND_INFO Info) +{ + PEDIT_WND_INFO *PrevEditor; + PEDIT_WND_INFO Editor; + + DeleteDC(Info->hDCMem); + + /* FIXME - free resources and run down editor */ + HeapFree(ProcessHeap, + 0, + Info->pbmi); + HeapFree(ProcessHeap, + 0, + Info->pBits); + + /* Remove the image editor from the list */ + PrevEditor = &Info->MainWnd->ImageEditors; + Editor = Info->MainWnd->ImageEditors; + do + { + if (Editor == Info) + { + *PrevEditor = Info->Next; + break; + } + PrevEditor = &Editor->Next; + Editor = Editor->Next; + } while (Editor != NULL); +} + +static VOID +ImageEditWndRepaint(PEDIT_WND_INFO Info, + HDC hDC, + LPPAINTSTRUCT lpps) +{ + HBITMAP hOldBitmap; + + if (Info->hBitmap) + { + hOldBitmap = (HBITMAP) SelectObject(Info->hDCMem, + Info->hBitmap); + + BitBlt(hDC, + lpps->rcPaint.left, + lpps->rcPaint.top, + lpps->rcPaint.right - lpps->rcPaint.left, + lpps->rcPaint.bottom - lpps->rcPaint.top, + Info->hDCMem, + lpps->rcPaint.left, + lpps->rcPaint.top, + SRCCOPY); + + Info->hBitmap = SelectObject(Info->hDCMem, hOldBitmap); + } +} + +static LRESULT CALLBACK +ImageEditWndProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PEDIT_WND_INFO Info; + LRESULT Ret = 0; + HDC hDC; + static INT xMouse, yMouse; + static BOOL bLeftButtonDown, bRightButtonDown; + + /* Get the window context */ + Info = (PEDIT_WND_INFO)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (Info == NULL && uMsg != WM_CREATE) + { + goto HandleDefaultMessage; + } + + switch (uMsg) + { + case WM_CREATE: + { + Info = (PEDIT_WND_INFO)(((LPMDICREATESTRUCT)((LPCREATESTRUCT)lParam)->lpCreateParams)->lParam); + Info->hSelf = hwnd; + + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + (LONG_PTR)Info); + + if (!InitEditWnd(Info)) + { + Ret = (LRESULT)-1; + break; + } + break; + } +/* + case WM_ERASEBKGND: + if (Info->Width != 0 && Info->Height != 0) + { + Ret = TRUE; + } + break; +*/ + case WM_LBUTTONDOWN: + if (! bRightButtonDown) + SetCapture(Info->hSelf); + + bLeftButtonDown = TRUE; + xMouse = LOWORD(lParam); + yMouse = HIWORD(lParam); + + SetCursor(LoadCursor(hInstance, + MAKEINTRESOURCE(IDC_PAINTBRUSHCURSORMOUSEDOWN))); + break; + + case WM_LBUTTONUP: + if (bLeftButtonDown) + SetCapture(NULL); + + bLeftButtonDown = FALSE; + + break; + + case WM_RBUTTONDOWN: + if (! bLeftButtonDown) + SetCapture(Info->hSelf); + + bRightButtonDown = TRUE; + xMouse = LOWORD(lParam); + yMouse = HIWORD(lParam); + + SetCursor(LoadCursor(hInstance, + MAKEINTRESOURCE(IDC_PAINTBRUSHCURSORMOUSEDOWN))); + break; + + case WM_RBUTTONUP: + if (bRightButtonDown) + SetCapture(NULL); + + bRightButtonDown = FALSE; + + break; + + case WM_MOUSEMOVE: + { + HPEN hPen, hPenOld; + + if (!bLeftButtonDown && !bRightButtonDown) + break; + + hDC = GetDC(Info->hSelf); + + SelectObject(Info->hDCMem, + Info->hBitmap); + + if (bLeftButtonDown) + hPen = CreatePen(PS_SOLID, + 3, + RGB(0, 0, 0)); + else + hPen = CreatePen(PS_SOLID, + 3, + RGB(255, 255, 255)); + + hPenOld = SelectObject(hDC, + hPen); + SelectObject(Info->hDCMem, + hPen); + + MoveToEx(hDC, + xMouse, + yMouse, + NULL); + + MoveToEx(Info->hDCMem, + xMouse, + yMouse, + NULL); + + xMouse = (short)LOWORD(lParam); + yMouse = (short)HIWORD(lParam); + + LineTo(hDC, + xMouse, + yMouse); + + LineTo(Info->hDCMem, + xMouse, + yMouse); + + SelectObject(hDC, + hPenOld); + DeleteObject(SelectObject(Info->hDCMem, + hPenOld)); + + ReleaseDC(Info->hSelf, + hDC); + } + break; + + case WM_PAINT: + { + if (Info->Width != 0 && Info->Height != 0) + { + PAINTSTRUCT ps; + HDC hDC; + + hDC = BeginPaint(hwnd, + &ps); + if (hDC != NULL) + { + ImageEditWndRepaint(Info, + hDC, + &ps); + + EndPaint(hwnd, + &ps); + } + } + break; + } + + case WM_SIZE: + { + EditWndUpdateScrollInfo(Info); + goto HandleDefaultMessage; + } + + case WM_MENUSELECT: + case WM_ENTERMENULOOP: + case WM_EXITMENULOOP: + /* forward these messages to the main window procedure */ + Ret = SendMessage(Info->MainWnd->hSelf, + uMsg, + wParam, + lParam); + break; + + case WM_MDIACTIVATE: + /* Switch the main window context if neccessary */ + MainWndSwitchEditorContext(Info->MainWnd, + (HWND)wParam, + (HWND)lParam); + break; + + case WM_DESTROY: + { + DestroyEditWnd(Info); + + HeapFree(ProcessHeap, + 0, + Info); + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + 0); + break; + } + + default: +HandleDefaultMessage: + Ret = DefMDIChildProc(hwnd, + uMsg, + wParam, + lParam); + break; + } + + return Ret; +} + +VOID +SetImageEditorEnvironment(PEDIT_WND_INFO Info, + BOOL Setup) +{ + if (Setup) + { + /* FIXME - setup editor environment (e.g. show toolbars, enable menus etc) */ + } + else + { + /* FIXME - cleanup editor environment (e.g. hide toolbars, disable menus etc) */ + } +} + +BOOL +CreateImageEditWindow(PMAIN_WND_INFO MainWnd, + POPEN_IMAGE_EDIT_INFO OpenInfo) +{ + PEDIT_WND_INFO Info; + HWND hWndEditor; + LONG Width, Height; + + Info = HeapAlloc(ProcessHeap, + 0, + sizeof(EDIT_WND_INFO)); + if (Info != NULL) + { + ZeroMemory(Info, + sizeof(EDIT_WND_INFO)); + Info->MainWnd = MainWnd; + Info->MdiEditorType = metImageEditor; + Info->OpenInfo = OpenInfo; + + if (OpenInfo->CreateNew) + { + Width = OpenInfo->New.Width; + Height = OpenInfo->New.Height; + } + else + { + Width = CW_USEDEFAULT; + Height = CW_USEDEFAULT; + } + + hWndEditor = CreateMDIWindow(szImageEditWndClass, + OpenInfo->lpImageName, + WS_HSCROLL | WS_VSCROLL | WS_MAXIMIZE, + 200, + 200, + Width, + Height, + MainWnd->hMdiClient, + hInstance, + (LPARAM)Info); + + if (hWndEditor != NULL) + { + return TRUE; + } + + HeapFree(ProcessHeap, + 0, + Info); + } + + return FALSE; +} + +BOOL +InitImageEditWindowImpl(VOID) +{ + WNDCLASSEX wc = {0}; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = ImageEditWndProc; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, + MAKEINTRESOURCE(IDI_IMAGESOFTICON)); + wc.hCursor = LoadCursor(hInstance, + MAKEINTRESOURCE(IDC_PAINTBRUSHCURSOR)); + wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + wc.lpszClassName = szImageEditWndClass; + wc.hIconSm = (HICON)LoadImage(hInstance, + MAKEINTRESOURCE(IDI_IMAGESOFTICON), + IMAGE_ICON, + 16, + 16, + LR_SHARED); + + return RegisterClassEx(&wc) != (ATOM)0; +} + +VOID +UninitImageEditWindowImpl(VOID) +{ + UnregisterClass(szImageEditWndClass, + hInstance); +} diff --git a/rosapps/imagesoft/imgedwnd.h b/rosapps/imagesoft/imgedwnd.h new file mode 100644 index 00000000000..1e8b322b893 --- /dev/null +++ b/rosapps/imagesoft/imgedwnd.h @@ -0,0 +1,94 @@ +#define MONOCHROMEBITS 1 +#define GREYSCALEBITS 8 +#define PALLETEBITS 8 +#define TRUECOLORBITS 24 + +#define PIXELS 0 +#define CENTIMETERS 1 +#define INCHES 2 + + +/* generic definitions and forward declarations */ +struct _MAIN_WND_INFO; +struct _EDIT_WND_INFO; + + +typedef enum _MDI_EDITOR_TYPE { + metUnknown = 0, + metImageEditor, +} MDI_EDITOR_TYPE, *PMDI_EDITOR_TYPE; + +typedef enum +{ + tSelect = 0, + tMove, + tLasso, + tZoom, + tMagicWand, + tBrush, + tEraser, + tPencil, + tColorPick, + tStamp, + tFill, + tLine, + tPolyline, + tRectangle, + tRoundRectangle, + tPolygon, + tElipse, +} TOOL; + +typedef struct _OPEN_IMAGE_EDIT_INFO +{ + BOOL CreateNew; + union + { + struct + { + LONG Width; + LONG Height; + } New; + struct + { + LPTSTR lpImagePath; + } Open; + }; + LPTSTR lpImageName; + USHORT Type; + LONG Resolution; +} OPEN_IMAGE_EDIT_INFO, *POPEN_IMAGE_EDIT_INFO; + +typedef struct _EDIT_WND_INFO +{ + MDI_EDITOR_TYPE MdiEditorType; /* Must be first member! */ + + HWND hSelf; + HBITMAP hBitmap; + HDC hDCMem; + PBITMAPINFO pbmi; + PBYTE pBits; + struct _MAIN_WND_INFO *MainWnd; + struct _EDIT_WND_INFO *Next; + POINT ScrollPos; + USHORT Zoom; + DWORD Tool; + + POPEN_IMAGE_EDIT_INFO OpenInfo; /* Only valid during initialization */ + + /* Canvas properties */ + USHORT Type; + LONG Resolution; + /* size of drawing area */ + LONG Width; + LONG Height; + +} EDIT_WND_INFO, *PEDIT_WND_INFO; + + +BOOL CreateImageEditWindow(struct _MAIN_WND_INFO *MainWnd, + POPEN_IMAGE_EDIT_INFO OpenInfo); +VOID SetImageEditorEnvironment(PEDIT_WND_INFO Info, + BOOL Setup); +BOOL InitImageEditWindowImpl(VOID); +VOID UninitImageEditWindowImpl(VOID); diff --git a/rosapps/imagesoft/lang/en-GB.rc b/rosapps/imagesoft/lang/en-GB.rc new file mode 100644 index 00000000000..46d04d2c2d7 --- /dev/null +++ b/rosapps/imagesoft/lang/en-GB.rc @@ -0,0 +1,234 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ImageSoft" + IDS_VERSION "v0.1" +END + +IDR_MAINMENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New...", ID_NEW + MENUITEM "&Open...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&Close\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "C&lose all", ID_CLOSEALL,GRAYED + MENUITEM SEPARATOR + MENUITEM "&Save", ID_SAVE, GRAYED + MENUITEM "Save &As...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Print Pre&view", ID_PRINTPRE,GRAYED + MENUITEM "&Print...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "Pr&operties...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", ID_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo", ID_UNDO, GRAYED + MENUITEM "&Redo", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cu&t", ID_CUT, GRAYED + MENUITEM "&Copy", ID_COPY, GRAYED + MENUITEM "&Paste", ID_PASTE, GRAYED + MENUITEM "Paste as new &image", ID_PASTENEWIMAGE, GRAYED + MENUITEM SEPARATOR + MENUITEM "Select &All", ID_SELALL, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tools", ID_TOOLS + MENUITEM "&Colours", ID_COLOR + MENUITEM "&History", ID_HISTORY + MENUITEM "&Status Bar", ID_STATUSBAR + END + POPUP "&Adjust" + BEGIN + MENUITEM "Brightness...", ID_BRIGHTNESS + MENUITEM "Contrast...", ID_CONTRAST + MENUITEM "Hue/Saturation...", -1, GRAYED + POPUP "Colour" + BEGIN + MENUITEM "Black and White" ID_BLACKANDWHITE + MENUITEM "Invert Colours" ID_INVERTCOLORS + END + MENUITEM SEPARATOR + MENUITEM "Blur", ID_BLUR + MENUITEM "Sharpen", ID_SHARPEN + MENUITEM "Smooth Edges", -1, GRAYED + MENUITEM "Add Shadow", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "Image Size...", -1, GRAYED + MENUITEM "Flip", -1, GRAYED + MENUITEM "Mirror", -1, GRAYED + MENUITEM "Rotate", -1, GRAYED + + END + POPUP "&Colours" + BEGIN + MENUITEM "&Edit Colours...", ID_EDITCOLOURS + END + POPUP "&Window" + BEGIN + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ + MENUITEM "Tile &Vertically", ID_WINDOW_TILE_VERT + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "Nex&t\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_BRIGHTNESS DIALOGEX 6, 5, 193, 120 +CAPTION "Brightness" +FONT 8,"MS Sans Serif", 0, 0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "", IDC_PICPREVIEW, 0, 1, 132, 96, SS_OWNERDRAW | SS_SUNKEN + LTEXT "Colour form:", IDC_STATIC, 135, 5, 36, 9 + GROUPBOX "", IDC_BRI_GROUP, 138 ,30, 50, 48 + CONTROL "Full (RGB)", IDC_BRI_FULL, "Button", BS_AUTORADIOBUTTON, 138, 18, 46, 9 + CONTROL "Red", IDC_BRI_RED, "Button", BS_AUTORADIOBUTTON, 142, 38, 42, 9 + CONTROL "Green", IDC_BRI_GREEN, "Button", BS_AUTORADIOBUTTON, 142, 51, 42, 9 + CONTROL "Blue", IDC_BRI_BLUE, "Button", BS_AUTORADIOBUTTON, 142, 64, 42, 9 + EDITTEXT IDC_BRI_EDIT, 98, 103, 28, 13 + CONTROL "", IDC_BRI_TRACKBAR, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 2, 105, 90, 11 + PUSHBUTTON "OK", IDOK, 142, 88, 48, 13 + PUSHBUTTON "Cancel", IDCANCEL, 142, 105, 48, 13 +END + +IDD_ABOUTBOX DIALOGEX 22,16,210,182 +CAPTION "About ImageSoft" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +//EXSTYLE WS_EX_LAYERED +BEGIN + LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nThomas Weidenmueller (w3seek@reactos.org)\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Close", IDOK, 75, 162, 44, 15 + ICON IDI_IMAGESOFTICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + + +IDD_IMAGE_PROP DIALOGEX 6, 5, 156, 163 +CAPTION "Image Properties" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "Name:", IDC_STATIC, 12, 5, 38, 9 + EDITTEXT IDC_IMAGE_NAME_EDIT, 58, 3, 94, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Canvas properties", IDC_STATIC, 4, 22, 148, 98 + LTEXT "Image type:", IDC_STATIC, 12, 36, 42, 9 + CONTROL "", IDC_IMAGETYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 35, 88, 54 + LTEXT "Width:", IDC_STATIC, 12, 51, 42, 9 + EDITTEXT IDC_WIDTH_EDIT, 58, 49, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_WIDTH_STAT, 94, 51, 40, 9 + LTEXT "Height:", IDC_STATIC, 12, 68, 42, 9 + EDITTEXT IDC_HEIGHT_EDIT, 58, 66, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_HEIGHT_STAT, 94, 68, 40, 9 + LTEXT "Resolution:", IDC_STATIC, 12, 84, 42, 9 + EDITTEXT IDC_RES_EDIT, 58, 83, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_RES_STAT, 94, 84, 40, 9 + LTEXT "Unit:", IDC_STATIC, 12, 99, 42, 9 + CONTROL "", IDC_UNIT, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 99, 54, 50 + LTEXT "Image size:", IDC_STATIC, 12, 125, 42, 9 + LTEXT "", IDC_IMAGE_SIZE, 58, 125, 54, 9 + PUSHBUTTON "OK", IDOK, 50, 144, 48, 13 + PUSHBUTTON "Cancel", IDCANCEL, 102, 144, 48, 13 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." + IDS_READY " Ready." + IDS_TOOLBAR_STANDARD "Standard" + IDS_TOOLBAR_TEST "Test" + IDS_IMAGE_NAME "Image %1!u!" + IDS_FLT_TOOLS "Tools" + IDS_FLT_COLORS "Colours" + IDS_FLT_HISTORY "History" +END + +/* imageprop.c */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_IMAGE_MONOCHROME "Monochrome (1 bit)" + IDS_IMAGE_GREYSCALE "Greyscale (8 bit)" + IDS_IMAGE_PALETTE "Palette or 256 colour (8 bit)" + IDS_IMAGE_TRUECOLOR "True colour (24 bit)" + + IDS_UNIT_PIXELS "Pixels" + IDS_UNIT_CM "Cm" + IDS_UNIT_INCHES "Inches" + IDS_UNIT_DOTSCM "Dots / Cm" + IDS_UNIT_DPI "DPI" + IDS_UNIT_KB "%d KB" + IDS_UNIT_MB "%d MB" +END + +/* Tooltips */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_NEW "New" + IDS_TOOLTIP_OPEN "Open" + IDS_TOOLTIP_SAVE "Save" + IDS_TOOLTIP_PRINTPRE "Print preview" + IDS_TOOLTIP_PRINT "Print" + IDS_TOOLTIP_CUT "Cut" + IDS_TOOLTIP_COPY "Copy" + IDS_TOOLTIP_PASTE "Paste" + IDS_TOOLTIP_UNDO "Undo" + IDS_TOOLTIP_REDO "Redo" +END + + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " Creates a new document." + IDS_HINT_OPEN " Opens an existing document." + IDS_HINT_CLOSE " Closes this window." + IDS_HINT_CLOSEALL " Closes all windows." + IDS_HINT_SAVE " Saves the active document." + IDS_HINT_SAVEAS " Saves the active document with a new name." + IDS_HINT_PRINTPRE " Previews the printed document." + IDS_HINT_PRINT " Prints the active document." + IDS_HINT_PROP " Shows the properties of the active image." + IDS_HINT_EXIT " Exits this application." + + IDS_HINT_TOOLS " Shows or hides the tools floating window." + IDS_HINT_COLORS " Shows or hides the colours floating window." + IDS_HINT_HISTORY " Shows or hides the history floating window." + IDS_HINT_STATUS " Shows or hides the status bar." + + IDS_HINT_CASCADE " Arrange windows so they overlap." + IDS_HINT_TILE_HORZ " Arrange windows as non-overlapping tiles." + IDS_HINT_TILE_VERT " Arrange windows as non-overlapping tiles." + IDS_HINT_ARRANGE " Arrange icons at the bottom of the window." + IDS_HINT_NEXT " Activates the next window." + + IDS_HINT_SYS_RESTORE " Restores this window to normal size." + IDS_HINT_SYS_MOVE " Moves this window." + IDS_HINT_SYS_SIZE " Resizes this window." + IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon." + IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen." +END diff --git a/rosapps/imagesoft/lang/en-US.rc b/rosapps/imagesoft/lang/en-US.rc new file mode 100644 index 00000000000..a7718967e96 --- /dev/null +++ b/rosapps/imagesoft/lang/en-US.rc @@ -0,0 +1,234 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ImageSoft" + IDS_VERSION "v0.1" +END + +IDR_MAINMENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New...", ID_NEW + MENUITEM "&Open...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&Close\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "C&lose all", ID_CLOSEALL,GRAYED + MENUITEM SEPARATOR + MENUITEM "&Save", ID_SAVE, GRAYED + MENUITEM "Save &As...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Print Pre&view", ID_PRINTPRE,GRAYED + MENUITEM "&Print...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "Pr&operties...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", ID_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo", ID_UNDO, GRAYED + MENUITEM "&Redo", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cu&t", ID_CUT, GRAYED + MENUITEM "&Copy", ID_COPY, GRAYED + MENUITEM "&Paste", ID_PASTE, GRAYED + MENUITEM "Paste as new &image", ID_PASTENEWIMAGE, GRAYED + MENUITEM SEPARATOR + MENUITEM "Select &All", ID_SELALL, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tools", ID_TOOLS + MENUITEM "&Colors", ID_COLOR + MENUITEM "&History", ID_HISTORY + MENUITEM "&Status Bar", ID_STATUSBAR + END + POPUP "&Adjust" + BEGIN + MENUITEM "Brightness...", ID_BRIGHTNESS + MENUITEM "Contrast...", ID_CONTRAST + MENUITEM "Hue/Saturation...", -1, GRAYED + POPUP "Color" + BEGIN + MENUITEM "Black and White" ID_BLACKANDWHITE + MENUITEM "Invert Colors" ID_INVERTCOLORS + END + MENUITEM SEPARATOR + MENUITEM "Blur", ID_BLUR + MENUITEM "Sharpen", ID_SHARPEN + MENUITEM "Smooth Edges", -1, GRAYED + MENUITEM "Add Shadow", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "Image Size...", -1, GRAYED + MENUITEM "Flip", -1, GRAYED + MENUITEM "Mirror", -1, GRAYED + MENUITEM "Rotate", -1, GRAYED + + END + POPUP "&Colors" + BEGIN + MENUITEM "&Edit Colors...", ID_EDITCOLOURS + END + POPUP "&Window" + BEGIN + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ + MENUITEM "Tile &Vertically", ID_WINDOW_TILE_VERT + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "Nex&t\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_BRIGHTNESS DIALOGEX 6, 5, 193, 120 +CAPTION "Brightness" +FONT 8,"MS Sans Serif", 0, 0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "", IDC_PICPREVIEW, 0, 1, 132, 96, SS_OWNERDRAW | SS_SUNKEN + LTEXT "Color form:", IDC_STATIC, 135, 5, 36, 9 + GROUPBOX "", IDC_BRI_GROUP, 138 ,30, 50, 48 + CONTROL "Full (RGB)", IDC_BRI_FULL, "Button", BS_AUTORADIOBUTTON, 138, 18, 46, 9 + CONTROL "Red", IDC_BRI_RED, "Button", BS_AUTORADIOBUTTON, 142, 38, 42, 9 + CONTROL "Green", IDC_BRI_GREEN, "Button", BS_AUTORADIOBUTTON, 142, 51, 42, 9 + CONTROL "Blue", IDC_BRI_BLUE, "Button", BS_AUTORADIOBUTTON, 142, 64, 42, 9 + EDITTEXT IDC_BRI_EDIT, 98, 103, 28, 13 + CONTROL "", IDC_BRI_TRACKBAR, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 2, 105, 90, 11 + PUSHBUTTON "OK", IDOK, 142, 88, 48, 13 + PUSHBUTTON "Cancel", IDCANCEL, 142, 105, 48, 13 +END + +IDD_ABOUTBOX DIALOGEX 22,16,210,182 +CAPTION "About ImageSoft" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +//EXSTYLE WS_EX_LAYERED +BEGIN + LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nThomas Weidenmueller (w3seek@reactos.org)\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Close", IDOK, 75, 162, 44, 15 + ICON IDI_IMAGESOFTICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + + +IDD_IMAGE_PROP DIALOGEX 6, 5, 156, 163 +CAPTION "Image Properties" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "Name:", IDC_STATIC, 12, 5, 38, 9 + EDITTEXT IDC_IMAGE_NAME_EDIT, 58, 3, 94, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Canvas properties", IDC_STATIC, 4, 22, 148, 98 + LTEXT "Image type:", IDC_STATIC, 12, 36, 42, 9 + CONTROL "", IDC_IMAGETYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 35, 88, 54 + LTEXT "Width:", IDC_STATIC, 12, 51, 42, 9 + EDITTEXT IDC_WIDTH_EDIT, 58, 49, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_WIDTH_STAT, 94, 51, 40, 9 + LTEXT "Height:", IDC_STATIC, 12, 68, 42, 9 + EDITTEXT IDC_HEIGHT_EDIT, 58, 66, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_HEIGHT_STAT, 94, 68, 40, 9 + LTEXT "Resolution:", IDC_STATIC, 12, 84, 42, 9 + EDITTEXT IDC_RES_EDIT, 58, 83, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_RES_STAT, 94, 84, 40, 9 + LTEXT "Unit:", IDC_STATIC, 12, 99, 42, 9 + CONTROL "", IDC_UNIT, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 99, 54, 50 + LTEXT "Image size:", IDC_STATIC, 12, 125, 42, 9 + LTEXT "", IDC_IMAGE_SIZE, 58, 125, 54, 9 + PUSHBUTTON "OK", IDOK, 50, 144, 48, 13 + PUSHBUTTON "Cancel", IDCANCEL, 102, 144, 48, 13 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." + IDS_READY " Ready." + IDS_TOOLBAR_STANDARD "Standard" + IDS_TOOLBAR_TEST "Test" + IDS_IMAGE_NAME "Image %1!u!" + IDS_FLT_TOOLS "Tools" + IDS_FLT_COLORS "Colors" + IDS_FLT_HISTORY "History" +END + +/* imageprop.c */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_IMAGE_MONOCHROME "Monochrome (1 bit)" + IDS_IMAGE_GREYSCALE "Grayscale (8 bit)" + IDS_IMAGE_PALETTE "Palette or 256 color (8 bit)" + IDS_IMAGE_TRUECOLOR "True color (24 bit)" + + IDS_UNIT_PIXELS "Pixels" + IDS_UNIT_CM "Cm" + IDS_UNIT_INCHES "Inches" + IDS_UNIT_DOTSCM "Dots / Cm" + IDS_UNIT_DPI "DPI" + IDS_UNIT_KB "%d KB" + IDS_UNIT_MB "%d MB" +END + +/* Tooltips */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_NEW "New" + IDS_TOOLTIP_OPEN "Open" + IDS_TOOLTIP_SAVE "Save" + IDS_TOOLTIP_PRINTPRE "Print preview" + IDS_TOOLTIP_PRINT "Print" + IDS_TOOLTIP_CUT "Cut" + IDS_TOOLTIP_COPY "Copy" + IDS_TOOLTIP_PASTE "Paste" + IDS_TOOLTIP_UNDO "Undo" + IDS_TOOLTIP_REDO "Redo" +END + + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " Creates a new document." + IDS_HINT_OPEN " Opens an existing document." + IDS_HINT_CLOSE " Closes this window." + IDS_HINT_CLOSEALL " Closes all windows." + IDS_HINT_SAVE " Saves the active document." + IDS_HINT_SAVEAS " Saves the active document with a new name." + IDS_HINT_PRINTPRE " Previews the printed document." + IDS_HINT_PRINT " Prints the active document." + IDS_HINT_PROP " Shows the properties of the active image." + IDS_HINT_EXIT " Exits this application." + + IDS_HINT_TOOLS " Shows or hides the tools floating window." + IDS_HINT_COLORS " Shows or hides the colors floating window." + IDS_HINT_HISTORY " Shows or hides the history floating window." + IDS_HINT_STATUS " Shows or hides the status bar." + + IDS_HINT_CASCADE " Arrange windows so they overlap." + IDS_HINT_TILE_HORZ " Arrange windows as non-overlapping tiles." + IDS_HINT_TILE_VERT " Arrange windows as non-overlapping tiles." + IDS_HINT_ARRANGE " Arrange icons at the bottom of the window." + IDS_HINT_NEXT " Activates the next window." + + IDS_HINT_SYS_RESTORE " Restores this window to normal size." + IDS_HINT_SYS_MOVE " Moves this window." + IDS_HINT_SYS_SIZE " Resizes this window." + IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon." + IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen." +END diff --git a/rosapps/imagesoft/lang/id-ID.rc b/rosapps/imagesoft/lang/id-ID.rc new file mode 100644 index 00000000000..194c910942c --- /dev/null +++ b/rosapps/imagesoft/lang/id-ID.rc @@ -0,0 +1,234 @@ +LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ImageSoft" + IDS_VERSION "v0.1" +END + +IDR_MAINMENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Baru...", ID_NEW + MENUITEM "B&uka...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&Tutup\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "Tutup s&emua", ID_CLOSEALL,GRAYED + MENUITEM SEPARATOR + MENUITEM "&Simpan", ID_SAVE, GRAYED + MENUITEM "Simpan Seb&agai...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Tin&jau Cetakan", ID_PRINTPRE,GRAYED + MENUITEM "&Cetak...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "Pr&operti...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Keluar\tAlt+F4", ID_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo", ID_UNDO, GRAYED + MENUITEM "&Redo", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cu&t", ID_CUT, GRAYED + MENUITEM "&Copy", ID_COPY, GRAYED + MENUITEM "&Paste", ID_PASTE, GRAYED + MENUITEM "Paste sebagai gambar &baru", ID_PASTENEWIMAGE, GRAYED + MENUITEM SEPARATOR + MENUITEM "Pilih &Semua", ID_SELALL, GRAYED + END + POPUP "&Lihat" + BEGIN + MENUITEM "&Piranti", ID_TOOLS + MENUITEM "&Warna", ID_COLOR + MENUITEM "&Histori", ID_HISTORY + MENUITEM "Bar &Status", ID_STATUSBAR + END + POPUP "Sesu&aikan" + BEGIN + MENUITEM "Kecerahan...", ID_BRIGHTNESS + MENUITEM "Kontras...", ID_CONTRAST + MENUITEM "Hue/Saturasi...", -1, GRAYED + POPUP "Warna" + BEGIN + MENUITEM "Hitam dan Putih" ID_BLACKANDWHITE + MENUITEM "Balikkan Warna" ID_INVERTCOLORS + END + MENUITEM SEPARATOR + MENUITEM "Blur", ID_BLUR + MENUITEM "Sharpen", ID_SHARPEN + MENUITEM "Lembutkan Sisi", -1, GRAYED + MENUITEM "Tambah Bayangan", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "Ukuran Gambar...", -1, GRAYED + MENUITEM "Flip", -1, GRAYED + MENUITEM "Cermin", -1, GRAYED + MENUITEM "Rotasi", -1, GRAYED + + END + POPUP "&Warna" + BEGIN + MENUITEM "&Edit Warna...", ID_EDITCOLOURS + END + POPUP "&Jendela" + BEGIN + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "Tile &Horisontal", ID_WINDOW_TILE_HORZ + MENUITEM "Tile &Vertikal", ID_WINDOW_TILE_VERT + MENUITEM "&Atur Ikon", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "Beriku&t\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&Bantuan" + BEGIN + MENUITEM "&Tentang...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_BRIGHTNESS DIALOGEX 6, 5, 193, 120 +CAPTION "Kecerahan" +FONT 8,"MS Sans Serif", 0, 0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "", IDC_PICPREVIEW, 0, 1, 132, 96, SS_OWNERDRAW | SS_SUNKEN + LTEXT "Form warna:", IDC_STATIC, 135, 5, 36, 9 + GROUPBOX "", IDC_BRI_GROUP, 138 ,30, 50, 48 + CONTROL "Penuh (RGB)", IDC_BRI_FULL, "Button", BS_AUTORADIOBUTTON, 138, 18, 46, 9 + CONTROL "Merah", IDC_BRI_RED, "Button", BS_AUTORADIOBUTTON, 142, 38, 42, 9 + CONTROL "Hijau", IDC_BRI_GREEN, "Button", BS_AUTORADIOBUTTON, 142, 51, 42, 9 + CONTROL "Biru", IDC_BRI_BLUE, "Button", BS_AUTORADIOBUTTON, 142, 64, 42, 9 + EDITTEXT IDC_BRI_EDIT, 98, 103, 28, 13 + CONTROL "", IDC_BRI_TRACKBAR, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 2, 105, 90, 11 + PUSHBUTTON "OK", IDOK, 142, 88, 48, 13 + PUSHBUTTON "Batal", IDCANCEL, 142, 105, 48, 13 +END + +IDD_ABOUTBOX DIALOGEX 22,16,210,182 +CAPTION "Tentang ImageSoft" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +//EXSTYLE WS_EX_LAYERED +BEGIN + LTEXT "ImageSoft v0.1\nHak Cipta (C) 2006\nThomas Weidenmueller (w3seek@reactos.org)\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Tutup", IDOK, 75, 162, 44, 15 + ICON IDI_IMAGESOFTICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + + +IDD_IMAGE_PROP DIALOGEX 6, 5, 156, 163 +CAPTION "Properti Gambar" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "Nama:", IDC_STATIC, 12, 5, 38, 9 + EDITTEXT IDC_IMAGE_NAME_EDIT, 58, 3, 94, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Properti Kanvas", IDC_STATIC, 4, 22, 148, 98 + LTEXT "Tipe gambar:", IDC_STATIC, 12, 36, 42, 9 + CONTROL "", IDC_IMAGETYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 35, 88, 54 + LTEXT "Panjang:", IDC_STATIC, 12, 51, 42, 9 + EDITTEXT IDC_WIDTH_EDIT, 58, 49, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_WIDTH_STAT, 94, 51, 40, 9 + LTEXT "Tinggi:", IDC_STATIC, 12, 68, 42, 9 + EDITTEXT IDC_HEIGHT_EDIT, 58, 66, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_HEIGHT_STAT, 94, 68, 40, 9 + LTEXT "Resolusi:", IDC_STATIC, 12, 84, 42, 9 + EDITTEXT IDC_RES_EDIT, 58, 83, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_RES_STAT, 94, 84, 40, 9 + LTEXT "Unit:", IDC_STATIC, 12, 99, 42, 9 + CONTROL "", IDC_UNIT, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 99, 54, 50 + LTEXT "Besar gambar:", IDC_STATIC, 12, 125, 42, 9 + LTEXT "", IDC_IMAGE_SIZE, 58, 125, 54, 9 + PUSHBUTTON "OK", IDOK, 50, 144, 48, 13 + PUSHBUTTON "Batal", IDCANCEL, 102, 144, 48, 13 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "Program ini adalah software bebas; anda dapat mendistribusikan dan/atau mengubahnya di bawah term GNU General Public License seperti dipublikasikan oleh Free Software Foundation; baik Lisensi versi 2, atau (menurut opini anda) setiap versi berikutnya.\r\n\r\nProgram ini didistribusikan dengan harapan ia akan berguna, tetapi TANPA JAMINAN APAPUN; bahkan tanpa jaminan berarti dari MERCANTABILITAS atau KECUKUPAN UNTUK KEPERLUAN TERTENTU. Lihat GNU General Public License untuk lebih jelasnya.\r\n\r\nAnda seharusnya menerima duplikat GNU General Public License bersamaan dengan program ini; jika tidak, tulis ke Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." + IDS_READY " Siap." + IDS_TOOLBAR_STANDARD "Standar" + IDS_TOOLBAR_TEST "Uji" + IDS_IMAGE_NAME "Gambar %1!u!" + IDS_FLT_TOOLS "Piranti" + IDS_FLT_COLORS "Warna" + IDS_FLT_HISTORY "Histori" +END + +/* imageprop.c */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_IMAGE_MONOCHROME "Monokrom (1 bit)" + IDS_IMAGE_GREYSCALE "Abu-abu (8 bit)" + IDS_IMAGE_PALETTE "Palet atau 256 warna (8 bit)" + IDS_IMAGE_TRUECOLOR "Warna asli (24 bit)" + + IDS_UNIT_PIXELS "Pixel" + IDS_UNIT_CM "Cm" + IDS_UNIT_INCHES "Inci" + IDS_UNIT_DOTSCM "Dot / Cm" + IDS_UNIT_DPI "DPI" + IDS_UNIT_KB "%d KB" + IDS_UNIT_MB "%d MB" +END + +/* Tooltips */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_NEW "Baru" + IDS_TOOLTIP_OPEN "Buka" + IDS_TOOLTIP_SAVE "Simpan" + IDS_TOOLTIP_PRINTPRE "Tinjau cetakan" + IDS_TOOLTIP_PRINT "Cetak" + IDS_TOOLTIP_CUT "Cut" + IDS_TOOLTIP_COPY "Copy" + IDS_TOOLTIP_PASTE "Paste" + IDS_TOOLTIP_UNDO "Undo" + IDS_TOOLTIP_REDO "Redo" +END + + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " Membuat dokumen baru." + IDS_HINT_OPEN " Membuka dokumen yang sudah ada." + IDS_HINT_CLOSE " Menutup jendela ini." + IDS_HINT_CLOSEALL " Menutup semua jendela." + IDS_HINT_SAVE " Menyimpan dokumen aktif." + IDS_HINT_SAVEAS " Menyimpan dokumen aktif dengan nama baru." + IDS_HINT_PRINTPRE " Meninjau dulu dokumen yang dicetak." + IDS_HINT_PRINT " Mencetak dokumen aktif." + IDS_HINT_PROP " Menampilkan properti gambar yang aktif." + IDS_HINT_EXIT " Keluar aplikasi ini." + + IDS_HINT_TOOLS " Menampilkan atau menyembunyikan jendela layang piranti." + IDS_HINT_COLORS " Menampilkan atau menyembunyikan jendela layang warna." + IDS_HINT_HISTORY " Menampilkan atau menyembunyikan jendela layang histori." + IDS_HINT_STATUS " Menampilkan atau menyembunyikan bar status." + + IDS_HINT_CASCADE " Mengatur jendela agar saling tindih." + IDS_HINT_TILE_HORZ " Mengatur jendela seperti ubin tidak saling tindih." + IDS_HINT_TILE_VERT " Mengatur jendela seperti ubin tidak saling tindih." + IDS_HINT_ARRANGE " Mengatur ikon di bawah jendela." + IDS_HINT_NEXT " Mengaktifkan jendela berikutnya." + + IDS_HINT_SYS_RESTORE " Mengembalikan jendela ini ke ukuran normal." + IDS_HINT_SYS_MOVE " Memindahkan jendela ini." + IDS_HINT_SYS_SIZE " Mengukur ulang jendela ini." + IDS_HINT_SYS_MINIMIZE " Menyempitkan jendela ini menjadi ikon." + IDS_HINT_SYS_MAXIMIZE " Melebarkan jendela ini memenuhi layar ini." +END diff --git a/rosapps/imagesoft/lang/it-IT.rc b/rosapps/imagesoft/lang/it-IT.rc new file mode 100644 index 00000000000..975c9d8f278 --- /dev/null +++ b/rosapps/imagesoft/lang/it-IT.rc @@ -0,0 +1,234 @@ +LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ImageSoft" + IDS_VERSION "v0.1" +END + +IDR_MAINMENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Nuovo...", ID_NEW + MENUITEM "&Apri...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&Chiudi\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "C&hiudi tutto", ID_CLOSEALL,GRAYED + MENUITEM SEPARATOR + MENUITEM "&Salva", ID_SAVE, GRAYED + MENUITEM "Salva Co&me...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Ant&eprima di stampa", ID_PRINTPRE,GRAYED + MENUITEM "S&tampa...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "Pr&opriet...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Esci\tAlt+F4", ID_EXIT + END + POPUP "&Modifica" + BEGIN + MENUITEM "&Undo", ID_UNDO, GRAYED + MENUITEM "&Redo", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Taglia", ID_CUT, GRAYED + MENUITEM "&Copia", ID_COPY, GRAYED + MENUITEM "&Incolla", ID_PASTE, GRAYED + MENUITEM "Incolla come &nuova immagine", ID_PASTENEWIMAGE, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Seleziona tutto", ID_SELALL, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Strumenti", ID_TOOLS + MENUITEM "&Colori", ID_COLOR + MENUITEM "&Azioni", ID_HISTORY + MENUITEM "&Barra di stato", ID_STATUSBAR + END + POPUP "&Adjust" + BEGIN + MENUITEM "Luminosit...", ID_BRIGHTNESS + MENUITEM "Contrasto...", ID_CONTRAST + MENUITEM "Hue/Saturatione...", -1, GRAYED + POPUP "Colore" + BEGIN + MENUITEM "Bianco e nero" ID_BLACKANDWHITE + MENUITEM "Inveri i colori" ID_INVERTCOLORS + END + MENUITEM SEPARATOR + MENUITEM "Soffuso", ID_BLUR + MENUITEM "Nitido", ID_SHARPEN + MENUITEM "Bordi arrotondati", -1, GRAYED + MENUITEM "Ombra", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "Dimensione immagine...", -1, GRAYED + MENUITEM "Ribalta", -1, GRAYED + MENUITEM "Specchio", -1, GRAYED + MENUITEM "Ruota", -1, GRAYED + + END + POPUP "&Colori" + BEGIN + MENUITEM "&Modifica i colori...", ID_EDITCOLOURS + END + POPUP "&Finestre" + BEGIN + MENUITEM "&Sovrapponi", ID_WINDOW_CASCADE + MENUITEM "Affianca &Orizontalmente", ID_WINDOW_TILE_HORZ + MENUITEM "Affianca &Verticalmente", ID_WINDOW_TILE_VERT + MENUITEM "&Disponi Icone", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "Succ&essiva\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&Aiuto" + BEGIN + MENUITEM "&Informazioni...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_BRIGHTNESS DIALOGEX 6, 5, 193, 120 +CAPTION "Luminosit" +FONT 8,"MS Sans Serif", 0, 0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "", IDC_PICPREVIEW, 0, 1, 132, 96, SS_OWNERDRAW | SS_SUNKEN + LTEXT "Tipo colore:", IDC_STATIC, 135, 5, 36, 9 + GROUPBOX "", IDC_BRI_GROUP, 138 ,30, 50, 48 + CONTROL "Full (RGB)", IDC_BRI_FULL, "Button", BS_AUTORADIOBUTTON, 138, 18, 46, 9 + CONTROL "Rosso", IDC_BRI_RED, "Button", BS_AUTORADIOBUTTON, 142, 38, 42, 9 + CONTROL "Verde", IDC_BRI_GREEN, "Button", BS_AUTORADIOBUTTON, 142, 51, 42, 9 + CONTROL "Blu", IDC_BRI_BLUE, "Button", BS_AUTORADIOBUTTON, 142, 64, 42, 9 + EDITTEXT IDC_BRI_EDIT, 98, 103, 28, 13 + CONTROL "", IDC_BRI_TRACKBAR, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 2, 105, 90, 11 + PUSHBUTTON "OK", IDOK, 142, 88, 48, 13 + PUSHBUTTON "Annulla", IDCANCEL, 142, 105, 48, 13 +END + +IDD_ABOUTBOX DIALOGEX 22,16,210,182 +CAPTION "Informazioni su ImageSoft" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +//EXSTYLE WS_EX_LAYERED +BEGIN + LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nThomas Weidenmueller (w3seek@reactos.org)\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Chiudi", IDOK, 75, 162, 44, 15 + ICON IDI_IMAGESOFTICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + + +IDD_IMAGE_PROP DIALOGEX 6, 5, 156, 163 +CAPTION "Propriet dell'immagine" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "Nome:", IDC_STATIC, 12, 5, 38, 9 + EDITTEXT IDC_IMAGE_NAME_EDIT, 58, 3, 94, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "Propriet Canvas", IDC_STATIC, 4, 22, 148, 98 + LTEXT "Tipo immagine:", IDC_STATIC, 12, 36, 42, 9 + CONTROL "", IDC_IMAGETYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 35, 88, 54 + LTEXT "Larghezza:", IDC_STATIC, 12, 51, 42, 9 + EDITTEXT IDC_WIDTH_EDIT, 58, 49, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_WIDTH_STAT, 94, 51, 40, 9 + LTEXT "Altezza:", IDC_STATIC, 12, 68, 42, 9 + EDITTEXT IDC_HEIGHT_EDIT, 58, 66, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_HEIGHT_STAT, 94, 68, 40, 9 + LTEXT "Risoluzione:", IDC_STATIC, 12, 84, 42, 9 + EDITTEXT IDC_RES_EDIT, 58, 83, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_RES_STAT, 94, 84, 40, 9 + LTEXT "Unit:", IDC_STATIC, 12, 99, 42, 9 + CONTROL "", IDC_UNIT, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 99, 54, 50 + LTEXT "Dimensione:", IDC_STATIC, 12, 125, 42, 9 + LTEXT "", IDC_IMAGE_SIZE, 58, 125, 54, 9 + PUSHBUTTON "OK", IDOK, 50, 144, 48, 13 + PUSHBUTTON "Annulla", IDCANCEL, 102, 144, 48, 13 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "Questo programma software libero; puoi distribuirlo e/o modificarlo nei termini di licenza di 'GNU General Public License' come pubblicata dalla 'Free Software Foundation'; entrambe le versioni 2 della Licenza, o (a vostra scelta) qualunque versione successiva.\r\n\r\nQuesto programma distribuito con l'augurio che sia utile, ma PRIVO DI OGNI GARANZIA; privo anche della garanzia implicita di VENDIBILITA' o ADEGUATEZZA PER UNO SPECIFICO USO. Vedi la 'GNU General Public License' per ulteriori dettagli.\r\n\r\nVoi dovreste aver ricevuto una copia della 'GNU General Public License' assieme a questo programma; se non cosi' scrivete a 'Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA'." + IDS_READY "Pronto." + IDS_TOOLBAR_STANDARD "Standard" + IDS_TOOLBAR_TEST "Test" + IDS_IMAGE_NAME "Immagine %1!u!" + IDS_FLT_TOOLS "Strumenti" + IDS_FLT_COLORS "Colori" + IDS_FLT_HISTORY "Azioni" +END + +/* imageprop.c */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_IMAGE_MONOCHROME "Monocromatico (1 bit)" + IDS_IMAGE_GREYSCALE "Toni di grigio (8 bit)" + IDS_IMAGE_PALETTE "Palette o 256 colori (8 bit)" + IDS_IMAGE_TRUECOLOR "True color (24 bit)" + + IDS_UNIT_PIXELS "Pixel" + IDS_UNIT_CM "Cm" + IDS_UNIT_INCHES "Inches" + IDS_UNIT_DOTSCM "Dots / Cm" + IDS_UNIT_DPI "DPI" + IDS_UNIT_KB "%d KB" + IDS_UNIT_MB "%d MB" +END + +/* Tooltips */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_NEW "Nuova" + IDS_TOOLTIP_OPEN "Apri" + IDS_TOOLTIP_SAVE "Salva" + IDS_TOOLTIP_PRINTPRE "Anteprima di stampa" + IDS_TOOLTIP_PRINT "stampa" + IDS_TOOLTIP_CUT "Taglia" + IDS_TOOLTIP_COPY "Copia" + IDS_TOOLTIP_PASTE "Incolla" + IDS_TOOLTIP_UNDO "Undo" + IDS_TOOLTIP_REDO "Redo" +END + + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " Crea un nuovo documento." + IDS_HINT_OPEN " Apre un documento esistente." + IDS_HINT_CLOSE " Chide questa finestra." + IDS_HINT_CLOSEALL " Chiude tutte le finestre." + IDS_HINT_SAVE " Salva il documento attivo." + IDS_HINT_SAVEAS " Salva il documento attivo con un nuovo nome." + IDS_HINT_PRINTPRE " Anteprima del documento stampato." + IDS_HINT_PRINT " Stampa il documento attivo." + IDS_HINT_PROP " Mostra le proprieta' dell'immagine attiva." + IDS_HINT_EXIT " Chiude il programma." + + IDS_HINT_TOOLS " Mostra o nasconde la finestra mobile degli strumenti." + IDS_HINT_COLORS " Mostra o nasconde la finestra mobile dei colori." + IDS_HINT_HISTORY " Mostra o nasconde la finestra mobile delle azioni." + IDS_HINT_STATUS " Mostra o nasconde la barra di stato." + + IDS_HINT_CASCADE " Dispone le finestre in modo che siano sovrapposte." + IDS_HINT_TILE_HORZ " Dispone le finestre in modo che non siano sovrapposte." + IDS_HINT_TILE_VERT " Dispone le finestre in modo che non siano sovrapposte." + IDS_HINT_ARRANGE " Dispone le icone in basso nella finestra." + IDS_HINT_NEXT " Attiva la finestra successiva." + + IDS_HINT_SYS_RESTORE " Ripristina la dimensione normale della finestra." + IDS_HINT_SYS_MOVE " Muova la finestra." + IDS_HINT_SYS_SIZE " Modifica la dimensione della finestra." + IDS_HINT_SYS_MINIMIZE " Riduce la finestra a una icona." + IDS_HINT_SYS_MAXIMIZE " Espande la finestra fino a riempire lo schermo." +END diff --git a/rosapps/imagesoft/lang/nb-NO.rc b/rosapps/imagesoft/lang/nb-NO.rc new file mode 100644 index 00000000000..f2319487560 --- /dev/null +++ b/rosapps/imagesoft/lang/nb-NO.rc @@ -0,0 +1,206 @@ +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ImageSoft" + IDS_VERSION "v0.1" +END + +IDR_MAINMENU MENU +BEGIN + POPUP "&Fil" + BEGIN + MENUITEM "&Ny...", ID_NEW + MENUITEM "&pne...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&Lukk\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "L&ukk alt", ID_CLOSEALL, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Lagre", ID_SAVE, GRAYED + MENUITEM "Lagre &som...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Utskrift &Forhndsvisning", ID_PRINTPRE, GRAYED + MENUITEM "&Utskrift...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&genskaper...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "A&vslutt\tAlt+F4", ID_EXIT + END + POPUP "&Rediger" + BEGIN + MENUITEM "&Angre", ID_UNDO, GRAYED + MENUITEM "&Gjenta", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Klipp &ut", ID_CUT, GRAYED + MENUITEM "&Kopier", ID_COPY, GRAYED + MENUITEM "&Lim inn", ID_PASTE, GRAYED + MENUITEM "lim inn som ny &bilde", ID_PASTENEWIMAGE, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Velg Alt", ID_SELALL, GRAYED + END + POPUP "&Vis" + BEGIN + MENUITEM "&Verty", ID_TOOLS, CHECKED + MENUITEM "&Farger", ID_COLOR, CHECKED + MENUITEM "&Historie", ID_HISTORY, CHECKED + MENUITEM "&Statuslinje", ID_STATUSBAR, CHECKED + END + POPUP "&Bilde" + BEGIN + MENUITEM "&Crop...", -1, GRAYED + MENUITEM "&Endre strrelse ...", -1, GRAYED + MENUITEM "R&oter ...", -1, GRAYED + MENUITEM "&Flip...", -1, GRAYED + MENUITEM "&Strekk...", -1, GRAYED + MENUITEM "S&kew...", -1, GRAYED + MENUITEM "&Inverter Farger", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Attributter...", -1, GRAYED + END + POPUP "&Farger" + BEGIN + MENUITEM "&Rediger farger...", ID_EDITCOLOURS + END + POPUP "&vindu" + BEGIN + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "Sorter &horisontalt", ID_WINDOW_TILE_HORZ + MENUITEM "Sorter &vertikalt", ID_WINDOW_TILE_VERT + MENUITEM "&Ordne Ikoner", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "Nes&te\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&Hjelp" + BEGIN + MENUITEM "&Om...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_ABOUTBOX DIALOGEX 22,16,210,182 +CAPTION "Om ImageSoft" +FONT 8,"Tahoma",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +//EXSTYLE WS_EX_LAYERED +BEGIN + LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nThomas Weidenmueller (w3seek@reactos.org)\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Lukk", IDOK, 75, 162, 44, 15 + ICON IDI_IMAGESOFTICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + + +IDD_IMAGE_PROP DIALOGEX 6, 5, 156, 163 +CAPTION "Bilde egenskaper" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "Navn:", IDC_STATIC, 12, 5, 38, 9 + EDITTEXT IDC_IMAGE_NAME_EDIT, 58, 3, 94, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "maleri egenskaper", IDC_STATIC, 4, 22, 148, 98 + LTEXT "bilde type:", IDC_STATIC, 12, 36, 42, 9 + CONTROL "", IDC_IMAGETYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 35, 88, 54 + LTEXT "Lengde:", IDC_STATIC, 12, 51, 42, 9 + EDITTEXT IDC_WIDTH_EDIT, 58, 49, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_WIDTH_STAT, 94, 51, 40, 9 + LTEXT "Hyde:", IDC_STATIC, 12, 68, 42, 9 + EDITTEXT IDC_HEIGHT_EDIT, 58, 66, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_HEIGHT_STAT, 94, 68, 40, 9 + LTEXT "Opplsning:", IDC_STATIC, 12, 84, 42, 9 + EDITTEXT IDC_RES_EDIT, 58, 83, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_RES_STAT, 94, 84, 40, 9 + LTEXT "Enhet:", IDC_STATIC, 12, 99, 42, 9 + CONTROL "", IDC_UNIT, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 99, 54, 50 + LTEXT "bilde strrelse:", IDC_STATIC, 12, 125, 42, 9 + LTEXT "", IDC_IMAGE_SIZE, 58, 125, 54, 9 + PUSHBUTTON "OK", IDOK, 50, 144, 48, 13 + PUSHBUTTON "Avbryt", IDCANCEL, 102, 144, 48, 13 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." + IDS_READY " Klart." + IDS_TOOLBAR_STANDARD "Standard" + IDS_TOOLBAR_TEST "Test" + IDS_IMAGE_NAME "Bilde %1!u!" + IDS_FLT_TOOLS "Verkty" + IDS_FLT_COLORS "Farger" + IDS_FLT_HISTORY "Historie" +END + +/* imageprop.c */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_IMAGE_MONOCHROME "Monokromt (1 bit)" + IDS_IMAGE_GREYSCALE "Grverdiskala (8 bit)" + IDS_IMAGE_PALETTE "Palett eller 256 farger (8 bit)" + IDS_IMAGE_TRUECOLOR "Nyaktig farger (24 bit)" + + IDS_UNIT_PIXELS "pikseler" + IDS_UNIT_CM "Cm" + IDS_UNIT_INCHES "tommer" + IDS_UNIT_DOTSCM "Tommer / Cm" + IDS_UNIT_DPI "DPI" + IDS_UNIT_KB "%d KB" + IDS_UNIT_MB "%d MB" +END + +/* Tooltips */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_NEW "Ny" + IDS_TOOLTIP_OPEN "pne" + IDS_TOOLTIP_SAVE "Lagre" + IDS_TOOLTIP_PRINTPRE "Utskrift &Forhndsvisning" + IDS_TOOLTIP_PRINT "Utskrift" + IDS_TOOLTIP_CUT "Klipp ut" + IDS_TOOLTIP_COPY "Kopier" + IDS_TOOLTIP_PASTE "Lim inn" + IDS_TOOLTIP_UNDO "Angre" + IDS_TOOLTIP_REDO "Gjenta" +END + + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " pne et nytt dokument." + IDS_HINT_OPEN " pene en eksisterende dokument." + IDS_HINT_CLOSE " Lukk dette vinduet." + IDS_HINT_CLOSEALL " Lukk alle vinduer." + IDS_HINT_SAVE " Lagre aktive dokument." + IDS_HINT_SAVEAS " Lagre aktive dokument med nytt navn." + IDS_HINT_PRINTPRE " Forhndsvis utskrift." + IDS_HINT_PRINT " Skriv ut aktive dokument." + IDS_HINT_PROP " Vis egenskaper for aktive bilde." + IDS_HINT_EXIT " Avslutt denne applikasjonen." + + IDS_HINT_TOOLS " Vis eller skjul verkty floating vindu." + IDS_HINT_COLORS " Vis eller skjul fargene floating vindu." + IDS_HINT_HISTORY " Vis eller skjul historie floating vindu." + IDS_HINT_STATUS " Vis eller skjul statuslinje." + + IDS_HINT_CASCADE " Ordne vinduer s de overlapper." + IDS_HINT_TILE_HORZ " Ordne vinduer s ingen-overlapper tittelen." + IDS_HINT_TILE_VERT " Ordne vinduer s ingen-overlapper tittelen." + IDS_HINT_ARRANGE " Ordne ikoner ved knappen av vinduet." + IDS_HINT_NEXT " Aktivere neste vinduet." + + IDS_HINT_SYS_RESTORE " Endre vinduet til normal strrelse." + IDS_HINT_SYS_MOVE " Flytt vinduet." + IDS_HINT_SYS_SIZE " Endre strrelse p dette vinduet." + IDS_HINT_SYS_MINIMIZE " Minimer vinduet til en ikon." + IDS_HINT_SYS_MAXIMIZE " Expands dette vindu for fylle skjermen." +END diff --git a/rosapps/imagesoft/lang/th-TH.rc b/rosapps/imagesoft/lang/th-TH.rc new file mode 100644 index 00000000000..8a594a866f7 --- /dev/null +++ b/rosapps/imagesoft/lang/th-TH.rc @@ -0,0 +1,234 @@ +LANGUAGE LANG_THAI, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ImageSoft" + IDS_VERSION "v0.1" +END + +IDR_MAINMENU MENU +BEGIN + POPUP "&" + BEGIN + MENUITEM "&...", ID_NEW + MENUITEM "&Դ...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "Դ&", ID_CLOSEALL,GRAYED + MENUITEM SEPARATOR + MENUITEM "&ѹ֡", ID_SAVE, GRAYED + MENUITEM "ѹ&֡ ...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Ҿ͹", ID_PRINTPRE,GRAYED + MENUITEM "&...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "&سѵ...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "&͡ҡ\tAlt+F4", ID_EXIT + END + POPUP "&" + BEGIN + MENUITEM "&ԡ", ID_UNDO, GRAYED + MENUITEM "&͹Ѻ", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Ѵ", ID_CUT, GRAYED + MENUITEM "&Ѵ͡", ID_COPY, GRAYED + MENUITEM "&ҧ", ID_PASTE, GRAYED + MENUITEM "&Ҿ", ID_PASTENEWIMAGE, GRAYED + MENUITEM SEPARATOR + MENUITEM "͡&", ID_SELALL, GRAYED + END + POPUP "&ͧ" + BEGIN + MENUITEM "ͧ&", ID_TOOLS + MENUITEM "&", ID_COLOR + MENUITEM "&ѵ", ID_HISTORY + MENUITEM "&ʶҹ", ID_STATUSBAR + END + POPUP "&Ѻ" + BEGIN + MENUITEM "ҧ...", ID_BRIGHTNESS + MENUITEM "Ѵ...", ID_CONTRAST + MENUITEM "ʧ/...", -1, GRAYED + POPUP "" + BEGIN + MENUITEM "ҾǴ" ID_BLACKANDWHITE + MENUITEM "ŧ" ID_INVERTCOLORS + END + MENUITEM SEPARATOR + MENUITEM "", ID_BLUR + MENUITEM "Ѵ", ID_SHARPEN + MENUITEM "ͺ", -1, GRAYED + MENUITEM "", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "ҴҾ...", -1, GRAYED + MENUITEM "Ѻȷҧ", -1, GRAYED + MENUITEM "Ѻҹ", -1, GRAYED + MENUITEM "ع", -1, GRAYED + + END + POPUP "&" + BEGIN + MENUITEM "&...", ID_EDITCOLOURS + END + POPUP "&˹ҵҧ" + BEGIN + MENUITEM "&͹ѹ", ID_WINDOW_CASCADE + MENUITEM "ҧ§&͹", ID_WINDOW_TILE_HORZ + MENUITEM "ҧ§&", ID_WINDOW_TILE_VERT + MENUITEM "Ѵ§ѭ&ٻ", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "&Ѵ\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&" + BEGIN + MENUITEM "&ǡѺ...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "Դ˹ҵҧ" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_BRIGHTNESS DIALOGEX 6, 5, 193, 120 +CAPTION "ҧ" +FONT 8,"MS Sans Serif", 0, 0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "", IDC_PICPREVIEW, 0, 1, 132, 96, SS_OWNERDRAW | SS_SUNKEN + LTEXT "ٻẺ:", IDC_STATIC, 135, 5, 36, 9 + GROUPBOX "", IDC_BRI_GROUP, 138 ,30, 50, 48 + CONTROL "ء (RGB)", IDC_BRI_FULL, "", BS_AUTORADIOBUTTON, 138, 18, 46, 9 + CONTROL "ᴧ", IDC_BRI_RED, "Button", BS_AUTORADIOBUTTON, 142, 38, 42, 9 + CONTROL "", IDC_BRI_GREEN, "", BS_AUTORADIOBUTTON, 142, 51, 42, 9 + CONTROL "Թ", IDC_BRI_BLUE, "", BS_AUTORADIOBUTTON, 142, 64, 42, 9 + EDITTEXT IDC_BRI_EDIT, 98, 103, 28, 13 + CONTROL "", IDC_BRI_TRACKBAR, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 2, 105, 90, 11 + PUSHBUTTON "ŧ", IDOK, 142, 88, 48, 13 + PUSHBUTTON "¡ԡ", IDCANCEL, 142, 105, 48, 13 +END + +IDD_ABOUTBOX DIALOGEX 22,16,210,182 +CAPTION "ǡѺ ImageSoft" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +//EXSTYLE WS_EX_LAYERED +BEGIN + LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nThomas Weidenmueller (w3seek@reactos.org)\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Դ", IDOK, 75, 162, 44, 15 + ICON IDI_IMAGESOFTICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + + +IDD_IMAGE_PROP DIALOGEX 6, 5, 156, 163 +CAPTION "سѵԢͧҾ" +FONT 8,"MS Sans Serif",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT ":", IDC_STATIC, 12, 5, 38, 9 + EDITTEXT IDC_IMAGE_NAME_EDIT, 58, 3, 94, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + GROUPBOX "سѵԢͧҴ鹷Ҿ", IDC_STATIC, 4, 22, 148, 98 + LTEXT "ٻҾ:", IDC_STATIC, 12, 36, 42, 9 + CONTROL "", IDC_IMAGETYPE, "ͧͧ", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 35, 88, 54 + LTEXT "ҧ:", IDC_STATIC, 12, 51, 42, 9 + EDITTEXT IDC_WIDTH_EDIT, 58, 49, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_WIDTH_STAT, 94, 51, 40, 9 + LTEXT "٧:", IDC_STATIC, 12, 68, 42, 9 + EDITTEXT IDC_HEIGHT_EDIT, 58, 66, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_HEIGHT_STAT, 94, 68, 40, 9 + LTEXT "´ͧҾ:", IDC_STATIC, 12, 84, 42, 9 + EDITTEXT IDC_RES_EDIT, 58, 83, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_NUMBER + LTEXT "", IDC_RES_STAT, 94, 84, 40, 9 + LTEXT "˹:", IDC_STATIC, 12, 99, 42, 9 + CONTROL "", IDC_UNIT, "ͧͧ", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 58, 99, 54, 50 + LTEXT "ҴҾ:", IDC_STATIC, 12, 125, 42, 9 + LTEXT "", IDC_IMAGE_SIZE, 58, 125, 54, 9 + PUSHBUTTON "ŧ", IDOK, 50, 144, 48, 13 + PUSHBUTTON "¡ԡ", IDCANCEL, 102, 144, 48, 13 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." + IDS_READY " ." + IDS_TOOLBAR_STANDARD "ҵðҹ" + IDS_TOOLBAR_TEST "ͺ" + IDS_IMAGE_NAME "Ҿ %1!u!" + IDS_FLT_TOOLS "ͧ" + IDS_FLT_COLORS "" + IDS_FLT_HISTORY "ѵ" +END + +/* imageprop.c */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_IMAGE_MONOCHROME " (1 bit)" + IDS_IMAGE_GREYSCALE "ҾǴ (8 bit)" + IDS_IMAGE_PALETTE "ᶺ 256 (8 bit)" + IDS_IMAGE_TRUECOLOR "ըԧ (24 bit)" + + IDS_UNIT_PIXELS "" + IDS_UNIT_CM "ૹ" + IDS_UNIT_INCHES "" + IDS_UNIT_DOTSCM "ش / ૹ" + IDS_UNIT_DPI "ش͹" + IDS_UNIT_KB "%d 亵" + IDS_UNIT_MB "%d 亵" +END + +/* Tooltips */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_NEW "" + IDS_TOOLTIP_OPEN "Դ" + IDS_TOOLTIP_SAVE "ѹ֡" + IDS_TOOLTIP_PRINTPRE "Ҿ͹" + IDS_TOOLTIP_PRINT "" + IDS_TOOLTIP_CUT "Ѵ" + IDS_TOOLTIP_COPY "Ѵ͡" + IDS_TOOLTIP_PASTE "ҧ" + IDS_TOOLTIP_UNDO "ԡ" + IDS_TOOLTIP_REDO "͹Ѻ" +END + + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " ҧ͡." + IDS_HINT_OPEN " Դ͡÷." + IDS_HINT_CLOSE " Դ˹ҵҧ." + IDS_HINT_CLOSEALL " Դ˹ҵҧ." + IDS_HINT_SAVE " ѹ֡͡÷." + IDS_HINT_SAVEAS " ѹ֡͡÷ѧª." + IDS_HINT_PRINTPRE " ͧҾ͹ͧ͡." + IDS_HINT_PRINT " ͡÷ѧ." + IDS_HINT_PROP " ʴسѵԢͧҾѧ." + IDS_HINT_EXIT " ͡ҡ÷ӧҹ." + + IDS_HINT_TOOLS " ʴ˹ҫ͹˹ҵҧͧᶺͧ." + IDS_HINT_COLORS " ʴ˹ҫ͹˹ҵҧͧᶺ." + IDS_HINT_HISTORY " ʴ˹ҫ͹˹ҵҧͧᶺѵ." + IDS_HINT_STATUS " ʴ˹ҫ͹˹ҵҧͧᶺʶҹ." + + IDS_HINT_CASCADE " §˹ҵҧҧ͹ѹ." + IDS_HINT_TILE_HORZ " §˹ҵҧǹ͹." + IDS_HINT_TILE_VERT " §˹ҵҧǵ." + IDS_HINT_ARRANGE " Ѵ§ѭٻҹҧͧ˹ҵҧ." + IDS_HINT_NEXT " ӧҹ˹ҵҧѴ." + + IDS_HINT_SYS_RESTORE " ׹Ҿ˹ҵҧ袹Ҵ." + IDS_HINT_SYS_MOVE " ͹˹ҵҧ." + IDS_HINT_SYS_SIZE " ¹Ҵ˹ҵҧ." + IDS_HINT_SYS_MINIMIZE " ˹ҵҧѭٻ." + IDS_HINT_SYS_MAXIMIZE " ˹ҵҧ騹˹Ҩ." +END diff --git a/rosapps/imagesoft/mainwnd.c b/rosapps/imagesoft/mainwnd.c new file mode 100644 index 00000000000..4aef1ed6550 --- /dev/null +++ b/rosapps/imagesoft/mainwnd.c @@ -0,0 +1,1458 @@ +#include + +static const TCHAR szMainWndClass[] = TEXT("ImageSoftWndClass"); + +#define ID_MDI_FIRSTCHILD 50000 +#define ID_MDI_WINDOWMENU 5 +#define NUM_FLT_WND 3 + +/* toolbar buttons */ +TBBUTTON StdButtons[] = { +/* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */ + {TBICON_NEW, ID_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* new */ + {TBICON_OPEN, ID_OPEN, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* open */ + {TBICON_SAVE, ID_SAVE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* save */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + + {TBICON_PRINT, ID_PRINTPRE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* print */ + {TBICON_PRINTPRE, ID_PRINT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* print preview */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + + {TBICON_CUT, ID_CUT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* cut */ + {TBICON_COPY, ID_COPY, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* copy */ + {TBICON_PASTE, ID_PASTE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* paste */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + + {TBICON_UNDO, ID_UNDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* undo */ + {TBICON_REDO, ID_REDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* redo */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, +}; + +TBBUTTON TextButtons[] = { + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + + {TBICON_BOLD, ID_BOLD, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_CHECK, {0}, 0, 0}, /* bold */ + {TBICON_ITALIC, ID_ITALIC, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_CHECK, {0}, 0, 0}, /* italic */ + {TBICON_ULINE, ID_ULINE, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_CHECK, {0}, 0, 0}, /* underline */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + + {TBICON_TXTLEFT, ID_TXTLEFT, TBSTATE_ENABLED | TBSTATE_CHECKED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* left justified */ + {TBICON_TXTCENTER,ID_TXTCENTER,TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* centered */ + {TBICON_TXTRIGHT, ID_TXTRIGHT, TBSTATE_ENABLED, BTNS_BUTTON | TBSTYLE_GROUP | TBSTYLE_CHECK, {0}, 0, 0 }, /* right justified */ + + {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ +}; + + + +/* menu hints */ +static const MENU_HINT MainMenuHintTable[] = { + /* File Menu */ + {ID_BLANK, IDS_HINT_BLANK}, + {ID_NEW, IDS_HINT_NEW}, + {ID_OPEN, IDS_HINT_OPEN}, + {ID_CLOSE, IDS_HINT_CLOSE}, + {ID_CLOSEALL, IDS_HINT_CLOSEALL}, + {ID_SAVE, IDS_HINT_SAVE}, + {ID_SAVEAS, IDS_HINT_SAVEAS}, + {ID_PRINTPRE, IDS_HINT_PRINTPRE}, + {ID_PRINT, IDS_HINT_PRINT}, + {ID_PROP, IDS_HINT_PROP}, + {ID_EXIT, IDS_HINT_EXIT}, + + /* view menu */ + {ID_TOOLS, IDS_HINT_TOOLS}, + {ID_COLOR, IDS_HINT_COLORS}, + {ID_HISTORY, IDS_HINT_HISTORY}, + {ID_STATUSBAR, IDS_HINT_STATUS}, + + /* Window Menu */ + {ID_WINDOW_NEXT, IDS_HINT_NEXT}, + {ID_WINDOW_CASCADE, IDS_HINT_CASCADE}, + {ID_WINDOW_TILE_HORZ, IDS_HINT_TILE_HORZ}, + {ID_WINDOW_TILE_VERT, IDS_HINT_TILE_VERT}, + {ID_WINDOW_ARRANGE, IDS_HINT_ARRANGE} +}; + +static const MENU_HINT SystemMenuHintTable[] = { + {SC_RESTORE, IDS_HINT_SYS_RESTORE}, + {SC_MOVE, IDS_HINT_SYS_MOVE}, + {SC_SIZE, IDS_HINT_SYS_SIZE}, + {SC_MINIMIZE, IDS_HINT_SYS_MINIMIZE}, + {SC_MAXIMIZE, IDS_HINT_SYS_MAXIMIZE}, + {SC_CLOSE, IDS_HINT_CLOSE}, + {SC_NEXTWINDOW, IDS_HINT_NEXT}, +}; + + +/* Toolbars */ +#define ID_TOOLBAR_STANDARD 0 +#define ID_TOOLBAR_TEXT 1 +static const TCHAR szToolbarStandard[] = TEXT("STANDARD"); +static const TCHAR szToolbarText[] = TEXT("TEXT"); + + +/* Test Toolbar */ +#define ID_TOOLBAR_TEST 5 +static const TCHAR szToolbarTest[] = TEXT("TEST"); + +/* Toolbars table */ +static const DOCKBAR MainDockBars[] = { + {ID_TOOLBAR_STANDARD, szToolbarStandard, IDS_TOOLBAR_STANDARD, TOP_DOCK}, + {ID_TOOLBAR_TEST, szToolbarTest, IDS_TOOLBAR_TEST, TOP_DOCK}, + {ID_TOOLBAR_TEXT, szToolbarText, IDS_TOOLBAR_TEXT, TOP_DOCK}, +}; + + +static BOOL CALLBACK +MainWndCreateToolbarClient(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + HWND hParent, + HWND *hwnd) +{ + const TBBUTTON *Buttons = NULL; + UINT NumButtons = 0; + UINT StartImageRes = 0; + HWND hWndClient = NULL; + + UNREFERENCED_PARAMETER(Context); + + switch (Dockbar->BarId) + { + case ID_TOOLBAR_STANDARD: + { + Buttons = StdButtons; + NumButtons = sizeof(StdButtons) / sizeof(StdButtons[0]); + StartImageRes = IDB_MAINNEWICON; + break; + } + + case ID_TOOLBAR_TEXT: + { + Buttons = TextButtons; + NumButtons = sizeof(TextButtons) / sizeof(TextButtons[0]); + StartImageRes = IDB_TEXTBOLD; + break; + } + + case ID_TOOLBAR_TEST: + {/* + hWndClient = CreateWindowEx(WS_EX_TOOLWINDOW, + TEXT("BUTTON"), + TEXT("Test Button"), + WS_CHILD | WS_VISIBLE, + 0, + 0, + 150, + 25, + hParent, + NULL, + hInstance, + NULL);*/ + break; + } + } + + if (Buttons != NULL) + { + hWndClient = CreateWindowEx(0, + TOOLBARCLASSNAME, + NULL, + WS_CHILD | WS_CLIPSIBLINGS | + CCS_NOPARENTALIGN | CCS_NOMOVEY | CCS_NORESIZE | CCS_NODIVIDER | + TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, + 0, + 0, + 0, + 0, + hParent, + NULL, + hInstance, + NULL); + if (hWndClient != NULL) + { + HIMAGELIST hImageList; + + SendMessage(hWndClient, + TB_SETEXTENDEDSTYLE, + 0, + TBSTYLE_EX_HIDECLIPPEDBUTTONS); + + SendMessage(hWndClient, + TB_BUTTONSTRUCTSIZE, + sizeof(Buttons[0]), + 0); + + SendMessage(hWndClient, + TB_SETBITMAPSIZE, + 0, + (LPARAM)MAKELONG(TB_BMP_WIDTH, TB_BMP_HEIGHT)); + + hImageList = InitImageList(NumButtons, + StartImageRes); + + ImageList_Destroy((HIMAGELIST)SendMessage(hWndClient, + TB_SETIMAGELIST, + 0, + (LPARAM)hImageList)); + + SendMessage(hWndClient, + TB_ADDBUTTONS, + NumButtons, + (LPARAM)Buttons); + + } + } + + switch (Dockbar->BarId) + { + case ID_TOOLBAR_TEXT: + { + HWND hFontType; + HWND hFontSize; + + /* font selection combo */ + hFontType = CreateWindowEx(0, + WC_COMBOBOX, + NULL, + WS_CHILD | WS_VISIBLE | WS_VSCROLL | + CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS, //| CBS_OWNERDRAWFIXED, + 0, 0, 120, 0, + hParent, + NULL, + hInstance, + NULL); + + if (hFontType != NULL) + { + MakeFlatCombo(hFontType); + + SetParent(hFontType, + hWndClient); + + if (!ToolbarInsertSpaceForControl(hWndClient, + hFontType, + 0, + ID_TXTFONTNAME, + TRUE)) + { + DestroyWindow(hFontType); + } + + /* Create the list of fonts */ + FillFontStyleComboList(hFontType); + } + + /* font size combo */ + hFontSize = CreateWindowEx(0, + WC_COMBOBOX, + NULL, + WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, + 0, 0, 50, 0, + hParent, + NULL, + hInstance, + NULL); + if (hFontSize != NULL) + { + MakeFlatCombo(hFontSize); + + SetParent(hFontSize, + hWndClient); + + if (!ToolbarInsertSpaceForControl(hWndClient, + hFontSize, + 1, + ID_TXTFONTSIZE, + TRUE)) + { + DestroyWindow(hFontSize); + } + + /* Update the font-size-list */ + FillFontSizeComboList(hFontSize); + } + break; + } + } + + if (hWndClient != NULL) + { + *hwnd = hWndClient; + return TRUE; + } + + return FALSE; +} + +static BOOL CALLBACK +MainWndDestroyToolbarClient(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + HWND hwnd) +{ + UNREFERENCED_PARAMETER(TbDocks); + UNREFERENCED_PARAMETER(Dockbar); + UNREFERENCED_PARAMETER(Context); + + DestroyWindow(hwnd); + return TRUE; +} + +static BOOL CALLBACK +MainWndToolbarInsertBand(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + UINT *Index, + LPREBARBANDINFO rbi) +{ + switch (rbi->wID) + { + case ID_TOOLBAR_TEXT: + case ID_TOOLBAR_STANDARD: + { + SIZE Size; + + if (SendMessage(rbi->hwndChild, + TB_GETMAXSIZE, + 0, + (LPARAM)&Size)) + { + rbi->fStyle |= RBBS_USECHEVRON | RBBS_HIDETITLE; + rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; + rbi->cx = rbi->cxIdeal = Size.cx; + rbi->cxMinChild = 0; + rbi->cyMinChild = Size.cy; + } + break; + } + + case ID_TOOLBAR_TEST: + { + RECT rcBtn; + + if (GetWindowRect(rbi->hwndChild, + &rcBtn)) + { + rbi->fStyle |= RBBS_HIDETITLE; + rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE; + rbi->cx = rcBtn.right - rcBtn.left; + rbi->cxMinChild = 0; + rbi->cyMinChild = rcBtn.bottom - rcBtn.top; + } + break; + } + } + return TRUE; +} + +static VOID +TbCustomControlChange(HWND hWndToolbar, + HWND hWndControl, + BOOL Vert) +{ + /* the toolbar changed from horizontal to vertical or vice versa... */ + return; +} + +static VOID CALLBACK +MainWndToolbarDockBand(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + DOCK_POSITION DockFrom, + DOCK_POSITION DockTo, + LPREBARBANDINFO rbi) +{ + if (rbi->fMask & RBBIM_CHILD && rbi->hwndChild != NULL) + { + switch (rbi->wID) + { + case ID_TOOLBAR_TEXT: + case ID_TOOLBAR_STANDARD: + { + SIZE Size; + BOOL Vert; + DWORD dwStyle = (DWORD)SendMessage(rbi->hwndChild, + TB_GETSTYLE, + 0, + 0); + switch (DockTo) + { + case LEFT_DOCK: + case RIGHT_DOCK: + dwStyle |= CCS_VERT | TBSTYLE_WRAPABLE; + Vert = TRUE; + break; + + default: + dwStyle &= ~(CCS_VERT | TBSTYLE_WRAPABLE); + Vert = FALSE; + break; + } + + SendMessage(rbi->hwndChild, + TB_SETSTYLE, + 0, + (LPARAM)dwStyle); + + ToolbarUpdateControlSpaces(rbi->hwndChild, + TbCustomControlChange); + + if (SendMessage(rbi->hwndChild, + TB_GETMAXSIZE, + 0, + (LPARAM)&Size)) + { + rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; + rbi->cx = rbi->cxIdeal = (Vert ? Size.cy : Size.cx); + rbi->cxMinChild = 0; + rbi->cyMinChild = (Vert ? Size.cx : Size.cy); + } + break; + } + + case ID_TOOLBAR_TEST: + { + if (DockTo == NO_DOCK) + { + rbi->fMask |= RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; + rbi->cx = rbi->cxIdeal = 150; + rbi->cxMinChild = 0; + rbi->cyMinChild = 40; + } + break; + } + } + } +} + +static VOID CALLBACK +MainWndToolbarChevronPushed(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + HWND hwndChild, + LPNMREBARCHEVRON lpnm) +{ + switch (lpnm->wID) + { + case ID_TOOLBAR_STANDARD: + { + MapWindowPoints(lpnm->hdr.hwndFrom, + HWND_DESKTOP, + (LPPOINT)&lpnm->rc, + 2); + /* Create a popup menu for all toolbar icons hidden */ + break; + } + } +} + +static VOID +MainWndMoveFloatingWindows(PMAIN_WND_INFO Info, + PRECT wndOldPos) +{ + RECT wndNewPos, TbRect; + INT i, xMoved, yMoved; + PFLT_WND WndArr[NUM_FLT_WND]; + + if (GetWindowRect(Info->hSelf, + &wndNewPos)) + { + + xMoved = wndNewPos.left - wndOldPos->left; + yMoved = wndNewPos.top - wndOldPos->top; + + /* store the pointers in an array */ + WndArr[0] = Info->fltTools; + WndArr[1] = Info->fltColors; + WndArr[2] = Info->fltHistory; + + for (i = 0; i < NUM_FLT_WND; i++) + { + GetWindowRect(WndArr[i]->hSelf, + &TbRect); + + WndArr[i]->x = TbRect.left + xMoved; + WndArr[i]->y = TbRect.top + yMoved; + + MoveWindow(WndArr[i]->hSelf, + WndArr[i]->x, + WndArr[i]->y, + WndArr[i]->Width, + WndArr[i]->Height, + TRUE); + } + + CopyMemory(wndOldPos, + &wndNewPos, + sizeof(RECT)); + } +} + + +static VOID +MainWndResetFloatingWindows(PMAIN_WND_INFO Info) +{ + RECT rect; + + if (GetWindowRect(Info->hMdiClient, + &rect)) + { + + /* tools datum */ + MoveWindow(Info->fltTools->hSelf, + rect.left + 5, + rect.top + 5, + Info->fltTools->Width, + Info->fltTools->Height, + TRUE); + + /* colors datum */ + MoveWindow(Info->fltColors->hSelf, + rect.left + 5, + rect.bottom - Info->fltColors->Height - 5, + Info->fltColors->Width, + Info->fltColors->Height, + TRUE); + + /* history datum */ + MoveWindow(Info->fltHistory->hSelf, + rect.right - Info->fltHistory->Width - 5, + rect.top + 5, + Info->fltHistory->Width, + Info->fltHistory->Height, + TRUE); + } +} + +static VOID +MainWndCreateFloatWindows(PMAIN_WND_INFO Info) +{ + RECT rect; + HMENU hMenu; + UINT Res; + PFLT_WND WndArr[NUM_FLT_WND]; /* temp array for looping */ + INT i; + + Info->fltTools = HeapAlloc(ProcessHeap, + HEAP_ZERO_MEMORY, + sizeof(FLT_WND)); + Info->fltColors = HeapAlloc(ProcessHeap, + HEAP_ZERO_MEMORY, + sizeof(FLT_WND)); + Info->fltHistory = HeapAlloc(ProcessHeap, + HEAP_ZERO_MEMORY, + sizeof(FLT_WND)); + + /* set window dimensions */ + Info->fltTools->Width = 53; + Info->fltTools->Height = 300; + Info->fltColors->Width = 200; + Info->fltColors->Height = 200; + Info->fltHistory->Width = 150; + Info->fltHistory->Height = 150; + + if (! GetWindowRect(Info->hMdiClient, + &rect)) + { + return; + } + + /* Set window datums */ + Info->fltTools->x = rect.left + 5; + Info->fltTools->y = rect.top + 5; + + Info->fltColors->x = rect.left + 5; + Info->fltColors->y = rect.bottom - Info->fltColors->Height - 5; + + Info->fltHistory->x = rect.right - Info->fltHistory->Width - 5; + Info->fltHistory->y = rect.top + 5; + + /* save pointers into array incrementing within the loop*/ + WndArr[0] = Info->fltTools; + WndArr[1] = Info->fltColors; + WndArr[2] = Info->fltHistory; + + for (i = 0, Res = IDS_FLT_TOOLS; Res < IDS_FLT_TOOLS + NUM_FLT_WND; Res++, i++) + { + if (! AllocAndLoadString(&WndArr[i]->lpName, + hInstance, + Res)) + { + WndArr[i]->lpName = NULL; + } + + WndArr[i]->hSelf = CreateWindowEx(WS_EX_TOOLWINDOW, + TEXT("ImageSoftFloatWndClass"), + WndArr[i]->lpName, + WS_POPUPWINDOW | WS_DLGFRAME | WS_VISIBLE, + WndArr[i]->x, + WndArr[i]->y, + WndArr[i]->Width, + WndArr[i]->Height, + Info->hSelf, + NULL, + hInstance, + WndArr[i]); + ShowWindow(WndArr[i]->hSelf, SW_HIDE); + } + + hMenu = GetMenu(Info->hSelf); + + if (Info->fltTools->hSelf != NULL) + { + if (FloatToolbarCreateToolsGui(Info)) + { + CheckMenuItem(hMenu, + ID_TOOLS, + MF_CHECKED); + + ShowHideWindow(Info->fltTools->hSelf); + } + } + + if (Info->fltColors->hSelf != NULL) + { + if (FloatToolbarCreateColorsGui(Info)) + { + + } + } + + if (Info->fltHistory->hSelf != NULL) + { + if (FloatToolbarCreateHistoryGui(Info)) + { + + } + } + +} + +static VOID +MainWndDestroyFloatWindows(PMAIN_WND_INFO Info) +{ + if (Info->fltTools != NULL) + HeapFree(ProcessHeap, 0, Info->fltTools); + + if (Info->fltColors != NULL) + HeapFree(ProcessHeap, 0, Info->fltColors); + + if (Info->fltHistory != NULL) + HeapFree(ProcessHeap, 0, Info->fltHistory); +} + + + +static const DOCKBAR_ITEM_CALLBACKS MainWndDockBarCallbacks = { + MainWndCreateToolbarClient, + MainWndDestroyToolbarClient, + MainWndToolbarInsertBand, + MainWndToolbarDockBand, + MainWndToolbarChevronPushed, +}; + +static VOID +CreateToolbars(PMAIN_WND_INFO Info) +{ + UINT i; + + for (i = 0; i < sizeof(MainDockBars) / sizeof(MainDockBars[0]); i++) + { + /* FIXME - lookup whether to display the toolbar */ + TbdAddToolbar(&Info->ToolDocks, + &MainDockBars[i], + Info, + &MainWndDockBarCallbacks); + } + + MainWndCreateFloatWindows(Info); +} + +static VOID CALLBACK +MainWndResize(PVOID Context, + WORD cx, + WORD cy) +{ + RECT rcClient = {0}; + RECT rcStatus = {0}; + HDWP dwp; + INT DocksVisible; + PMAIN_WND_INFO Info = (PMAIN_WND_INFO)Context; + + /* Calculate the MDI client rectangle */ + rcClient.right = cx; + rcClient.bottom = cy; + + if (Info->hStatus != NULL) + { + GetWindowRect(Info->hStatus, + &rcStatus); + rcClient.bottom -= (rcStatus.bottom - rcStatus.top); + } + + /* Adjust the client rect if docked toolbars are visible */ + DocksVisible = TbdAdjustUpdateClientRect(&Info->ToolDocks, + &rcClient); + + dwp = BeginDeferWindowPos(2 + DocksVisible); + if (dwp != NULL) + { + /* Update the toolbar docks */ + if (DocksVisible != 0) + { + dwp = TbdDeferDocks(dwp, + &Info->ToolDocks); + if (dwp == NULL) + return; + } + + /* Update the MDI client */ + if (Info->hMdiClient != NULL) + { + dwp = DeferWindowPos(dwp, + Info->hMdiClient, + NULL, + rcClient.left, + rcClient.top, + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top, + SWP_NOZORDER); + if (dwp == NULL) + return; + } + + /* Update the status bar */ + if (Info->hStatus != NULL) + { + dwp = DeferWindowPos(dwp, + Info->hStatus, + NULL, + 0, + cy - (rcStatus.bottom - rcStatus.top), + cx, + rcStatus.bottom - rcStatus.top, + SWP_NOZORDER); + if (dwp == NULL) + return; + } + + EndDeferWindowPos(dwp); + } +} + +static VOID +InitMainWnd(PMAIN_WND_INFO Info) +{ + CLIENTCREATESTRUCT ccs; + INT statwidths[] = {110, -1}; + + /* FIXME - create controls and initialize the application */ + + /* create the status bar */ + Info->hStatus = CreateWindowEx(0, + STATUSCLASSNAME, + NULL, + WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | CCS_NOPARENTALIGN | SBARS_SIZEGRIP, + 0, + 0, + 0, + 0, + Info->hSelf, + (HMENU)IDC_STATUSBAR, + hInstance, + NULL); + + if (Info->hStatus != NULL) + SendMessage(Info->hStatus, + SB_SETPARTS, + sizeof(statwidths)/sizeof(int), + (LPARAM)statwidths); + + /* create the MDI client window */ + ccs.hWindowMenu = GetSubMenu(GetMenu(Info->hSelf), + ID_MDI_WINDOWMENU); + ccs.idFirstChild = ID_MDI_FIRSTCHILD; + Info->hMdiClient = CreateWindowEx(WS_EX_ACCEPTFILES | WS_EX_CLIENTEDGE, + TEXT("MDICLIENT"), + NULL, + WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL, + 0, + 0, + 0, + 0, + Info->hSelf, + NULL, + hInstance, + &ccs); + + TbdInitializeDocks(&Info->ToolDocks, + Info->hSelf, + Info, + MainWndResize); + + CreateToolbars(Info); + + /* initialize file open/save structure */ + FileInitialize(Info->hSelf); +} + +static VOID +MainWndCommand(PMAIN_WND_INFO Info, + WORD CmdId, + HWND hControl) +{ + static TCHAR szFileName[MAX_PATH]; + static TCHAR szImageName[MAX_PATH]; + + UNREFERENCED_PARAMETER(hControl); + + switch (CmdId) + { + case ID_NEW: + { + MessageBox(NULL, _T("Not yet implemented"), NULL, 0); + } + break; + + case ID_OPEN: + { + OPEN_IMAGE_EDIT_INFO OpenInfo; + + if (DoOpenFile(Info->hSelf, + szFileName, /* full file path */ + szImageName)) /* file name */ + { + OpenInfo.CreateNew = FALSE; + + OpenInfo.Open.lpImagePath = szFileName; + OpenInfo.lpImageName = szImageName; + + CreateImageEditWindow(Info, + &OpenInfo); + + /* FIXME: move flt wnd's if scroll bars show + MainWndResetFloatingWindows(Info->hMdiClient); */ + } + + } + break; + + case ID_TOOLS: + { + HMENU hMenu = GetMenu(Info->hSelf); + + if (hMenu != NULL) + { + UINT uCheck = MF_CHECKED; + + if (ShowHideWindow(Info->fltTools->hSelf)) + uCheck = MF_UNCHECKED; + + CheckMenuItem(hMenu, + ID_TOOLS, + uCheck); + } + } + break; + + case ID_COLOR: + { + HMENU hMenu = GetMenu(Info->hSelf); + + if (hMenu != NULL) + { + UINT uCheck = MF_CHECKED; + + if (ShowHideWindow(Info->fltColors->hSelf)) + uCheck = MF_UNCHECKED; + + CheckMenuItem(hMenu, + ID_COLOR, + uCheck); + } + } + break; + + case ID_HISTORY: + { + HMENU hMenu = GetMenu(Info->hSelf); + + if (hMenu != NULL) + { + UINT uCheck = MF_CHECKED; + + if (ShowHideWindow(Info->fltHistory->hSelf)) + uCheck = MF_UNCHECKED; + + CheckMenuItem(hMenu, + ID_HISTORY, + uCheck); + } + } + break; + + case ID_BRIGHTNESS: + DialogBoxParam(hInstance, + MAKEINTRESOURCE(IDD_BRIGHTNESS), + Info->hSelf, + BrightnessProc, + (LPARAM)Info); + break; + + case ID_CONTRAST: + DialogBoxParam(hInstance, + MAKEINTRESOURCE(IDD_BRIGHTNESS), + Info->hSelf, + ContrastProc, + (LPARAM)Info); + break; + + case ID_BLACKANDWHITE: + { + if (Info->ImageEditors) + { + DisplayBlackAndWhite(Info->ImageEditors->hSelf, + Info->ImageEditors->hDCMem, + Info->ImageEditors->hBitmap); + } + } + break; + + case ID_INVERTCOLORS: + { + if (Info->ImageEditors) + { + DisplayInvertedColors(Info->ImageEditors->hSelf, + Info->ImageEditors->hDCMem, + Info->ImageEditors->hBitmap); + } + } + break; + + case ID_BLUR: + { + if (Info->ImageEditors) + { + DisplayBlur(Info->ImageEditors->hSelf, + Info->ImageEditors->hDCMem, + Info->ImageEditors->hBitmap); + } + } + break; + + case ID_SHARPEN: + { + if (Info->ImageEditors) + { + DisplaySharpness(Info->ImageEditors->hSelf, + Info->ImageEditors->hDCMem, + Info->ImageEditors->hBitmap); + } + } + break; + + case ID_EXIT: + SendMessage(Info->hSelf, + WM_CLOSE, + 0, + 0); + break; + + /* Window Menu */ + case ID_WINDOW_TILE_HORZ: + SendMessage(Info->hMdiClient, + WM_MDITILE, + MDITILE_HORIZONTAL, + 0); + break; + + case ID_WINDOW_TILE_VERT: + SendMessage(Info->hMdiClient, + WM_MDITILE, + MDITILE_VERTICAL, + 0); + break; + + case ID_WINDOW_CASCADE: + SendMessage(Info->hMdiClient, + WM_MDICASCADE, + 0, + 0); + break; + + case ID_WINDOW_ARRANGE: + SendMessage(Info->hMdiClient, + WM_MDIICONARRANGE, + 0, + 0); + break; + + case ID_WINDOW_NEXT: + SendMessage(Info->hMdiClient, + WM_MDINEXT, + 0, + 0); + break; + + /* Help Menu */ + case ID_ABOUT: + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_ABOUTBOX), + Info->hSelf, + AboutDialogProc); + break; + } +} + +static VOID +DestroyMainWnd(PMAIN_WND_INFO Info) +{ + /* FIXME - cleanup allocated resources */ + + MainWndDestroyFloatWindows(Info); +} + + +static VOID +UpdateMainStatusBar(PMAIN_WND_INFO Info) +{ + if (Info->hStatus != NULL) + { + SendMessage(Info->hStatus, + SB_SIMPLE, + (WPARAM)Info->InMenuLoop, + 0); + } +} + +static BOOL +MainWndMenuHint(PMAIN_WND_INFO Info, + WORD CmdId, + const MENU_HINT *HintArray, + DWORD HintsCount, + UINT DefHintId) +{ + BOOL Found = FALSE; + const MENU_HINT *LastHint; + UINT HintId = DefHintId; + + LastHint = HintArray + HintsCount; + while (HintArray != LastHint) + { + if (HintArray->CmdId == CmdId) + { + HintId = HintArray->HintId; + Found = TRUE; + break; + } + HintArray++; + } + + StatusBarLoadString(Info->hStatus, + SB_SIMPLEID, + hInstance, + HintId); + + return Found; +} + +static LRESULT CALLBACK +MainWndProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PMAIN_WND_INFO Info; + LRESULT Ret = 0; + static BOOL bLBMouseDown = FALSE; + static RECT wndOldPos; + + /* Get the window context */ + Info = (PMAIN_WND_INFO)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (Info == NULL && uMsg != WM_CREATE) + { + goto HandleDefaultMessage; + } + + switch (uMsg) + { + case WM_SIZE: + { + MainWndResize(Info, + LOWORD(lParam), + HIWORD(lParam)); + /* NOTE - do *not* forward this message to DefFrameProc! Otherwise the MDI client + will attempt to resize itself */ + + /* reposition the floating toolbars */ + if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED)) + MainWndResetFloatingWindows(Info); + + break; + } + + case WM_NCLBUTTONDOWN: + bLBMouseDown = TRUE; + DefWindowProc(hwnd, + uMsg, + wParam, + lParam); + break; + + case WM_NCLBUTTONUP: + + bLBMouseDown = FALSE; + DefWindowProc(hwnd, + uMsg, + wParam, + lParam); + break; + + case WM_MOVE: + { + /* if the main window is moved, move the toolbars too */ + if (bLBMouseDown) + MainWndMoveFloatingWindows(Info, &wndOldPos); + } + break; + + case WM_NOTIFY: + { + UINT BarId; + LPNMHDR pnmhdr = (LPNMHDR)lParam; + if (!TbdHandleNotifications(&Info->ToolDocks, + pnmhdr, + &Ret)) + { + if (TbdDockBarIdFromClientWindow(&Info->ToolDocks, + pnmhdr->hwndFrom, + &BarId)) + { + switch (BarId) + { + case ID_TOOLBAR_TEXT: + switch (pnmhdr->code) + { + case TBN_DELETINGBUTTON: + { + LPNMTOOLBAR lpnmtb = (LPNMTOOLBAR)lParam; + + ToolbarDeleteControlSpace(pnmhdr->hwndFrom, + &lpnmtb->tbButton); + break; + } + } + break; + } + } + } + break; + } + + case WM_COMMAND: + { + MainWndCommand(Info, + LOWORD(wParam), + (HWND)lParam); + goto HandleDefaultMessage; + } + + case WM_MENUSELECT: + { + if (Info->hStatus != NULL) + { + if (!MainWndMenuHint(Info, + LOWORD(wParam), + MainMenuHintTable, + sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]), + IDS_HINT_BLANK)) + { + MainWndMenuHint(Info, + LOWORD(wParam), + SystemMenuHintTable, + sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]), + IDS_HINT_BLANK); + } + } + break; + } + + case WM_ENTERMENULOOP: + { + Info->InMenuLoop = TRUE; + UpdateMainStatusBar(Info); + break; + } + + case WM_EXITMENULOOP: + { + Info->InMenuLoop = FALSE; + UpdateMainStatusBar(Info); + break; + } + + case WM_CLOSE: + { + DestroyWindow(hwnd); + break; + } + + case WM_ENABLE: + { + TbdHandleEnabling(&Info->ToolDocks, + hwnd, + (BOOL)wParam); + goto HandleDefaultMessage; + } + + case WM_NCACTIVATE: + { + TbdHandleActivation(&Info->ToolDocks, + hwnd, + &wParam, + &lParam); + goto HandleDefaultMessage; + } + + case WM_ACTIVATEAPP: + { + //TbdShowFloatingToolbars(&Info->ToolDocks, + // (BOOL)wParam); + goto HandleDefaultMessage; + } + + case WM_CREATE: + { + Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams); + + /* Initialize the main window context */ + Info->hSelf = hwnd; + + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + (LONG_PTR)Info); + + InitMainWnd(Info); + + /* Show the window */ + ShowWindow(hwnd, + Info->nCmdShow); + /* get the windows position */ + GetWindowRect(hwnd, + &wndOldPos); + + break; + } + + case WM_DESTROY: + { + DestroyMainWnd(Info); + + HeapFree(ProcessHeap, + 0, + Info); + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + 0); + + /* Break the message queue loop */ + PostQuitMessage(0); + break; + } + + default: + { +HandleDefaultMessage: + if (Info != NULL && Info->hMdiClient != NULL) + { + Ret = DefFrameProc(hwnd, + Info->hMdiClient, + uMsg, + wParam, + lParam); + } + else + { + Ret = DefWindowProc(hwnd, + uMsg, + wParam, + lParam); + } + break; + } + } + + return Ret; +} + +MDI_EDITOR_TYPE +MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd, + PVOID *Info) +{ + MDI_EDITOR_TYPE EditorType; + + if (MainWnd->ActiveEditor != NULL) + { + EditorType = *((PMDI_EDITOR_TYPE)MainWnd->ActiveEditor); + *Info = MainWnd->ActiveEditor; + } + else + { + EditorType = metUnknown; + *Info = NULL; + } + + return EditorType; +} + +VOID +MainWndSwitchEditorContext(PMAIN_WND_INFO Info, + HWND hDeactivate, + HWND hActivate) +{ + PMDI_EDITOR_TYPE EditorType; + + /* FIXME - optimize light weight switching + when switching from and to an editor of same type */ + + if (hDeactivate != NULL) + { + EditorType = (PMDI_EDITOR_TYPE)GetWindowLongPtr(hDeactivate, + GWLP_USERDATA); + if (EditorType != NULL) + { + switch (*EditorType) + { + case metImageEditor: + SetImageEditorEnvironment((PEDIT_WND_INFO)EditorType, + FALSE); + break; + + default: + break; + } + + Info->ActiveEditor = NULL; + } + } + + if (hActivate != NULL) + { + EditorType = (PMDI_EDITOR_TYPE)GetWindowLongPtr(hActivate, + GWLP_USERDATA); + if (EditorType != NULL) + { + Info->ActiveEditor = EditorType; + + switch (*EditorType) + { + case metImageEditor: + SetImageEditorEnvironment((PEDIT_WND_INFO)EditorType, + TRUE); + break; + + default: + break; + } + } + } +} + +HWND +CreateMainWindow(LPCTSTR lpCaption, + int nCmdShow) +{ + PMAIN_WND_INFO Info; + HWND hMainWnd = NULL; + + Info = HeapAlloc(ProcessHeap, + 0, + sizeof(MAIN_WND_INFO)); + if (Info != NULL) + { + ZeroMemory(Info, + sizeof(MAIN_WND_INFO)); + Info->nCmdShow = nCmdShow; + + /* FIXME - load the window position from the registry */ + + hMainWnd = CreateWindowEx(WS_EX_WINDOWEDGE, + szMainWndClass, + lpCaption, + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + hInstance, + Info); + if (hMainWnd == NULL) + { + HeapFree(ProcessHeap, + 0, + Info); + } + } + + return hMainWnd; +} + +BOOL +MainWndTranslateMDISysAccel(HWND hwnd, + LPMSG lpMsg) +{ + PMAIN_WND_INFO Info; + + /* Get the window context */ + Info = (PMAIN_WND_INFO)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (Info != NULL && Info->hMdiClient != NULL) + { + return TranslateMDISysAccel(Info->hMdiClient, + lpMsg); + } + + return FALSE; +} + +BOOL +InitMainWindowImpl(VOID) +{ + WNDCLASSEX wc = {0}; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.lpfnWndProc = MainWndProc; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, + MAKEINTRESOURCE(IDI_IMAGESOFTICON)); + wc.hCursor = LoadCursor(NULL, + IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); + wc.lpszClassName = szMainWndClass; + wc.hIconSm = (HICON)LoadImage(hInstance, + MAKEINTRESOURCE(IDI_IMAGESOFTICON), + IMAGE_ICON, + 16, + 16, + LR_SHARED); + + return RegisterClassEx(&wc) != (ATOM)0; +} + +VOID +UninitMainWindowImpl(VOID) +{ + UnregisterClass(szMainWndClass, + hInstance); +} diff --git a/rosapps/imagesoft/mainwnd.h b/rosapps/imagesoft/mainwnd.h new file mode 100644 index 00000000000..e19656456fb --- /dev/null +++ b/rosapps/imagesoft/mainwnd.h @@ -0,0 +1,41 @@ + +typedef struct _MENU_HINT +{ + WORD CmdId; + UINT HintId; +} MENU_HINT, *PMENU_HINT; + +typedef struct _MAIN_WND_INFO +{ + HWND hSelf; + HWND hMdiClient; + HWND hStatus; + int nCmdShow; + + struct _FLT_WND *fltTools; + struct _FLT_WND *fltColors; + struct _FLT_WND *fltHistory; + + struct _TOOLBAR_DOCKS ToolDocks; + + /* Editors */ + PEDIT_WND_INFO ImageEditors; + UINT ImagesCreated; + + PVOID ActiveEditor; + + /* status flags */ + BOOL InMenuLoop : 1; +} MAIN_WND_INFO, *PMAIN_WND_INFO; + +BOOL InitMainWindowImpl(VOID); +VOID UninitMainWindowImpl(VOID); +HWND CreateMainWindow(LPCTSTR lpCaption, + int nCmdShow); +BOOL MainWndTranslateMDISysAccel(HWND hwnd, + LPMSG lpMsg); +VOID MainWndSwitchEditorContext(PMAIN_WND_INFO Info, + HWND hDeactivate, + HWND hActivate); +MDI_EDITOR_TYPE MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd, + PVOID *Info); diff --git a/rosapps/imagesoft/manifest.xml b/rosapps/imagesoft/manifest.xml new file mode 100644 index 00000000000..dc84acc1900 --- /dev/null +++ b/rosapps/imagesoft/manifest.xml @@ -0,0 +1,24 @@ + + + + ReactOS VMware(r) SVGA driver Installer + + + + + + + + diff --git a/rosapps/imagesoft/misc.c b/rosapps/imagesoft/misc.c new file mode 100644 index 00000000000..709042b6e65 --- /dev/null +++ b/rosapps/imagesoft/misc.c @@ -0,0 +1,422 @@ +#include + +static INT +LengthOfStrResource(IN HINSTANCE hInst, + IN UINT uID) +{ + HRSRC hrSrc; + HGLOBAL hRes; + LPWSTR lpName, lpStr; + + if (hInst == NULL) + { + return -1; + } + + /* There are always blocks of 16 strings */ + lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1); + + /* Find the string table block */ + if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) && + (hRes = LoadResource(hInst, hrSrc)) && + (lpStr = LockResource(hRes))) + { + UINT x; + + /* Find the string we're looking for */ + uID &= 0xF; /* position in the block, same as % 16 */ + for (x = 0; x < uID; x++) + { + lpStr += (*lpStr) + 1; + } + + /* Found the string */ + return (int)(*lpStr); + } + return -1; +} + +INT +AllocAndLoadString(OUT LPTSTR *lpTarget, + IN HINSTANCE hInst, + IN UINT uID) +{ + INT ln; + + ln = LengthOfStrResource(hInst, + uID); + if (ln++ > 0) + { + (*lpTarget) = (LPTSTR)LocalAlloc(LMEM_FIXED, + ln * sizeof(TCHAR)); + if ((*lpTarget) != NULL) + { + INT Ret; + if (!(Ret = LoadString(hInst, uID, *lpTarget, ln))) + { + LocalFree((HLOCAL)(*lpTarget)); + } + return Ret; + } + } + return 0; +} + +DWORD +LoadAndFormatString(IN HINSTANCE hInstance, + IN UINT uID, + OUT LPTSTR *lpTarget, + ...) +{ + DWORD Ret = 0; + LPTSTR lpFormat; + va_list lArgs; + + if (AllocAndLoadString(&lpFormat, + hInstance, + uID) > 0) + { + va_start(lArgs, lpTarget); + /* let's use FormatMessage to format it because it has the ability to allocate + memory automatically */ + Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (LPTSTR)lpTarget, + 0, + &lArgs); + va_end(lArgs); + + LocalFree((HLOCAL)lpFormat); + } + + return Ret; +} + +BOOL +StatusBarLoadAndFormatString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID, + ...) +{ + BOOL Ret = FALSE; + LPTSTR lpFormat, lpStr; + va_list lArgs; + + if (AllocAndLoadString(&lpFormat, + hInstance, + uID) > 0) + { + va_start(lArgs, uID); + /* let's use FormatMessage to format it because it has the ability to allocate + memory automatically */ + Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (LPTSTR)&lpStr, + 0, + &lArgs); + va_end(lArgs); + + if (lpStr != NULL) + { + Ret = (BOOL)SendMessage(hStatusBar, + SB_SETTEXT, + (WPARAM)PartId, + (LPARAM)lpStr); + LocalFree((HLOCAL)lpStr); + } + + LocalFree((HLOCAL)lpFormat); + } + + return Ret; +} + +BOOL +StatusBarLoadString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID) +{ + BOOL Ret = FALSE; + LPTSTR lpStr; + + if (AllocAndLoadString(&lpStr, + hInstance, + uID) > 0) + { + Ret = (BOOL)SendMessage(hStatusBar, + SB_SETTEXT, + (WPARAM)PartId, + (LPARAM)lpStr); + LocalFree((HLOCAL)lpStr); + } + + return Ret; +} + + +INT +GetTextFromEdit(OUT LPTSTR lpString, + IN HWND hDlg, + IN UINT Res) +{ + INT len = GetWindowTextLength(GetDlgItem(hDlg, Res)); + if(len > 0) + { + GetDlgItemText(hDlg, + Res, + lpString, + len + 1); + } + else + lpString = NULL; + + return len; +} + + +VOID GetError(DWORD err) +{ + LPVOID lpMsgBuf; + + if (err == 0) + err = GetLastError(); + + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + MessageBox(NULL, lpMsgBuf, _T("Error!"), MB_OK | MB_ICONERROR); + + LocalFree(lpMsgBuf); +} + + + +/* + * Toolbar custom control routines + */ + +typedef struct _TBCUSTCTL +{ + HWND hWndControl; + INT iCommand; + BOOL HideVertical : 1; + BOOL IsVertical : 1; +} TBCUSTCTL, *PTBCUSTCTL; + +BOOL +ToolbarDeleteControlSpace(HWND hWndToolbar, + const TBBUTTON *ptbButton) +{ + if ((ptbButton->fsStyle & TBSTYLE_SEP) && + ptbButton->dwData != 0) + { + PTBCUSTCTL cctl = (PTBCUSTCTL)ptbButton->dwData; + + DestroyWindow(cctl->hWndControl); + + HeapFree(ProcessHeap, + 0, + cctl); + return TRUE; + } + + return FALSE; +} + +VOID +ToolbarUpdateControlSpaces(HWND hWndToolbar, + ToolbarChangeControlCallback ChangeCallback) +{ + BOOL Vert; + DWORD nButtons, i; + TBBUTTON tbtn; + + Vert = ((SendMessage(hWndToolbar, + TB_GETSTYLE, + 0, + 0) & CCS_VERT) != 0); + + nButtons = (DWORD)SendMessage(hWndToolbar, + TB_BUTTONCOUNT, + 0, + 0); + + for (i = 0; + i != nButtons; + i++) + { + if (SendMessage(hWndToolbar, + TB_GETBUTTON, + (WPARAM)i, + (LPARAM)&tbtn)) + { + if ((tbtn.fsStyle & TBSTYLE_SEP) && tbtn.dwData != 0) + { + PTBCUSTCTL cctl = (PTBCUSTCTL)tbtn.dwData; + + cctl->IsVertical = Vert; + + if (cctl->HideVertical) + { + ShowWindow(cctl->hWndControl, + (Vert ? SW_HIDE : SW_SHOW)); + goto ShowHideSep; + } + else if (cctl->IsVertical != Vert) + { + ChangeCallback(hWndToolbar, + cctl->hWndControl, + Vert); + +ShowHideSep: + /* show/hide the separator */ + SendMessage(hWndToolbar, + TB_HIDEBUTTON, + (WPARAM)cctl->iCommand, + (LPARAM)Vert && cctl->HideVertical); + } + } + } + } +} + +BOOL +ToolbarInsertSpaceForControl(HWND hWndToolbar, + HWND hWndControl, + INT Index, + INT iCmd, + BOOL HideVertical) +{ + PTBCUSTCTL cctl; + RECT rcControl, rcItem; + + cctl = HeapAlloc(ProcessHeap, + 0, + sizeof(TBCUSTCTL)); + if (cctl == NULL) + return FALSE; + + cctl->HideVertical = HideVertical; + cctl->hWndControl = hWndControl; + cctl->iCommand = iCmd; + + if (GetWindowRect(hWndControl, + &rcControl)) + { + TBBUTTON tbtn = {0}; + + tbtn.iBitmap = rcControl.right - rcControl.left; + tbtn.idCommand = iCmd; + tbtn.fsStyle = TBSTYLE_SEP; + tbtn.dwData = (DWORD_PTR)cctl; + + if (SendMessage(hWndToolbar, + TB_GETSTYLE, + 0, + 0) & CCS_VERT) + { + if (HideVertical) + tbtn.fsState |= TBSTATE_HIDDEN; + + cctl->IsVertical = TRUE; + } + else + cctl->IsVertical = FALSE; + + if (SendMessage(hWndToolbar, + TB_INSERTBUTTON, + (WPARAM)Index, + (LPARAM)&tbtn)) + { + if (SendMessage(hWndToolbar, + TB_GETITEMRECT, + (WPARAM)Index, + (LPARAM)&rcItem)) + { + SetWindowPos(hWndControl, + NULL, + rcItem.left, + rcItem.top, + rcItem.right - rcItem.left, + rcItem.bottom - rcItem.top, + SWP_NOZORDER); + + ShowWindow(hWndControl, + SW_SHOW); + + return TRUE; + } + else if (tbtn.fsState & TBSTATE_HIDDEN) + { + ShowWindow(hWndControl, + SW_HIDE); + } + } + } + + return FALSE; +} + + +HIMAGELIST +InitImageList(UINT NumImages, UINT StartResource) +{ + HBITMAP hBitmap; + HIMAGELIST hImageList; + UINT i, k; + INT Ret; + + + /* Create the toolbar icon image list */ + hImageList = ImageList_Create(TB_BMP_WIDTH, + TB_BMP_HEIGHT, + ILC_MASK | ILC_COLOR24, + NumImages, + 0); + if (! hImageList) + return NULL; + + /* Add all icons to the image list */ + for (i = StartResource, k = 0; k < NumImages; i++, k++) + { + hBitmap = LoadImage(hInstance, + MAKEINTRESOURCE(i), + IMAGE_BITMAP, + TB_BMP_WIDTH, + TB_BMP_HEIGHT, + LR_LOADTRANSPARENT); + + Ret = ImageList_AddMasked(hImageList, + hBitmap, + RGB(255, 255, 254)); + + DeleteObject(hBitmap); + } + + return hImageList; + +} + +/* +static BOOL +DestroyImageList(HIMAGELIST hImageList) +{ + if (! ImageList_Destroy(hImageList)) + return FALSE; + else + return TRUE; +} +*/ diff --git a/rosapps/imagesoft/misc.h b/rosapps/imagesoft/misc.h new file mode 100644 index 00000000000..ab0c4ae7e08 --- /dev/null +++ b/rosapps/imagesoft/misc.h @@ -0,0 +1,44 @@ + +INT AllocAndLoadString(OUT LPTSTR *lpTarget, + IN HINSTANCE hInst, + IN UINT uID); + +DWORD LoadAndFormatString(IN HINSTANCE hInstance, + IN UINT uID, + OUT LPTSTR *lpTarget, + ...); + +BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID, + ...); + +BOOL StatusBarLoadString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID); + +INT GetTextFromEdit(OUT LPTSTR lpString, + IN HWND hDlg, + IN UINT Res); + +VOID GetError(DWORD err); + +BOOL ToolbarDeleteControlSpace(HWND hWndToolbar, + const TBBUTTON *ptbButton); + +typedef VOID (*ToolbarChangeControlCallback)(HWND hWndToolbar, + HWND hWndControl, + BOOL Vert); +VOID ToolbarUpdateControlSpaces(HWND hWndToolbar, + ToolbarChangeControlCallback ChangeCallback); + +BOOL ToolbarInsertSpaceForControl(HWND hWndToolbar, + HWND hWndControl, + INT Index, + INT iCmd, + BOOL HideVertical); + +HIMAGELIST InitImageList(UINT NumButtons, + UINT StartResource); diff --git a/rosapps/imagesoft/opensave.c b/rosapps/imagesoft/opensave.c new file mode 100644 index 00000000000..9fccbb8b64b --- /dev/null +++ b/rosapps/imagesoft/opensave.c @@ -0,0 +1,87 @@ +#include + +static OPENFILENAME ofn; + +/* + * Initialize file open / save structure + */ +VOID FileInitialize(HWND hwnd) +{ + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrDefExt = _T("bmp"); +} + + +static BOOL +DoWriteFile(LPCTSTR pszFileName) +{ + return TRUE; +} + + +BOOL +DoOpenFile(HWND hwnd, + LPTSTR szFileName, + LPTSTR szTitleName) +{ + DWORD err; + /*static TCHAR Filter[] = _T("All image files (*.gif,*.bmp,*.jpg,*.jpeg,*.tif,*.png)\0*.gif,*.bmp,*.jpg,*.jpeg,*.tif,*.png\0") \ + _T("All files (*.*)\0*.*\0") \ + _T("Graphics Interchange format (*gif)\0*.gif\0") \ + _T("Windows Bitmap (*bmp)\0*.bmp\0") \ + _T("JPEG File Interchange Format (*jpg,*.jpeg)\0*.jpg,*.jpeg\0") \ + _T("TAG Image File Format (*tif)\0*.tif\0") \ + _T("Portable Network Graphics (*png)\0*.png\0\0");*/ + + static TCHAR Filter[] = _T("Windows Bitmap (*.bmp)\0*.bmp\0"); + + ofn.lpstrFilter = Filter; + ofn.lpstrFile = szFileName; + ofn.lpstrFileTitle = szTitleName; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + if (GetOpenFileName(&ofn)) + { + return TRUE; + } + + err = CommDlgExtendedError(); + + if (err != CDERR_GENERALCODES) + MessageBox(NULL, _T("Open file failed"), NULL, 0); + + return FALSE; +} + + + +BOOL +DoSaveFile(HWND hwnd) +{ + TCHAR szFileName[MAX_PATH] = _T(""); + static TCHAR Filter[] = _T("Graphics Interchange format (*gif)\0*.gif\0") \ + _T("Windows Bitmap (*bmp)\0*.bmp\0") \ + _T("JPEG File Interchange Format (*jpg,*.jpeg)\0*.jpg,*.jpeg\0") \ + _T("TAG Image File Format (*tif)\0*.tif\0") \ + _T("Portable Network Graphics (*png)\0*.png\0\0"); + + ofn.lpstrFilter = Filter; + ofn.lpstrFile = szFileName; + ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + + if (GetSaveFileName(&ofn)) + { + if (DoWriteFile(szFileName)) + return TRUE; + } + + if (CommDlgExtendedError() != CDERR_GENERALCODES) + MessageBox(NULL, _T("Save to file failed"), NULL, 0); + + return FALSE; +} + diff --git a/rosapps/imagesoft/precomp.h b/rosapps/imagesoft/precomp.h new file mode 100644 index 00000000000..bada1909ec2 --- /dev/null +++ b/rosapps/imagesoft/precomp.h @@ -0,0 +1,70 @@ +#ifndef __IMAGESOFT_PRECOMP_H +#define __IMAGESOFT_PRECOMP_H + +//#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include "resource.h" + +#include "tooldock.h" +#include "imgedwnd.h" +#include "mainwnd.h" +#include "imageprop.h" +#include "misc.h" + +#define MAX_KEY_LENGTH 256 +#define NUM_MAINTB_IMAGES 10 +#define TB_BMP_WIDTH 16 +#define TB_BMP_HEIGHT 16 + +#define TOOLS 0 +#define COLORS 1 +#define HISTORY 2 + +extern HINSTANCE hInstance; +extern HANDLE ProcessHeap; + +/* about.c */ +INT_PTR CALLBACK AboutDialogProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam); + +/* opensave.c */ +VOID FileInitialize(HWND hwnd); +BOOL DoOpenFile(HWND hwnd, + LPTSTR lpFileName, + LPTSTR lpName); +BOOL DoSaveFile(HWND hwnd); + +/* floattoolbar.c */ +typedef struct _FLT_WND +{ + HWND hSelf; + LPTSTR lpName; + INT x; + INT y; + INT Width; + INT Height; + INT Transparancy; + BOOL bOpaque; +} FLT_WND, *PFLT_WND; + +BOOL FloatToolbarCreateToolsGui(PMAIN_WND_INFO Info); +BOOL FloatToolbarCreateColorsGui(PMAIN_WND_INFO Info); +BOOL FloatToolbarCreateHistoryGui(PMAIN_WND_INFO Info); +BOOL InitFloatWndClass(VOID); +VOID UninitFloatWndImpl(VOID); +BOOL ShowHideWindow(HWND hwnd); + +/* font.c */ +VOID FillFontStyleComboList(HWND hwndCombo); +VOID FillFontSizeComboList(HWND hwndCombo); + +/* custcombo.c */ +VOID MakeFlatCombo(HWND hwndCombo); + +#endif /* __IMAGESOFT_PRECOMP_H */ diff --git a/rosapps/imagesoft/res/cursors/PaintBrushToolCursor.cur b/rosapps/imagesoft/res/cursors/PaintBrushToolCursor.cur new file mode 100644 index 0000000000000000000000000000000000000000..d4fec205f388e977ef17e1a9affbe286e82a65ef GIT binary patch literal 326 zcmaKmu@S%^3?C2Xmmrf1&{c1JO$V4?eXJ??QZl%!Y};{e~=w l%tlfG(*u&mWWyB#88CS;lYnw0wFH%;sztUDlRY@p0st%35IX<> literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/color/ColorMore.bmp b/rosapps/imagesoft/res/icons/color/ColorMore.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9020fd895df92ef270fc570832d762adbde24412 GIT binary patch literal 450 zcmZ?rJ;cZW24+A~1BiKmm>Y;086W}`U-Sqhm=sxoA~ Q$ZWVd$b!ghxB|K{0G9$$EdT%j literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/hist/HistBack.bmp b/rosapps/imagesoft/res/icons/hist/HistBack.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4faa2262710b2e26731c407a9e54c5699cc36915 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++a6%_ay$2B>Oc@K^}j#8d(a+!ts(eAwLeh(&pJD}`gy^+(|k21c&I!*u@l*@KObK`=#Kxt zf9d~OnSVR|AzD6VseDb7y_~B5^yDsN#Sr%Ich4U7fVHe^{W&M&TbKWfB9jwI2G7nN z#8eCs`SJMX{q_iuE$cdd&q+U@qW|jZNnDCyT5jBH4gJ4&(d}Zpr>FPgR}9y3wC`1k)m9nj^=mx>At4<0=D@zWwf+I z{pIUdxcHBsKU-T`#D#_8Vq$LHy7lMpU$_*I@%zu8p6>3`XU`yu@7=pcK|)MhO|`GD z_sf?raP>en4<0;lu(yBs=n=B|A3uMT78U4fsJc5l-MMoIqW=4j?;k&YjEo4YudN2! z0yhN0c=h^qpr4PbqFho!{JZz>fer?ux|%8*OUviapP?y+aGyPU=I8CDr=?ktpLhQJ z`K0(bV?%@G%a&qQ3=w?#>}jB{kCDEfiGjX_sfo9jCmzKRsne%VTbdZ#T3PyddA@)D z9*_FJ|Na3(BQ-h6+T6^>(!$=sEVmimD7$&{W*0|CFE7ud$BrQ@hA03U`259- c^&2+8eR1dR-O8$p^A|1v{RC`1k++;71>CpCjIp-yh$&+YFPg*Ye}>&HL>U|MxHbzpmr=ob>Z4`me5@#HHo;yJru(B(Kl zT7G|e_nC`1k)mJ<<28hkso^N{o#^zkYr=weWLS z`1d>K39JA2?`B)vht`0%r+5AN@QR@NS0}cA=mF_Ao;I z-#-X8Y8ZYxzxPdB(7G72AK$-1)LbiaIG$;>E#72Fh~88mjV?D;WWC=HEq~b(v^dS< z_wU~j@jsv5eBC$$-OpQfaKnNtX~Wox_%viff)HoWVO zS`cTsyCq>?W738cyDdqUpQogJSzPw}?&)u*)*a8Z28Ib-%eT|pzwKH0s4;k3s_phP zo0G-vU*;BlU0V119w_4ee0>M>K3p-7@%QJquSeH?JGkQOhKXM{^?%(q?aQ*dU$;&n ht3hJ}wfww&_WSwW-wv<*_2AOKKfllvkj-Ua004mmp`!o* literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/hist/HistUndo.bmp b/rosapps/imagesoft/res/icons/hist/HistUndo.bmp new file mode 100644 index 0000000000000000000000000000000000000000..da8326e8cf3a9a5648afd3e0c09765e971e55861 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++fS_O3kG|Tu;QOa{MB4uS&iPMm zL6^#Xo}E8JjFvwiUcEiN>qASx)w+;>KtP-~Pc_7R=m>pvVmm(dfB(Q`ADlgWyTbkb zB~g+cytc{qvc{K$E}BDf~1oV{3}drc~RTJ3t10dHZa2y35^$!0&q(BGmu= z^Kwb!w^QqWUf%z0^Tg*p@y82X_hdWmYfRkN5Va!F`dxR_w-Xx>>i_?LwW|BiS5Q>` zIJNoPrit%o6`U+`-;r*+E!FmZec-n}3%{Ml8Kggst^K;O|J$}{UpMuC-7xXn!4+SR muKWA*8?yOm?B7pr{5Y}k+u@bp&+qC`1k)mozbp5_f;X9K(r`8eYTJ4G!Nx| zH>ECT#WqI;tS&iN8T$9t9Nv8q4Wn)3hu|64sV z7n=j&2&kpcRSBqm`=ZIoo~Fp?;-q4r`hS0a|9=1K>%Ge#&h2}9csAJ>y3yW{f$-6o| zUS@j{_pRf-`~D|d;j|5vj=bPU3Yxwbq1aE(uTvsz10IB>U^={0}?&Ahx{Oy9{bNn0hs<=)=iP8^g8V zTt5p`e|*zoi0q$VKYx7s@cGrV4@cG^tAD+`^=PW;$J^(Dih=0-&Xpk9Tf6>WSoh)H zC17v?)xSTq`u)LG?{_YEyI~R#{djT{q8LbC*|#2U8qg!Vmrc8JbXR{-^uxOdHE_j1 u#*IUp;Oc>l;~N((ZA!zX7@{7i<;wnbKy+@$$`hLwzj$;H*+2@}3=9AaorA6b literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainCutIcon.bmp b/rosapps/imagesoft/res/icons/std/MainCutIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6ffe6fde2d8c669764bc67784858556c3da821cd GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)mdFaXMee=?NGThCMZCpl-3AZK} ztWL7;3NX&}vH$(&&%={@vOO%4TujeyUxQWq{g$wAPw(A3ytOUB6sX`*f8MGjyJQ

L0g7{CIxv!=u~1!RFsSf4o)~{Po%0OFLKRIO}0m|87m!)3&e;X^s=at=F{{ zoG$nO_37QiV>>2>SzuNF>&5-|6BF;YL@Y{jo|_qPxH9Bwwg1j+*At5;U{wzk{Qc_D z$2DCK+ahi+YCTu!f2A(u-pc-0S5D$m4-xOF$SzC>YtIO~a^etvl|b2Nk016ml-B2` zWW|Mbx3>^ffA;X+MN_(WY*^LTSdozsO;G*8t!o!g>wW(8@%iJ2auULyK6{2=%j&sP zP9E3=RP*lDi`s(p`wt%CQUCV!%f-`rzI^@!RP+1yuRWVqpF4FNkNP`TFYH>6NNmp^ Q-P^i)2_E&tNHH(~0H8LQ?*IS* literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainNewIcon.bmp b/rosapps/imagesoft/res/icons/std/MainNewIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e3d27bebd19f82bc825bc70f2354319e183c48f7 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)m8EE^W$;qCkco3SIK=uFs{|Ay- z5zrj0>VaDR{QCL*U4=jYc?UtT|Z_wW{0^@rEZLsk!D!#$2w{fSMB(bU5|j#d4cZOhTr1Gzwt0~G^N zikBH$cwXGS8dE()B~US@`m6ibW2)b|Wa^cpyMT%xUOkIu{*6PMFx4MeJqM)t8oFYj bUZ8qpbYC`1k)mNvO1?KdqrZp|U+Zui7su-z6;3 z(j!RE%2`#L{g4VNQ_Td0&Zq``=ri=tFty;Vdy^#K`cGTIXd?7H*FEESt(sU zU%qIXl6TDB!$%=ns=B7u?YrEyWL@2z|MBPlho1iLbL5xfp0DPcKj^J`t+L>$aL*Ox z^oF?1T!{MGz8RI5-gGZn+j;0*;f?>Pm;c9{`yY7npXb3}_B+3tYE4%QiIJ{g-k1fBKdGNf-Y|oc-^2{Eyqd@7CKs8LoMwn%P)2 zbsEWjtFa9$3RedunyQh|SOzvK=V!^9#%ijHjXsNn| za1Y#JKxL4?0g`=-Rxf||ZS{xmFfD%zul(+ux4doU;-)F{>n6;q>Y0wLzJJM@1($9C z)x)*)E?jls;&r%z5Jq2C@Wc%N$>}~f9y|tWK}LJeqbmk#xqtmqZ+6IpOn)?UkhxP! y60V*+2o(AD<@2(MP4}){oKg~xtN@Mu?D73&6B`$HR;-%Ze&P6jG+83K3=9DOtUF8q literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainPasteIcon.bmp b/rosapps/imagesoft/res/icons/std/MainPasteIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1936b3bd0e053956a6ade38c06ed9b5cafed6f83 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)mg{UzjR88Lk7rJrhK}ubpe_Xz6 zP@=h`FHl)$Vcd&5m$xsPjER7Z@j3n3=+Gz8 z^)ENf>;S3AN=7-<1Z+s0t_l0lshiwb`fLegI z039}~sbFGdIxxiGanv<$*~$+;X1@B-@%U@*#aF@$uK}WonlK)q6)~BCB8h;X6>vviIMMr!QLg=4)-&oKr0|9x_AE47w>1k_|kLrky~0>ach57*VNM1i8t>( cgsVqmv~51zw03Xh{0+D6KSGltkITRS0RIRYvj6}9 literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainPrintIcon.bmp b/rosapps/imagesoft/res/icons/std/MainPrintIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1e50040a4cd3b037d1cbbcdaa77ea8a07bbee06e GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)msp#3myY*>7HA#Mz@!n-I9z_u@ z`Js;4fwmcbR;k|R$)2V_v~SBAh_R3E-Cj1K`SIC(+ZRp7gMeDzy?F)Ha`y0^4f7`a zc>U<#mv{d@Jp23N&iC6VKA+wC{?Jl}g-j4s7~u+3Ke@34sDAC#wg)#Z{r~gpKLq^w z_51VNua9rMyLy!2KNrLQEkG@`slnMnc0esa^{Xb-zkc=@su)K7{QBwR^M_#dTtM}m zg$d(lb^+0t0`o&{wXWu-v z7ijvQUq68eX!4gg&)+<_xqHQ|ss!Jq{q;xJ&aDQU57F}Z!yBNMe}DhHdH(47=|ezt zYWIdqhqgbwe5xfYvOYCr_8MlZMk^--P8MUk3ejBap&r(oog%OeU9zkjI0>Q z{`uqE`JF5O{r&st-D|iN$2PBcbmeqgUQAN!B$t5!0G4@C_y7O^ literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainPrintPreIcon.bmp b/rosapps/imagesoft/res/icons/std/MainPrintPreIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6ffeafad197cbcbecae6dac8b39f9e031858e75b GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)mLA3kGS#?93?fVWxRBm51IoZ<` z7YgxmGxkZhDBr8=k+%QXDWDdh`u|`O$Us9qZLKE08K(6Y9A`WU-~84;y$r4%sO8VE zpWi>eyMF!3^y!mwveMI1k^;k{or@>CFL<7K>~C@3!YjA#BCG%R@8A9V_a^suZ&@+- z`r!>H*3GCd%MFbTkDaihV8*8H2aW+1BdZ5mv3b+F{W~}Pe*gT}vzy;<9shE6Ykhg{ z+_`h$ih=5PEu98b2?4XF_rHDly?prwvru_fH zdDC9MeER>-Z=janA71==dh^EN%|%6d$m$QTn+I2a_{jc4`*(u4U@d>%JzF(z^19W_ zk=38rv>2}b+m9bRc5FIwXwRG1&tJcIv}xUv(wyXP-@YQNKeKH)Ts@HS?bq*vM-MKX zKYe0v%hZV-$-Xwoih=BlyH_Kthp>SWm*QmxL1^l)?q83oe&>>@SB~xis(*O(ESmZo qhc;oVKd^cZNbxmv#X!A4^~mVTzIEq!t~|MU30B2ub`j(C`1k)mJ<<28hkso^N{o#^zkYr=weWLS z`1d>K39JA2?`B)vht`0%r+5AN@QR@NS0}cA=mF_Ao;I z-#-X8Y8ZYxzxPdB(7G72AK$-1)LbiaIG$;>E#72Fh~88mjV?D;WWC=HEq~b(v^dS< z_wU~j@jsv5eBC$$-OpQfaKnNtX~Wox_%viff)HoWVO zS`cTsyCq>?W738cyDdqUpQogJSzPw}?&)u*)*a8Z28Ib-%eT|pzwKH0s4;k3s_phP zo0G-vU*;BlU0V119w_4ee0>M>K3p-7@%QJquSeH?JGkQOhKXM{^?%(q?aQ*dU$;&n ht3hJ}wfww&_WSwW-wv<*_2AOKKfllvkj-Ua004mmp`!o* literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainSaveIcon.bmp b/rosapps/imagesoft/res/icons/std/MainSaveIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b9d93cbad2e576a2ecc431db48d629d5328986da GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)msp$Q=^M_MXSA~Wx2@0O?A27?; zcZ!!+zq@;8;3k`{2gM=MVbpix)eZ zE^@M&V`~bu1)}~+Y1#kz3%*X62-E^p5A+#O%gdYR-rT*?T9Urb+j*6z%VH;+T01+4 z`s>v-|5vX14b(Du3Q#>9l_dq$W<~D`3)$rF1JnZa3q<|x=9d4PxBOqb?$6>SU;6qX z4!d7jb-l3YVs_5K*cgzO03V?DA?ojUb^qVJ=l{0tCzBJ7#D(pP@ZJ$*zuDJht-Ho@ zN127zf)Fjh5QC_HG;z}Zz5C9jrT+(m-#@;6d-v+Y(|fOOUwV4+*uztMfm#m5#sC8u zqWB-W$E3-a>LFTy zA+{kR5{Mw`zi!(OL_l31*RFfFe8sDUi=NM#{bcf#2Yvl_+dFPGG+wK!zFblYOg0ep IB#{gZ02mA{zW@LL literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/std/MainUndoIcon.bmp b/rosapps/imagesoft/res/icons/std/MainUndoIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..da8326e8cf3a9a5648afd3e0c09765e971e55861 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++fS_O3kG|Tu;QOa{MB4uS&iPMm zL6^#Xo}E8JjFvwiUcEiN>qASx)w+;>KtP-~Pc_7R=m>pvVmm(dfB(Q`ADlgWyTbkb zB~g+cytc{qvc{K$E}BDf~1oV{3}drc~RTJ3t10dHZa2y35^$!0&q(BGmu= z^Kwb!w^QqWUf%z0^Tg*p@y82X_hdWmYfRkN5Va!F`dxR_w-Xx>>i_?LwW|BiS5Q>` zIJNoPrit%o6`U+`-;r*+E!FmZec-n}3%{Ml8Kggst^K;O|J$}{UpMuC-7xXn!4+SR muKWA*8?yOm?B7pr{5Y}k+u@bp&+qC`1k++AVe_NVW%l^Fm@BMiPFv%+L?^( S58By6JCmv9e&SuozyJWSY$n literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/text/TextAlignRightIcon.bmp b/rosapps/imagesoft/res/icons/text/TextAlignRightIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..064f09b52700494f6323e00a3942875f699b0326 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++phYk@VyDS-Hg>bHiIQhNvMy|< lBE*nY63<5HC&VJ&Ok67Q+ki_KesTO}BFo}8hgz}>3;@ZxCfWc1 literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/text/TextBoldIcon.bmp b/rosapps/imagesoft/res/icons/text/TextBoldIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ffb0b3ab290202049b8c5fda697d624690e61e4c GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++@Ib6AtY}C?SY+1h*`Gdt#_GXi z$B)C+0~PGtxf93*h6+#%R`ozZWc9!Q{DG*Km6at%JxS(6EMjA2i;IhU{^AAI%?BDt c(EVr5o<;UALHENI!x{L)AD5@-EY83H0NI6C@&Et; literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/text/TextItalicIcon.bmp b/rosapps/imagesoft/res/icons/text/TextItalicIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..604273dd13216a2c6e2e2c4d2f0aa134943f9b28 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++@IWvRA!vgBx_j>)MD^8c*9aHW-U<5f`to-R8O`QK#Pd9;{JmN5MKa8j2JBt O#c+}sEd!;7fdK&g1++i_ literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/text/TextUnderlineIcon.bmp b/rosapps/imagesoft/res/icons/text/TextUnderlineIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..25de8272d0cbcae3bf1f41608614d5e5333ebb19 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)meGm&13ob-O2cTJj-(-m5mZlb< lG9U@z;?aVp0F8^O5lsOacbKV%_zvzzG%luR2Z;y+0|0XBXOaK_ literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsCloneStamp.bmp b/rosapps/imagesoft/res/icons/tools/ToolsCloneStamp.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2dceb3b5335ef4c277b428e74537e44455dd31e9 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)msp$L9U$5SNc>Lnkqvs&>@Y%}; zPhZ@B^5Wi;=l32zyZh+rlb5f*e*Xb67O42_^*iY`z47JkKonin5?;_4lwISSR_>lq ze7?k=E<+#eE_Qe@$2{P zC$Hvi*gtjUt_jPw^)A}ny=X)G>@}@(Ry9pu-Y{)R?W9H36BeAib{7~jK=nZM^Y@>R zU%tKh@cH%oPq!aFYoD>S==wkB_`(Y}?!I{Y9vC2RKYaS}3#u5R1x~(v`@U`FlFFO^ z{L?Feu>cpx#ek@xnOGjV@}saQgu~S;B2$ GU;qGbrE?en literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsColorPicker.bmp b/rosapps/imagesoft/res/icons/tools/ToolsColorPicker.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b7b4f29e47aa9c797c821b4dc9718de062d79877 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)msp!ttlMi>#ezvse)#Si89TxAK zb>DVdzM3BNd}Yz2y|eFJJBeoC^JUo|TD6-p!>behKeTCsP&=3evw^Z`>hD}X`Dp*_ zoy%tY|Np-z(lyz`_+78%>sdk1R}}%pG0lf-2WokG@AlR?{e@vpa6vo_h!xN8+yH7R z2zA7x5-tVRa`!r^TAtmx2Gmj%;Q}`b4+CP$y$h!xTK1eiSJl#rM?FvquI1GBwQ|zp ztSn6U)kC!GK5@cQPsP!~ke8F4p!$R7FWMPt02O<9xLH}4Il8z^m^~MduG;1%RVg74 zH<#qth`Nf>=&%q|ODjC;fl|9qo?f_SZE|wb*|TT+x;iYZEb*&{$WE9u&&7 literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsEllipse.bmp b/rosapps/imagesoft/res/icons/tools/ToolsEllipse.bmp new file mode 100644 index 0000000000000000000000000000000000000000..740288ce0bfbfcbed3eb8c5dec7c4f553ff367e9 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++;6#7_{X22;WJE*+A0Hn(7yubS zE>I9Ch34ktCrFDUx*Vivvycmdp3?LUM2$TXUfNNQ@bScpH85tQrfBk|B z!Wlq8pcGI6P#IA0QpW+E=(7q=>jSMDg!DeRXwTh a0oqHFe1(1@MfAk&P}*7rpT){3QOf!Xp&UvOd6lM^ceG?6`FRasLwcK}uXhAsdA literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsEraser.bmp b/rosapps/imagesoft/res/icons/tools/ToolsEraser.bmp new file mode 100644 index 0000000000000000000000000000000000000000..05ec19f988951ac439e03da1fcb1ec5457f5fd37 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)mdFcDMuS9D6@%|8dZD$Wa+b-QOY-#onS>fW{Y&m4I7==T5r z|2I!*u%k zuZhtzxwVRTEx&&K1iFwIEpU&}LJMXHC`1k)msp#*&e;+=6B#1tJ{tPjB_MAB| z+wjpG92^k!T3T9N-QD=jzjXOB(5&|#J^-}<)vsK&il8rm=AS-uhDh~q-@RjDVL5-{ z0zvgJU%hH>X<=n$4GRwkh72C{zkdHtPEH0oTT@f>i+7N9ehuULVp9+#HR&Q74!Sk=R| wczb&TgANjRK*umLGQN2E62BI-G%C`1k)mGJ5y^Ju(+R``-Qg1_lQB)ga6E z_4gMP6d;S>XM1>fY}>vazZzs&Sy|Z)8#f}0;AemP{yiWdfFvtUoIJ_F!2t?KAt8bq z&z(OHR0i}l&>27yzeb>92M33@+qOwbNde85k&*edd-uQN$A26=2z2D?HEYoP!pFx4 zQ2031i!%|4M3N&i6UB{4G!pp-{sV2$bR+0L&?Gc%+O%ntCQY0A%IUk~ zoO62PZr}IbbKiaUj!xIEYvpKTH8GpdS=01Ve=Mzrm@naayZ!y0FBj7^#qlIbzSc>z z%yArnMNuU4qw(1DJXt{;1VI$X3Xe;B#afApzbfwmzMMnE1h%)u)vyKxM2DoWK)*L7#}IRPbw zF4spYy8&Zi0{Z0fcODAC`1k)m)lssCG4W;s6&FRi0ueD>0b(&}C|%Z`q{!YFvsTCNJ9b&@J_hP4X?x;H%O$8?p=M;R+3i zgQJR1<@dZPp7b%a>IF~>&=$B~kev!=XSZJJUixX)#-BhfKwE$ggG-??Am;Bp`l_t| vAy5m@7NEm`egP_jNTI2RbAeibwg4Rl^b64YaB)lqra71*xO5Rz$-n>rTJwC`1k)megssAUjedgLqh{lJ&;5e#Kndv zgP4z|Wm-)pnl7L+OaNCir@5d$H3-gyFz}eaxU0M))i*cT9#ad@7Bt5I)vTIWzqF&c zGsC|%Cjw0iP(7Lmkh@_<+ls#G<=quaJ4@R0qB`?q(tIqk0&L1+JTVmmMYhlHT|K#B z)x^4${WZ&bDwlPYc4r23eTU!)s>3 z)z7F-1+w3~c#2CgQ2fM(c@XuB+KToro&4s-6FiE6Qm3~p0;*r!QG9Ci!cXsB;a3b% gzo@+ksO!V)X9N{P)B_d2efEGD#SryGDrR5+0FnTIPyhe` literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsMoveSelection.bmp b/rosapps/imagesoft/res/icons/tools/ToolsMoveSelection.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6dbcbe37a61b83af39b333c19f4fdf21868687b6 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)megssAUjedgLqh{lJ&;5e#Kndv zgP4z|Wm-)pnl7L+OaNCir@5d$H3-gyFz}eaxU2lm#nZXL_Ly3LwxBr%sAko~`k!Au z-o0|RH75d13s60p2#~vBM%$lXKYxG!_Veqf_PnUh{FpQ!i>v^fvKUWH#Xynm^Lv5u z@bB-RzrTO|{_*|Sx6k*lp6keqe)8ZhR`q+AP5BQ4|Nj1cbnEJ@ru-)lZevvp6g<3U zCQSMNH_sohp4|B6#Zz30f#N4N%!8=^_UXgkrIX*hc!EbUQ0nxSML_l6zkEEkdEuvb lukb5|sQ>o)15nq8*UtzlhNuTBe*5eJF^VDTiB!zM003^$pxOWc literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsPaintBrush.bmp b/rosapps/imagesoft/res/icons/tools/ToolsPaintBrush.bmp new file mode 100644 index 0000000000000000000000000000000000000000..e5a99eeed82604978616b4cba727407f10750ac0 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)mt(LKv1&FRdp|t5ak4A>+l9Sh7sUKZ74VM<6Emvk#|GRza_r~6z6JuYrhV03(1KNU1Jy87q(#}7( zPW-!l{O`U6-wt?yv0ob7AMdTPN?Yo|seL#T`<*Vbdl&R(yZ+?8(OI z_m*^4F4~lH?iF*_QJ|Ky7cS$`0+f3F;bZ=c70X_H3O)aYyJj6RT6SHy0nrk2{tIK@ dY4Wt-cNI_;%@%^{(XK>fu@#7yu5%nz{f0 literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsPaintBucket.bmp b/rosapps/imagesoft/res/icons/tools/ToolsPaintBucket.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7359751e42852bfb43b27585196da67fb8e13bd8 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)m8aljmVzQ?xE`+8S$UVGt!teL5 z&##zzd}i~mNe#=J3#XMNx2A@BnQH?L!Bl@_>BKFIr~Ui=>*M{a_czWyxqNzIw9oM^ zs|r$MajAdv^x?W$U4OoQ`f&GBZkXHLuKKxsZ9XQNSk)h0HtGNW|Br55T0gUMUT4kG z6*G3NUc7tx+`qR@AgllK;qAvaFM-ZGx*Vh)2%g=!_VU)*M~^;*W}Gn%Ie+2s6}bA3 zZ(cN{hvkR6KEHeY*z(Ch#lOCMd~kf%&#&)Oi%xnkc&l7;TFdJoME$3?ui7$0udbi7 ze@b0RtoQ!89YFP;pFdijVDsYIncnG_CLey`xAc8#&Mu((&+lH(t;zWG{Nc-sM}S(6 z&1^0Rb$ogM=D&Y`w`IEQpHTVe>DSpy@Agi+{O09Hp!yX}IUip=|NH0nmsd|AT7b6X zhdOSXSarHSa(Rr!k!6#BF$h6NSIyYeTMkqVL67grxL`+N!h;)^E*#w6U!Dq#IJh`2 Y#``xfC)H&2m8X1o`wEvDh&TfS0EARdUjP6A literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsPencil.bmp b/rosapps/imagesoft/res/icons/tools/ToolsPencil.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8f1a4c9171e9b89d212e7a69fa6f51c06b60e66f GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)msp!ksuXpd=yL9<7kOZ;`Y6mJ~ zW@hFQ6y+3@K5_06K`mEq-V~Bm@?3JqzUQcjq1EY21hhPQ^~$oY1E@az>5qgv4C`1k)m8R*;h?-dml4q%XxkpVQ}+4JW> zQd(Mi`HB^+tgHe80^7E4hnW2C{d)}!jSO>!{iz_-;KCp#%ny{hcKtfg6?}Yr_a8g} z8pzGf4N)Hv5m8~!@V^~_mPaxGO#sR=GBN_S0Br%XfeeUx4i1j@^$5ifjS7McK=UCA zAS6UR(47*z=!$__9F!RL?cWbqfA0KwDJdxkS3*MKei@3E@68MX91IXIL)65_#{<0y zVYjund#Eu0)xf;~^m{@=0^D#+1~3eP4hH%f7&scD3?3dHKs6^%opN+6WMF78Fvvf4 z{5YB}pbLQ()z{ZUoDFo0h{$9H24Jv&kg)JBOfASJ6cjYDu>69n2Qq-RAS*y)TUg{H zD+aPfL`u-qAalFACv$Uuf@@)A{T&!siL3yP4NL$^N?BZ7AAwrf*}uxjG$RKunqoM2 W+VtsOUPXQV{qVqtOA*OnU;qHA%NQd7 literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsRectangle.bmp b/rosapps/imagesoft/res/icons/tools/ToolsRectangle.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8fa788b6a49242980a9260ea02e0c926e119ecc0 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++U_-rqeK6PIqk+mGE(bDFQ&S&3 pevAhJ6(FmJvvK(yr~s}8nLR?(lNz4*;t3`P4^LcSI3VH-3;^Qmef9tV literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsRectangleSelect.bmp b/rosapps/imagesoft/res/icons/tools/ToolsRectangleSelect.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1d4975beedb507d7fe316cdf11cb27545e1027dc GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k++AVmNF|A#mb$iT`*b2CuQzvIVo zA&@L80ve7>F;JXT^&rzw&ByN^Qq_~{9#Ykl>K;C`1k)mtS4KsCR9 ze4iC<^ZCPDxOyOC!^Ea6E5%|r17txsduLz8#>UKtH!k13eD=YWb1xs>X>ipnuu+*= zo(5Ng%=q~7>8xn0#RcKBGXoan1WgJvZ}rs4wN-if_yMvqWcG&Ygm+KwK}6;xyL9^K zEvv$AI7H2zqdT@XWB}QZFP@khYSQVefB*b(WCJnTt1>;meR{vTBEHYxXl^DVxG+^h zL{2a6Ke?c1VT?t8fbs2<2XHBai+}(8VNI^@x*Xpnnci?g{EU6A85;`&KR&pQUm0BX R<;@F6r`Eu^bY?Ix000Pvs73$) literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/icons/tools/ToolsZoom.bmp b/rosapps/imagesoft/res/icons/tools/ToolsZoom.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2662eafa2811643e67c3190cdda364245e049225 GIT binary patch literal 824 zcmZ?rwP0od12Z700mK4O%*Y@C76%bR+z<>C`1k)m)zP)<*NaL@jvYUa-{e34{s9#n zJ$}qLz~88MvvXPre)Vw0+S8A<-*}%gc_}XSf00bas`&Y%duMm8om`V$9^q0R;XJ1{ zd-d8ix+YFo72myfp)Dh1Ze!~HMRga}wr`nQJh?P7FT}yWVIrn8zJ2}NnHO_#b@!W# ztKMB&_vZZa=f~&W*wnSKF{vob3DeC-wy)bTv+>jYU7sHw{PghPhkLu<-q`f~^y15F z+b0!==cdJ?`EldCiD&mL`SRk-w|CdSzrXe6)um65j=s6N`SIboTc;FtpWayb z_|}o{AMgG8_WJjacRxQr`||Sg`#bxdpIUlmSyNGnJ(~Lc8#MJCuYbJ1|Jms! z^I9{uE}w&@{?mtd2RE<0cx>OdFRy-nd-m%4}lIImaFpQ5P;a-Ti8 zb70fTQ~NhxJH7kfmEDIo%~(32thYG+@~K0Zih&}3|Ni~<^~?R6myhpUzkS)PB@>%= Ot(yDs`6H}~85jU{J&D=? literal 0 HcmV?d00001 diff --git a/rosapps/imagesoft/res/imagesoft.ico b/rosapps/imagesoft/res/imagesoft.ico new file mode 100644 index 0000000000000000000000000000000000000000..7f0af5194c227f4d11d71daaec69db201fbcc23d GIT binary patch literal 29926 zcmeHw30#fa*YHYoLS`4&HI!MdF%%;67@^G4sG^Xj6QxqAqY)V*WT=afDT+u$=9GDs z%yZ@pyY;R0oO8OF?(n|<@BMwh@AvL|m;LN{c=lfNa{|x+9cb6CD#c~NNedtw0CaVg z=|^P%+QFisT@F$R_gY;u(2t?AJmt!J*BDMu+i%Fx}Ycz@ZLe)UKgCo0{FQCw4gatGq5J$ zb#Mq!M$+@w{{&DWJ~GzxgwhDEAtPgrS7W! zn}MRnEQ8uKO>cTR+>ds6kYW0+UE39NyT#N-r0J_(i^3>9yj!|~LQx~ekl#5KaQ%uw zX=zlyy+YBx+cJOJAXILTOp%uEliqDtn!>fVfj6C5l(q-7)6&vXy?uPTDO~5q(Ey0j zups+fBp*||w%k3fopyV~6(Hq@y4u+FncTdb zVLOl=_lt;#@Kxp;^cn5hv7M_|IeHs@p`jsus`?!}8g`cVlF6!5zN5FF{QiBZzGj~R zGS8;+rZ$r)e~dgL!YiA*r{m@-2RBbww~_Q*Ior|k7{6T#t}|_{Yj$?;(@RQuD&H38 z+c;|2jVZYUHQGz%05ffx$_Lo>8K6oU#I#dB*?Cmg>{G6}DjPJr7%Cq}yL)(abQ`W3 z4ZuA{nXfTGE;pX?@fh^)NvtbO1LSX5Fg~rFq7L9YAWL*4V3b~XrNS29T%(82>ykPRxr~< z85cHG#sO87F=$G0F=$Bf7l0zJUqqK&6&sbrRiyknpp3OuG5q7Wq13)7sACf;Z4JuU zRh93pihaL}mGz3jUuuV$$T4kz6l-E3<$r-HSY*Pn48KrZ44PQnP#GhoF+fwfulcGN z3HPA1zf#O}Mwg%`ftt<$(a0Z%03s?>LUcun=wEvL&(ImU>cDs_ya~650v#Xe1ThL_ zx*(%KLo>Fgz@^HQr!8SvDo~v`Z9<6(38BcnLn&KZLcrXTs0KBYNvNGtGM^wOHa-M3Sopo=x|pJ!?^~A(KI10PxVPpH&k@##2ApveZs@L z87T~6qUpWxJj26NQ+K5SqdcAtq4zPh#~8tU!f2B@9V*kR)ya^S9pdZ7X@fqVO|@zP zI7LMHa#~hP?lzKej&GFQkSWguDNC(4@MQTE>gOAIWI42PQkq$ z|2xL5YOUJ*0GblwC^JSbcazfKE=8_#dQGK+T-K*_@~dZBloSrpHO}PvX1)Zv6oc%0$gGkN4EY3wDky5055*0sr-p=!=r z3=~=b@mvJFH1#>xCH(T^5I~2TO6YJ)5&cV#|HX4IlMXEPM!PH>CVHE4N&;;k@kdll z&wOU7T;fZZGYFu%e0=?t&pxR{^Z4M<>q|564+VcZG<2ZTcX)qrr32{%;G-}w2sQAI z@}=$+={pQ&wf9!|(Q|m{E`y*h-cs98BCrZNP|?&jJlw~}TXPvA4dop)!m}ISENg%u zb4R*pvWLg$*?j<0A({8XOaPCLGQM!ZJX`lZO6tS}Le{ZkM~Xm3J1e8JNvlxqvTWv$ zNC3SGKti^M2=08*fP8{NUkxZSrnsIab z$Zz-oiW)LcixS^lm1dwzpnlH*^!(!xKrfX_=;cZg{Y#Jk>OC`3(q@K}H%bv2K)c0h zj$H}$1VFe^C`hq^!c{?tA>6>-P;sAPAEOv4e^;7&G;K!E7;~ANE^;mE$om+8jf`*+ z9|;?4+HhJ7@1{0QR*4oFhey*~kIe}EC5DKfZuzMhpy(Mp<1tL zP-gsODBoKSzYcT<!Gj0Gh=BvaZ1`|6H#djT<0rwyi4(!Wax9omngJFQr@^p^ZZO`)7REcf zLr?cvFv@E-*xTEKt)mk-J3E7`%M|eSZ~k0kl+Dx=FEYJku6|_ReM-I zxeKgwG=eQNdq9Z&AXq(f0BoGm3lcnsz#iWLkl-~EcKVw`Fd^f8fx{qq?r7K>G6uo} zJYk8#7dC}DK*j=lNL}IyhoY6i*F-BJld&x6skmxF^}AovrQ`fq_M&WEAu z^kY!f^$b+?ya?6j$AUrF5@@$@C1}JZL5*b_pi}HRD3h25za;I4ZtJ#!N#YJL3krkY zkxRicd@(qNgoAuu2uzQO1$oR;7`c2cObJZ@x1}4P-yb_*R8k5I-M$~jryKZ1mjz;VNB*}u*g0S(=tzj zQ+6JBj?}kcmtE}zk_K7FTp?m8BBlp4m=)zfWW{&2vUSV za6}k{M?}DqumFf$7!C0YgCQVdDMZICgqWBZh+Vb}7RN4wWh<7$iWMth{n9Yl9~T7c zS1yIsYvLgzX&Eet-vWUvQy_lrT8Lf01r{gohIxAr!n$?qU_;U-*s^5{>`qz(8Qa&x z`t%IgwQCoor>DcIjiGR1b1+=q9sx&_7Q*ozDgfsD+9a4T~i6dc_Q z_fDn2!`yu^H{&R5Jdg=H_Z@=3LnmPIkrNPk_7a3&xCsX{Ga>5wJy?9>9)#sTg_wKK zA>dgNEPnPL;$D4*g!|87*?HW9}atxl`%7em! zi%?Kd08gGgfwwOn!`s5=@aD}MC@wDk59kLTA@gq;4=Kbo`gS@;~uhL8UGS=ywo87vFen|#DOnoPK zk*_FRyOx*tCRZh(a+#6-o~io!DSL7`p$a?Rig#3(x|YJ*Qq`%3QD>vWAM^J9IVPmM z5uaX3Rde%lb054bRV4K|B}077OW&#P9@1Y4@h(>t9=v+Dqojl$(wfbjr#M~wF7H4| zgN!^OKE2I7&EeIXS0797cGG!}w{2YQf35g!UdGN&%8s(R{-<|&xu^4Z*&jRq*}v7J zr<>QViPPKpmKtR5lsFj3JuSGwM?Mr(|J|ScTfKO?WyA6{lj?Y;zY}kBPo*eF$S(f! zXZ<&CO6Kpk^x4*!;N@#vE7$Ch{YkvZJ+;%1$3FDsQ%U`+IcJoIhw_^hCe2&FA%4v& zcgsls+>f8$7Wv0621FyhAf zn>TN$>Sq#xR)vTs;fY&le`4!Yw_N7lDSfB2{kUq?>ca4w=ilGDsjS~WtE;*?MBGo@ z#`U9Rx^4%8tPq*>@dz97ETIOCO|4!ZUGp5^)t7`Q5!{^UM zmoHw*%F4O=w)>y`KYzN(r=HuIRm)Z`*Y9lPH&-5ccMj$LI=NE6HpV*$ z@$4{e)AP^ifdBJk|JHVN3ap?!Pu z1XV%1B2UM-dl^74g`xlWb$v|*xL#fR z>A#k)548IkElj$%(5EBRO25?6Rn@BNU>jJvK?=>jMfT|yxo`E;vwu(@8hpI~0R0v% zIvcgfey5-JvDLoPUH$Yqr8Uo9zq84Y`u}OG^c_9^L>xb@^^Xfkrev{_c_DTDzxv6B zl0MQ`rN{gq)K9A9)Uu^sUnx1Y3h4xX{qD`#jp*bQo$`h&@s>7Zrn0x-oBs!jC(-DzIXt5+}R z*RLP+G93zo1`Ps2FVJ)NNEkNB3PzHOZPchyU_sC0#*LF?PyeaoUE^Gl4t9V8QMRxrdJ3ej@Q18uD>%Hs7LG1Lv7aCoIRCucbHc-6M#KWJ4U7ZVs6{Y+X&gAju7sIX-)uz!^orjE)8f{EYkUHD#cYMiYc{|X z0>|}9;GB>IuA8=j*1od<`*NZB{#%AA+6-PJI>+RcNdynD}=s>^I*WK>tLR917;sS36rzWfy43h z;FNm<23&s*J#W2&sTc2n=Z!}&=FTe^fA1YkdH5dWEUP{#g1K|&LI|yIen>FMs}V4N z{(Ojz3Wu=hNFdV`#DoXKqUb0HoWBU7NM>EMXd%SKE`=3wDLwUC`jGHq5mTtATpcaCg=dnb26 z$eBwJbp8f}U%CzZ4rf8=l>%7!^c^fN{0wUzzlKAH4ncNSCh4P&z|o^e;l#-kaOTVz zAPE32Uc4yDr8jThgeRA>;CB9PD9k?xckbMQ`}gm|Xg)LY7hVG;3>VYw4*g zw4trs$^Y-9|D{aAOL}!{tIHwxLt){I7tfwOJNH7BSGWBMLS5>R`#~xsiT#{9t4+(6 z=T2p+QYXXuAaR(p=vQ_-o~xrZ(ry5Na+kw#1)>s zc(GSm?pd%cDgKvT9}9E*W>ZdvpbD>Pit6&j?Mq|gb!r{|_%dhL0f4=qKXQ5DjhjkA zZ`Pw_32|#(D~IG3y*f^k>b}d@^Dhn?(8FlpL8*W5I~x|SSzU3=n9%1h{VP?4eOGSh zoAvMA&4{iEhp>VT$w_O+)?DD47GO7`!nl+x`ER6hQeSe2xW6MgDPE_%>zFCkoNY!_ zXnOt4JE{DLs{G-O1dsR{RoqZ#;D9 zpgz628>-9eQ(;TJ+FDdgB6P-Pmxc`bv%DDs_x;}+S;}CsJvy%y4vc4?qF*}^iLUD)~+kl*3)aLr(KG7n>f`{ zT@H0y>(#EUtyR0Wx;2+fm^!kgLhaVA_v*E0@>?p59`$FUZrz=F=XO3T-Tu!)>1i*G z(ekVI-&FWXQpuko{=Z>gl3ow=EK_Q-8uZLSK}$;uDpjfkbP}Lx)28tI@4thgp&=L= z89|pWU7$yg9-wXF1{!1SK!f$;y}Y36Fn{P`?gEvqr-H`x*(E&5K+=5=9A+l*BqK(Q zfH7mnNPLK;r6o)oI~08EMuXX;X)w{s8YVe7!XW$E5-&pT58yOK$%D-BnFDU5_xAMk z1Wz9ySYT@m2~LKvd4@3rSPg=>X}w{EbAMPQw}K?ncW<6Ef}X8mZ-6QB7!x67?ig4$ zcN)Y7&VcyHIj}Fn8WN*s!NFy&kha7JGQ%f8X5=I|9_I!p;^n0C_J#&y7eGU+70_yY zC^Vn609q1gxCM|iRWMYZH4nV5HPTw50xe)LZwNYp}OUIsA{!A(u4Q+n+HSP zB4LE@TBtJh5LB6#O?vMWprMEbjfhpyRIwN|;&+14x@|CUVJtX=hLinQ0dA2Cz$0`y zcr0EDK8u#X%w=)ly?hmzChvnO#1Gh|9DoMNnNWdvf`+Llp<#LsG(VUJLx>NsAfCW; z-(k=_aT7X_&bkND`W|O)fyVKCNpJl-@dAymzJ&2vXJP!2T$ptFDtKg`0RNmT(D&v` z=zFUW1`=-bwX-N4*<(E_wOe+ zskG%%y|8ADSH($B%d^wyfW+@t=7Y6;W`fjW`SFbSRjU&+R!Oy-g5|9%UO#iHtG;pSrzjSv{poiPEsnd5rzcDs+=1wMXH?Vk* zW5YT%>ogeYK*q<`9XcC!Xes5#OsY|{PEE3B)}&;oUMAfQT1oj4vKkHa8r0OPS)G#Y zdYSYv(3kR?)~HdZZ27tkYD$}J{CmCMq-YhD& zLa%=PB^jCRvBQQ91ExhR7n@JCgb5QSfR&XMjJ0=w!M5ID>M#e)Z9OH~m*rlzv$9=v zg-c(EpV=Sc-3G#XZwpABHvv)=6Cq>%SXde|2NHrN!ylo}us7NPPOT-G)hrrXj0pmm z6$({-=R@VmsZfJ#qitONfaX&-LbrKQU>Lpx>a3sxx*;8Et=R#(TModW`3qoN;7ag| zj0Cr3D`8yl7VulV3FOOCVA>wCY3@jcI{R{7OC7Pf36xoguV z*qWRS+fw$x&Ye49_wL;#GS}6;ad7KEJlxD&4|k6z!|sf1*pzh)c9Gn~e!PrVPh}ql z5=r3nsgrQ-#34y`x_adb+_-TAo;@spM~@!C%a01( zJ6f1ono+WI_f~^#NiuM9w6)^2iE-;D6U?f>=+O;p52SRjKCK(KY@t_q?3lW>OgY`f z=y&}=O&d8)wwc8J_3YEFYn$=ynvHXIvZEyQs3enBXbXetG^qazr!}>8WMybdb#;GZ z%ui_z?ea2us8^MfpsgvBDVJc-T*@e4tuK=T3Z0Y@Ek^x7I*0$H|BbHHZ$Q(M?*FGB z7^|~ZmG^_`9NRnS%Ln#!1>T-&1iTpx{LH}lT!-scAmFy#M`@{tlK(iUDGRs%8K~=U z%yr5U@OI)1YO`mOgFTv{}wT z%BVPkl?1B@RujalfS);!%i^f+3W8XIr38x!7PW2Lb|J;SWy+M{cf^xX7tLWdqKd(iQjR*Vm=_AO85$XQipf-#v8WS*c&N1H&U4qj1gWoIfOI13DLxv9@ z{+f8YV&d~~!-fsgKCWNCUXXv7ShHpgu3EK9F!1@HJ0TeO+|l_Lbnd14)W=;L8yhBi z-v%}Qf%^69hmf@&Crz3pY;A3k^f`k39+7x&UPm$6ygpE4#!+fq&3B0Lxf*BlelT9( zI^_u8X;RGgtXq6$=#1dy%a;Y6ccil}ROcH>UoVLN6vvJoL*hrp;lqao@uo;N1I`oV znuBBq+s%FbT`({(NaMZcd6P_w#2)fLe=Ja=cd|OWK&*kUmBiRO! z{N0e}Ln0v_KYkp^wF-|MIf7(|kbvgQ^G0&eLeh=!9Y%V0d~TM0+wYIkA39565#hyAF$>UZmN(1rQ1h2x7!Ut#p!px6edq7JBwR!LizM~) z9+&Jh?==bINCpPMuxHO6>6zaboiilgR{7r!q^eM>RxQoOjT_5p9VdJD?sdt=#;Pb` z!v-XLfjkEJMxvd=n1>KPCIid%SPoKAtC%LIQct z4CK@&0k4yBF5g|UjgI-Q-)*|rf@oVYwP*g|XMt&19fFonwWfUycfU^?9~WZqD}jUVzC)v1 zZ?NU{LacrD6;_+#hV%S=k!U@yf%j0t5$o2i#qh{5Y~kWj2-@XGP+$BGnFdH_iOx@8 za&j_~%q^XN#-*g+l<+B?4}PCWyaeM`WWIs$sf3#dmog1T!oQEGub%}zvwYUORh;7W zX5X7nIP3W*G4aty9DM14FwDq7{kuh?^7PpP#yg01Yquh41;vB=57=!Cd9QY->=s0q za6xn=cAf72nEGP6%=Ao$fORzfiYwss+ag zXx>V|kkL49jD=XedX>b-FmJ=}obDad3K0@MA053sZ#HYz*n;|HItLc!=8o&)7URcv zukrQU_u}>2cle_4wRraYrMPqV0p7|l5Z7+r7MHJH$Mcu2h}?6R#Nh*}n7JcC?A^K! zCr+^3#Qppr@cZR^(Tu)fxSI75aaO@g9J%TbG|$S#VGoOt{ME4)ou6L|K4ZCrJqX?* z2pJbq9u|h%=}hqZXC93Aj@Pi3&QefVIF_l~ZZ7r9w3+l~X5+{&9q%9Ah-c&7F#pIV zymLGm^N(%E(;GuDJ0TDcEceFU3!E{@Z#1rSF~LRF9dKi?4gRq_3Tb(_W1n@_~()7P;(?SH4;SSTYtIO%k^b ztrtfZPsRgLHez?kIFamcj)`7F#46W*V)5iIm=fb9mV^hQqrJ_PAIx2yRSBxsG@rgZ z1EbDdK+nqsVqEfGF?i!H9CG!sFuwCnntvs`X`+l@q=3{jD4nB&mxa;#WLy{-CQh6@ zDfsTKj9V;5x`qnqJO#CT%qZ6CIu$E-nqV~8VnVltLEiWzXE&bvV~%)ub}v3SvquzU zZxKhAIO2f?_F{MF1hH-IC`^=_id8fF)BKGvW9>Yl@bkjSwl;&+ll?B%B>h9(hGXVr zWMk~JcW9rSidKiup!Ji_NIFC`zWEwk-FSs{avz|E`9y?H#t3sF5Y9eCh~0{#T&CgD zWs8aT4aLEJTTo_|f)!08P}aqX)-V$_4ISTgHnkoa<~I|c=Iz7t8~u=cDe&=yOuTn; zCmvnm!1Kq{&p2l;|NAxyoD}@&j`2Y zpM~Xvw>*Er^Vh%mTGYxoCqS=>0AHH>&@qC1Wd!;5ps}sJnBY1`)EO}kE4W_~RXr~X zok?4;{1AnZ894~8?lZ7zSKDXvyj_Z)UpRp0H_a6O|J!d%&QH0-y#nerL>O!# zAU#jOs%;3yeZ_{1!=hRbCzK717S-feMOF86SZPv{C_gAzXc;+Rg>F-e=gf2vFD_-^ z`3?T!)xE1&Sa3-^$lWiFEV9G>QPv`5-dM5KZv-ZI3=nZHCL-Fh4PMUPT|8mz*tb8M zw>rO)_0)c|Qx9VN2l{gF`A2kp@)50`eL>S(g=l!_9Jadi9;+`&M50Xyt=b{f{te;G z1B8{y2tE2^%F$zZ%NyCFovjVs@=y5a+8O-t z`Z>OT`2?TcK8HEm7T}4^QFvry6lQK*i1a-SX6#77>_hwU?!5=ZyN_a-=`TYitEqiw z?Kyz)?-2uE6$_W!&qa^93T!!Gh-eeK0QK|ViC=HL7Fs6@1YCWMko#D`iF_f=-?*RH zdibcga`6JLPueb^y`|6@yN=dyOH`e4Lg^UB;M)G+jruN5KPO&n|JRB z|KBJ4e@9%qep6h!d=<}~zaY-!oE5owv^J94iFZi<%gIw=B`c>s@;w>2?hB&ho`a&J z`DigHaXSvZ^I90+En@yb{CeqykX?K(Aomf{cTED0-xd%@`%m-Vawtn&AYS5d=0UMy z!wy=5HCD3RQe4d^UsQIw=5nqT76TamSHzZz^^bz99l`DdD50ajN zcsGd_GtWmh7Nz0tFBb8OqiZjDY6b>n9L0XqJ<#6ttCYkCJ$(33qJt_u1M489dgSNEa*ISm{$l!|=i=GZD|t80-G7Acub}(;QM$jT zgnzo;dX3F)yb?996bg-tF9hU0K{$P1K=v&GM{Xd|12H=Dv>>M^JVbIqPVQOMF}F&t z)_0ndmeCX>A4Xn-DDQYk^d3GDA3b~^y$9l*n17O=(O5(D-f7mW_& zAP^mcy=R4H%5jWLJ0Q-V&B4lpMr`N4%XXO(AnWFWRiiPX$tT%jgcefR5a7~dC|IBz_K&gQhJ)b9kvZy zDyE#dij~`S+E{wLvPM%@H|sGP*I2d1y!aU+YyMc=HOEZ+;W<^ zu6;4tqnFt0(_5^u?|`90^cIxv=V#Blz591{U9=3>6aE=xKN)+Q^gt666Qubf*y$3DPMFa-`$639iTbI$E}Y^B^joj_cK-f@n)F?6WkB=y6{pt7 zF=s=tIJ-4U9Eowlqsv@GdeCq|-{@l6oWWwZZ$Gidj^;n~pUwZb?!AnrEnJGtn>9l^ zFFY@v6YsMi{L8uv!8$q8Y4I9(uLbGp1^IbNXNlLq?}+t`tS_yvr~4h=m_I~!z;dgO zn76@CkgpWYKZxcZp_;$*SM%R9r@vThXMlJ~wcVn z?(Xi$IxNzENqRVv1(Eduq>E(zG_tOa=g#%{eHa@XV?$lto!{<%#Lz}{<_&6qdx%Fq zv)UEU{^5sblN6Y}*a@>^UFiIb#Qni$m_FAOlihn_xLG4QKYC-n?dM17%B|XUuGgj= zcIwzs+JDyD@|^gN(s#aW3t)Y^Ab&dP{E$9P*xA_$)(7)h_RwQ3Jcf~C;dSH@E7x9OKfmm(X3KtF6#d-bfJ`5k$*yg(qev(n4 zN%KxMbsJ%K+B=>bpJU!j(jf{{Q&S|nfM8ny`2kAn8a;ZnG=J8OlWvXYF4bpTMc>`O zBKS*wH^Qt*y}72%#`No9a@&mVy!piGV(55RVKm4Fn;DNh_LFJ;G`o^s6N7rXdZgzx zNAmwb(lbkEf^7kOe%P+TXPx$6!b7x1Wc@VHe+cPxd9AcIp8Gp;6m9?0fxand*TbwP zbaHqk8=Hug<~&9n=cAI`S;^RG;x|?QGFd~naeKOtIAZv4B%Chc7W%eLI!kL-LDt=^j#ek@=Q`sPu-cpgtZcihxLhZj z59NBeNxF-F(pjS>P0P2^*Pq3>gTB3EeI1`6q`3*U2ax@U@rp#V_)gRN5oDt&rte{p z^t{QmR@Q(1mxIj2T~Di{^(*qnq&3_V6^1Xuaz>NC!vTLc0L}Rg**Tk81Y+kmb)rU%UyRho)d}O&()_um%ziRVs z8QG4eGTvc4Li9?~r4mj@!a;(3ni%&8o;RN(zT0G%L0V@q`9-mvEauz({%u;;-Szjf z9jrdJo1KYOt+!&?PWJKtwhx*|9It`#4%u#*7E5|HvVjPuTL(y{VEZ7ih3&JfcjdZt ze;57Rv3^v)d{6g|Wjoot&@!}tUA~uRhac7XyFB{M5lcD~PgOjGM7yR>pU(6Z*#<{C zVTrb}ewA$!^gjM$^Z&cK{hM-n7lVkNE~WS?ovF{f9$o|A0Y3XA8}Zp<``&-#{QR4_ z{oA^9H_FrbX-)6NoYvz`v>=S~R+Bw{7v0?>l*e}2{|*0O2S`Q>VCx8GDl6yzgEl2q z$Xa}lZDgdmreE`rzFRE@E9LjA{5yD*|Al^9kK-c#T_K7K`DcM>JQ}BJ={QrB{x+t1 zlJ!O%Q+p{b#iY^xM=@F1sa{X^aG={zmG?;^!s>!5li2pQn^2Sg;0!{{v2yy zzSN%#3n~5rnpo6O8GoTz{X2O``RvPunW~t6I7~{@zZ|!q<>(UhB+!ta=##~&l=#nw zGSsCOL3sk^>DV5?d;$9nseOkyt+wCOTatWxDEeXG{@C87O~5u=?vH_I&oTE?N%hSA zvu%T1XnwUOm`*U0z@5O8f&6Pc2;2!=38oQDC2$}=3On+-`Hk9^C1_5-w)4dVvE*m5 zlzc@(D7L3G>y=v(v?lmnmF7H7wUxA=H!4mRk!pfB^OMXGbry=uq#A_Cki^Di7?@Q2!pa+2wfuS16 z7Cz(P!Gn^niv4HUcFJ~erXlPP!9FuY4<-E-+j7_*#(Bh-q);FHKBV_U{yp1SUSj@> zWenz#3FjfnB`2s(8v>?v?Fe`uS`x4gu?hXcVK@3cs+R!)0qF1VF9CfMToMy+ik#+{ z?aUk#uknTCHFs*yf!}#qT7OycA<8BG5Lt#Jo3JFak^J_N%K0p?9j+z;?-!p3J_o#i zWrJLi4pvDmiDw3~f4RDLFs4*~lUurCM6rV~mv|LT$6d3~Bg8tJ$0 zO`16I%W1N;Zrq%N$QANIE{LTnV{uxMaZ^-sh)?4z}?6;uuwUEYD`z-LB_?(h# zWBh09ub#Mnz89^bdM)=Jlbvo~CVlB++SjBlo6*5}>Paf&bHH_Y@1;QRvKsjZN%n8H z8>{aD+Y5PL*tX33z;U;@05vCyyjQ z3%37z1O~n-quXQ-)n#7-39FI)xh(T~^j)oV{#j4UYi3@G$L4jjzW|>J_QNVQruvcB z-9*Er|BjeDPjUJyMC03Uuu=X8)STpmLGyy~)5nj}x#BqlFItF|472zqy|?6}L$*h}LT8iC)(iEZrQ+I9vGRnF+$%V{5OK)fqu6EFVQhBi zBinDV=2Q<%SRIF?(UtmQ{1Hy;HSXV+ah4>9DMEukex~)4{TN@oe1-QPKE|8*1$gD! zO+0t$3Z2Vr%sX)iU8lR8DK#!X@>!}=wnzV@ou3iMZB0Xq^99)L$axyS2(=^P5QdGz zZtJ(<-ksZ!{Pd(dwrOJ`4tMhT2xZDMK7x=ro=

S%^2%S0dX_&nAUpW~>{ggxg_) zmnp`OZf^go0Ccdk*~<052~~OqM_dm(dj%a%Uc^B(haTtdVYB@A2u3CdbE6Tw=Apxq zSj?k4ee1?m^bS&BStDn%A3D6OXE?HA(CnEv?;ME3{H%>+`%J|%>*TmU!V0$sSkU-` zafw4$JhUMSttVMVe={~GHAcj)y&rz4}Tb#(L89AB+!XOIH_!U%iW-&%faK2k)_G!Fy?ZjlM$=+8fdyETHkDaEzY<%NV<3 z6_1NZ-wv?K^0ETc#o3 z1=B?By>Jc{OV*%9&pB9i z)=jKnw+9UeTT0vy;{djw72Lgt*Kgd!iWtV8|9I`2$yo<1O6V6z<4zHd)gJ;j2LXCdbITZ$nlP&Ky z{xX656SgHub70#M-xKzuVVc14=g(izW!m(M-wmwF7#+FjM(jI8k7u87EZMgD6uiTM zd3Uh?@ypov@Hy;2pmXFZ+f#7-ffJZ};yBhCG08= z57Ke+SS-J?PMLI>l1$6~!K`cGGD#oUsUz0W|J_O5Pr#riEw_3OApN~Ro=aJVM`IlE z@FIKMH+Lwe&KZOoY5b^Rjea`5;pp*~+mc^0%g?-C(*L5DmzTr~v95-7lFSpb9-GTq zm#WvOk%xNxC{w*UD{MMqPP{vw-xY($mQ2ATG32`vJRJ82491o8ZfO0?NB%HWZ{G5f zG3`6sjCh~PA5h{&Nmn851?xjup648eG z(@@UP;f#*+anzc6619vbpZaM;>X#JK{CS! z;te-ap8k*e_%@GpgtBs79B)+hx{TU`LQueZ{+w-0@M ze58F~-7@O}X>Y7c8vV_KtlJD7t!~o_>f8T;WxM>n-kaXP7u|s`e8$+m&OA8#4Y2IM zzP7=^!TcVq{$|*(inUEG>tU8$Oe~A5?Dr zqjvwd^GGhMLU>4z_K4-<|8^i<0V!0z4gtgq6*kP&DALHJKQ@r5kq`{o+ORq{1ZR;YoY^tTYs(%(NoBp$m3l>U8lT}qK6g*6HP z{ZNj&;GS4UWd4}tMz#FNY0hW8g*q?~+=!qx0n0aS2-wHB4gvd_)+gY*!_Qo=34Lo3 zN_Nw8gd_3@Kb#}{be`ZG(TqHTT!I`b%b|BRm+G_p%5pr?Z?5t;KWt0l?@hK-9?SGS z2^g2MT+cMJBjMUJ>_?;KAy}?b%ku1V%W^!+^@I~yCS#dUhrWxN%D9W~4xQ0r#$h@- zI<8dKN(HRzXiQL_>?&^byA8$sjT7rH_*)M8%?8Pron#ro@(k&2ztB9UQvH%ZG$@*7 zbNXhum}y~WL&FuSLY@QfX<33YoJYUm^pfYO@)_oDFeF)wWOd2^nZEzO#Pz-nbjD+x zotz#y*xQMH`_s|h$#D_YDd|^TpXOaaK1PziJjwROBwtJ47Ld<-G5hn={8QC+OT{c_ zb^`sjkxo$yU%Y=_hrTXSO-`hX$8am!7Ebf|dy7;%P2L+f<5^LgOi|L1*MB1J`#X&JK zSYNlnByQ*DJ9{6wkzwKMx8mXBr^UDO?}|%TuZvTs&lI0Hl0h_W(%4e{m#@&-IC|xy zLL77O6q;n_3f&8j*%uP)gv5x9J-a3S!tU)`u+6Zk4>c;(s491zy7~5=X!4caj2E^? ziUW(BaI?P!F0tz*HZGV&bkpW5e$UWpdh)#Uw{Yyilh}`ZpBfy9MHFq=O@X3XPcp*7Vq|Kj*Nxs8z`4nTZeo+wl4O{d5ED60s zqBn-#e1J~RK4bp}pG1Sbr`Z=0A#8=vmIvYhrywjlO!@AG-T*dP$HZ-3nUOj(=3g}``FD`d4eR}ag6AFkwtrK_g7uM)-=O156#X82EbejszUXlBhG>5DN-<K~I{HQn!qyBliZb4te&D0aWE9U%&TR_7oJ8N^Bhiz@!C=$k4O0xc|IS>ebg0s_<*MGqW3v1} zI!;liP90=BIQ!nvU6*7F=Br5$TEeF-7~ZIB^oS;Fd`1}yf7_90JE+@R`GA&#O82XN zuG^$(`~c$Lm}ewDMfx_7_l0;l!S-sR4X=rJ9ipyZI@a#$(5vhO^3S&4k1``i^U`JN z=a#MXe`B0a^DQQRsF>_yk}nbQrp3gkKPSA+H14ONT-T{XbgYxfhj;0_a>g^527ec5 zKjyN%ka>O9DKZ~Qzcndl&z{XPVeWSgzRA$)>TF)qViDQKT^X1EFc57VM!fz3+M|!W z@ANxTlFpL&&b%Ks_-|wquU41dhY{`lFxszv|CO$=kc?cVLVhs+-4PA?yCWL(cSkhn zZ|o6}8ZT3VZ~g`e8OSpEZ<8=+$>=Z8gwo$2$)dkMau*64BK`H5Z~y*?t~63lrnY|{ zn9pLG&#}aVklmyc*%G=F^dc}J=t|Imem{(L##IUSl6@tYc%Or0J8+;h(+C5Cj#O_L z>xfxrs`^$((&4inpZ>hkZK}iLwB`HGHgS>z-c$Nl0@lNF|Fy{{;52`W#k$`_`W~3| z%^VXi=1JvJAV0WX9X#JnP@t?!z{KH2RK=?ltq69GbZtKK*vYjpwMf zI1v}c$KyTX-* z{RD?SD@OWeMrvkalI3V`_R@qNraeu(t7r%^F~{t|Wjw$r_) z_}zGb!$`N^`pPq`lXDlVZ_mP`#AB81X}?A0kcFw4$E7~_pSuqpv(A{$hZNclALSH$ z;RcQ&JCRwR-Z+Bj%h=H*FE3h-6%G2dtk8XiVw1-}TcK{TF>UWxKYP`$L-WP}TGATKCTvlIC?{}6VS=Ye0 zlyw_~H*XU^UYpBHhq6N=cgn{7@dz6CQ=c8Fm}F94)(NqGh`%EzKAv?$%;SF-Dh&yW zE!WzDWuLDC+03dD&K^Oy(2MYDG}->X8~>{Ylqf8fkre>+H-`vlW +#include "resource.h" + +/* define language neutral resources */ + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +/* include localised resources */ +#include "lang/en-US.rc" +#include "lang/id-ID.rc" +#include "lang/it-IT.rc" +#include "lang/nb-NO.rc" +#include "lang/th-TH.rc" + diff --git a/rosapps/imagesoft/tooldock.c b/rosapps/imagesoft/tooldock.c new file mode 100644 index 00000000000..84c513b27a4 --- /dev/null +++ b/rosapps/imagesoft/tooldock.c @@ -0,0 +1,1138 @@ +#include + +static const TCHAR szToolDockWndClass[] = TEXT("ImageSoftToolDockWndClass"); + +typedef struct _TOOLDOCKWND_INIT +{ + PTOOLBAR_DOCKS TbDocks; + PDOCKBAR_ITEM Item; +} TOOLDOCKWND_INIT, *PTOOLDOCKWND_INIT; + +static UINT +TbdCalculateInsertIndex(PTOOLBAR_DOCKS TbDocks, + DOCK_POSITION Position, + POINT pt) +{ + RECT rcRebar; + UINT Ret = 0; + + GetWindowRect(TbDocks->hRebar[Position], + &rcRebar); + + switch (Position) + { + case TOP_DOCK: + case BOTTOM_DOCK: + if (pt.y > rcRebar.top + ((rcRebar.bottom - rcRebar.top) / 2)) + Ret = (UINT)-1; + break; + + case LEFT_DOCK: + case RIGHT_DOCK: + if (pt.x > rcRebar.left + ((rcRebar.right - rcRebar.left) / 2)) + Ret = (UINT)-1; + break; + + default: + break; + } + + return Ret; +} + +INT +TbdAdjustUpdateClientRect(PTOOLBAR_DOCKS TbDocks, + PRECT rcClient) +{ + INT i, DocksVisible = 0; + + for (i = 0; i < DOCKS_COUNT; i++) + { + if (TbDocks->hRebar[i] != NULL) + { + DocksVisible++; + } + } + + if (DocksVisible != 0) + { + rcClient->top += TbDocks->rcRebar[TOP_DOCK].bottom; + rcClient->left += TbDocks->rcRebar[LEFT_DOCK].right; + rcClient->right -= TbDocks->rcRebar[RIGHT_DOCK].right; + rcClient->bottom -= TbDocks->rcRebar[BOTTOM_DOCK].bottom; + } + + TbDocks->rcClient = *rcClient; + + return DocksVisible; +} + +HDWP +TbdDeferDocks(HDWP hWinPosInfo, + PTOOLBAR_DOCKS TbDocks) +{ + LONG cx, cy; + HDWP hRet = hWinPosInfo; + + cx = TbDocks->rcClient.right - TbDocks->rcClient.left; + cy = TbDocks->rcClient.bottom - TbDocks->rcClient.top; + + /* Top dock */ + if (TbDocks->hRebar[TOP_DOCK] != NULL) + { + hRet = DeferWindowPos(hRet, + TbDocks->hRebar[TOP_DOCK], + NULL, + TbDocks->rcClient.left - TbDocks->rcRebar[LEFT_DOCK].right, + TbDocks->rcClient.top - TbDocks->rcRebar[TOP_DOCK].bottom, + cx + TbDocks->rcRebar[LEFT_DOCK].right + TbDocks->rcRebar[RIGHT_DOCK].right, + TbDocks->rcRebar[TOP_DOCK].bottom, + SWP_NOZORDER); + if (hRet == NULL) + return NULL; + } + + /* Left dock */ + if (TbDocks->hRebar[LEFT_DOCK] != NULL) + { + hRet = DeferWindowPos(hRet, + TbDocks->hRebar[LEFT_DOCK], + NULL, + TbDocks->rcClient.left - TbDocks->rcRebar[LEFT_DOCK].right, + TbDocks->rcClient.top, + TbDocks->rcRebar[LEFT_DOCK].right, + cy, + SWP_NOZORDER); + if (hRet == NULL) + return NULL; + } + + /* Right dock */ + if (TbDocks->hRebar[RIGHT_DOCK] != NULL) + { + hRet = DeferWindowPos(hRet, + TbDocks->hRebar[RIGHT_DOCK], + NULL, + TbDocks->rcClient.right, + TbDocks->rcClient.top, + TbDocks->rcRebar[RIGHT_DOCK].right, + cy, + SWP_NOZORDER); + if (hRet == NULL) + return NULL; + } + + /* Bottom dock */ + if (TbDocks->hRebar[BOTTOM_DOCK] != NULL) + { + hRet = DeferWindowPos(hRet, + TbDocks->hRebar[BOTTOM_DOCK], + NULL, + TbDocks->rcClient.left - TbDocks->rcRebar[LEFT_DOCK].right, + TbDocks->rcClient.bottom, + cx + TbDocks->rcRebar[LEFT_DOCK].right + TbDocks->rcRebar[RIGHT_DOCK].right, + TbDocks->rcRebar[BOTTOM_DOCK].bottom, + SWP_NOZORDER); + if (hRet == NULL) + return NULL; + } + + return hRet; +} + +static PDOCKBAR_ITEM +TbnDockbarItemFromBandId(PTOOLBAR_DOCKS TbDocks, + DOCK_POSITION Position, + UINT uBand) +{ + REBARBANDINFO rbi = {0}; + + rbi.cbSize = sizeof(rbi); + rbi.fMask = RBBIM_LPARAM; + + if (SendMessage(TbDocks->hRebar[Position], + RB_GETBANDINFO, + (WPARAM)uBand, + (LPARAM)&rbi)) + { + return (PDOCKBAR_ITEM)rbi.lParam; + } + + return NULL; +} + +static VOID +TbnRebarChangeSize(PTOOLBAR_DOCKS TbDocks, + DOCK_POSITION Position) +{ + LONG cRebar; + + TbDocks->rcRebar[Position].left = 0; + TbDocks->rcRebar[Position].top = 0; + + cRebar = (LONG)SendMessage(TbDocks->hRebar[Position], + RB_GETBARHEIGHT, + 0, + 0); + + switch (Position) + { + case TOP_DOCK: + case BOTTOM_DOCK: + TbDocks->rcRebar[Position].bottom = cRebar; + break; + + case LEFT_DOCK: + case RIGHT_DOCK: + TbDocks->rcRebar[Position].right = cRebar; + break; + + default: + break; + } + + if (TbDocks->ParentResize != NULL) + { + RECT rcClient = {0}; + + GetClientRect(TbDocks->hParent, + &rcClient); + + TbDocks->ParentResize(TbDocks->Context, + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top); + } +} + +static VOID +TbnRebarChevronPushed(PTOOLBAR_DOCKS TbDocks, + DOCK_POSITION Position, + LPNMREBARCHEVRON lpnm) +{ + PDOCKBAR_ITEM Item; + + Item = TbnDockbarItemFromBandId(TbDocks, + Position, + lpnm->uBand); + + if (Item != NULL && Item->Callbacks->ChevronPushed) + { + Item->Callbacks->ChevronPushed(TbDocks, + &Item->DockBar, + Item->Context, + Item->hWndClient, + lpnm); + } +} + +static LRESULT +TbnRebarBeginDrag(PTOOLBAR_DOCKS TbDocks, + DOCK_POSITION Position, + LPNMREBAR lpnmrb) +{ + PDOCKBAR_ITEM Item; + + Item = TbnDockbarItemFromBandId(TbDocks, + Position, + lpnmrb->uBand); + + if (Item != NULL) + { + TbDocks->Dragging = Item; + TbDocks->DraggingBandId = lpnmrb->wID; + return FALSE; + } + + return TRUE; +} + +static VOID +TbnRebarEndDrag(PTOOLBAR_DOCKS TbDocks, + DOCK_POSITION Position, + LPNMREBAR lpnmrb) +{ + PDOCKBAR_ITEM Item; + + Item = TbnDockbarItemFromBandId(TbDocks, + Position, + lpnmrb->uBand); + + if (Item != NULL) + { + /* Nothing to do */ + } +} + +BOOL +TbdDockBarIdFromClientWindow(PTOOLBAR_DOCKS TbDocks, + HWND hWndClient, + UINT *Id) +{ + PDOCKBAR_ITEM Item; + BOOL Ret = FALSE; + + Item = TbDocks->Items; + while (Item != NULL) + { + if (Item->hWndClient == hWndClient) + { + *Id = Item->DockBar.BarId; + Ret = TRUE; + break; + } + + Item = Item->Next; + } + + return Ret; +} + +BOOL +TbdHandleNotifications(PTOOLBAR_DOCKS TbDocks, + LPNMHDR pnmh, + LRESULT *Result) +{ + BOOL Handled = FALSE; + + if (pnmh->hwndFrom != NULL) + { + DOCK_POSITION Position; + + for (Position = TOP_DOCK; Position < NO_DOCK; Position++) + { + if (pnmh->hwndFrom == TbDocks->hRebar[Position]) + { + switch (pnmh->code) + { + case RBN_HEIGHTCHANGE: + { + TbnRebarChangeSize(TbDocks, + Position); + break; + } + + case RBN_BEGINDRAG: + { + *Result = TbnRebarBeginDrag(TbDocks, + Position, + (LPNMREBAR)pnmh); + break; + } + + case RBN_ENDDRAG: + { + TbnRebarEndDrag(TbDocks, + Position, + (LPNMREBAR)pnmh); + break; + } + + case RBN_CHEVRONPUSHED: + { + TbnRebarChevronPushed(TbDocks, + Position, + (LPNMREBARCHEVRON)pnmh); + break; + } + } + + Handled = TRUE; + break; + } + } + } + + return Handled; +} + +static BOOL +TbdCreateToolbarWnd(PTOOLBAR_DOCKS TbDocks, + PDOCKBAR_ITEM Item, + DOCK_POSITION PrevPosition, + UINT PrevBandIndex, + LPREBARBANDINFO rbi, + POINT pt, + HWND hRebar, + UINT uBand, + BOOL Drag) +{ + LPCTSTR lpCaption = NULL; + TOOLDOCKWND_INIT Init; + HWND hToolbar; + + Init.TbDocks = TbDocks; + Init.Item = Item; + + if (rbi->fMask & RBBIM_TEXT) + { + lpCaption = rbi->lpText; + } + + Item->Callbacks->DockBand(TbDocks, + &Item->DockBar, + Item->Context, + PrevPosition, + NO_DOCK, + rbi); + + if (rbi->fMask & RBBIM_CHILD) + Item->hWndClient = rbi->hwndChild; + else + Item->hWndClient = NULL; + + + if ((rbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) == (RBBIM_CHILDSIZE | RBBIM_SIZE)) + { + RECT rcWnd; + static const DWORD dwStyle = WS_POPUPWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DLGFRAME; + static const DWORD dwExStyle = WS_EX_TOOLWINDOW; + + rcWnd.left = pt.x - GetSystemMetrics(SM_CXFIXEDFRAME) - (GetSystemMetrics(SM_CYSMCAPTION) / 2); + rcWnd.top = pt.y + GetSystemMetrics(SM_CYFIXEDFRAME) + (GetSystemMetrics(SM_CYSMCAPTION) / 2); + rcWnd.right = rcWnd.left + rbi->cx; + rcWnd.bottom = rcWnd.top + rbi->cyMinChild; + + if (AdjustWindowRectEx(&rcWnd, + dwStyle, + FALSE, + dwExStyle)) + { + hToolbar = CreateWindowEx(dwExStyle, + szToolDockWndClass, + lpCaption, + dwStyle, + rcWnd.left, + rcWnd.top, + rcWnd.right - rcWnd.left, + rcWnd.bottom - rcWnd.top, + TbDocks->hParent, + NULL, + hInstance, + &Init); + if (hToolbar != NULL) + { + RECT rcClient; + + if (uBand != (UINT)-1) + { + /* delete the band before showing the client window, + otherwise deleting the band will cause the client + window to be hidden, regardless of whether the band + was hidden before being deleted or not */ + SendMessage(hRebar, + RB_DELETEBAND, + (WPARAM)uBand, + 0); + } + + if (Item->hWndClient != NULL) + { + GetClientRect(hToolbar, + &rcClient); + + SetParent(Item->hWndClient, + hToolbar); + + SetWindowPos(Item->hWndClient, + NULL, + 0, + 0, + rcClient.right, + rcClient.bottom, + SWP_NOZORDER); + + SetWindowPos(Item->hWndClient, + HWND_TOP, + 0, + 0, + 0, + 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + } + + SetWindowPos(hToolbar, + HWND_TOP, + 0, + 0, + 0, + 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + + if (Drag) + { + SetCursor(LoadCursor(NULL, IDC_ARROW)); + SendMessage(hToolbar, + WM_NCLBUTTONDOWN, + HTCAPTION, + MAKELPARAM(pt.x, + pt.y)); + } + + return TRUE; + } + } + } + + return FALSE; +} + +static BOOL +TdbInsertToolbar(PTOOLBAR_DOCKS TbDocks, + PDOCKBAR_ITEM Item, + DOCK_POSITION Position) +{ + LPTSTR lpCaption = NULL; + REBARBANDINFO rbi = {0}; + BOOL Ret = FALSE; + + rbi.cbSize = sizeof(rbi); + rbi.fMask = RBBIM_ID | RBBIM_STYLE | RBBIM_LPARAM; + rbi.wID = Item->DockBar.BarId; + rbi.fStyle = RBBS_GRIPPERALWAYS; + rbi.lParam = (LPARAM)Item; + + if (Item->DockBar.DisplayTextId != 0) + { + if (AllocAndLoadString(&lpCaption, + hInstance, + Item->DockBar.DisplayTextId)) + { + rbi.fMask |= RBBIM_TEXT; + rbi.lpText = lpCaption; + } + } + + if (Item->hWndClient != NULL) + { + rbi.fMask |= RBBIM_CHILD; + rbi.hwndChild = Item->hWndClient; + } + + switch (Item->DockBar.Position) + { + case NO_DOCK: + { + POINT pt = {0}; + + /* FIXME - calculate size */ + Ret = TbdCreateToolbarWnd(TbDocks, + Item, + Item->DockBar.Position, + (UINT)-1, + &rbi, + pt, + NULL, + (UINT)-1, + FALSE); + break; + } + + default: + { + UINT Index = -1; + BOOL AddBand = TRUE; + + if (Item->Callbacks->InsertBand != NULL) + { + AddBand = Item->Callbacks->InsertBand(TbDocks, + &Item->DockBar, + Item->Context, + &Index, + &rbi); + } + + if (AddBand) + { + Item->Callbacks->DockBand(TbDocks, + &Item->DockBar, + Item->Context, + NO_DOCK, + Item->DockBar.Position, + &rbi); + + if (rbi.fMask & RBBIM_CHILD) + Item->hWndClient = rbi.hwndChild; + else + Item->hWndClient = NULL; + + Ret = SendMessage(TbDocks->hRebar[Position], + RB_INSERTBAND, + (WPARAM)Index, + (LPARAM)&rbi) != 0; + if (Ret) + { + Item->PrevDock = Position; + Item->PrevBandIndex = (UINT)SendMessage(TbDocks->hRebar[Position], + RB_IDTOINDEX, + (WPARAM)Item->DockBar.BarId, + 0); + } + } + + break; + } + } + + if (lpCaption != NULL) + { + LocalFree((HLOCAL)lpCaption); + } + + return Ret; +} + +BOOL +TbdAddToolbar(PTOOLBAR_DOCKS TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + const DOCKBAR_ITEM_CALLBACKS *Callbacks) +{ + PDOCKBAR_ITEM Item; + HWND hRebar; + + hRebar = TbDocks->hRebar[Dockbar->Position]; + if (hRebar != NULL) + { + Item = HeapAlloc(ProcessHeap, + 0, + sizeof(DOCKBAR_ITEM)); + if (Item != NULL) + { + /* Initialize the item */ + Item->DockBar = *Dockbar; + Item->Context = Context; + Item->hWndTool = NULL; + Item->PrevDock = Dockbar->Position; + + Item->Callbacks = Callbacks; + + /* Create the client control */ + if (Callbacks->CreateClient != NULL && + !Callbacks->CreateClient(TbDocks, + &Item->DockBar, + Context, + hRebar, + &Item->hWndClient)) + { + HeapFree(ProcessHeap, + 0, + Item); + + return FALSE; + } + + /* Insert the item into the list */ + Item->Next = TbDocks->Items; + TbDocks->Items = Item; + + return TdbInsertToolbar(TbDocks, + Item, + Dockbar->Position); + } + } + + return FALSE; +} + +#define GWLP_TBDOCKS 0 +#define GWLP_DOCKITEM (GWLP_TBDOCKS + sizeof(PTOOLBAR_DOCKS)) +#define TD_EXTRA_BYTES (GWLP_DOCKITEM + sizeof(PDOCKBAR_ITEM)) + +static LRESULT CALLBACK +ToolDockWndProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PTOOLBAR_DOCKS TbDocks; + PDOCKBAR_ITEM Item; + LRESULT Ret = 0; + + /* Get the window context */ + TbDocks = (PTOOLBAR_DOCKS)GetWindowLongPtr(hwnd, + GWLP_TBDOCKS); + Item = (PDOCKBAR_ITEM)GetWindowLongPtr(hwnd, + GWLP_DOCKITEM); + + if ((TbDocks == NULL || Item == NULL) && uMsg != WM_CREATE) + { + goto HandleDefaultMessage; + } + + switch (uMsg) + { + case WM_NCACTIVATE: + { + TbdHandleActivation(TbDocks, + hwnd, + &wParam, + &lParam); + goto HandleDefaultMessage; + } + + case WM_CREATE: + { + TbDocks = ((PTOOLDOCKWND_INIT)(((LPCREATESTRUCT)lParam)->lpCreateParams))->TbDocks; + Item = ((PTOOLDOCKWND_INIT)(((LPCREATESTRUCT)lParam)->lpCreateParams))->Item; + Item->hWndTool = hwnd; + + SetWindowLongPtr(hwnd, + GWLP_TBDOCKS, + (LONG_PTR)TbDocks); + SetWindowLongPtr(hwnd, + GWLP_DOCKITEM, + (LONG_PTR)Item); + + Ret = TRUE; + break; + } + + case WM_DESTROY: + { + Item->hWndTool = NULL; + + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + 0); + SetWindowLongPtr(hwnd, + GWLP_DOCKITEM, + 0); + break; + } + + default: + { +HandleDefaultMessage: + Ret = DefWindowProc(hwnd, + uMsg, + wParam, + lParam); + break; + } + } + + return Ret; +} + +static LRESULT CALLBACK +RebarSubclassProc(HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData) +{ + LRESULT Ret; + + Ret = DefSubclassProc(hWnd, + uMsg, + wParam, + lParam); + + if (uMsg == WM_MOUSEMOVE && (wParam & MK_LBUTTON)) + { + DOCK_POSITION Position, DragTo = NO_DOCK; + RECT rcClient; + POINT pt; + PTOOLBAR_DOCKS TbDocks = (PTOOLBAR_DOCKS)dwRefData; + SIZE szTearOff; + + szTearOff.cx = GetSystemMetrics(SM_CXCURSOR); + szTearOff.cy = GetSystemMetrics(SM_CYCURSOR); + + /* + * Check if we're dragging and if it's time to remove the band + */ + if (TbDocks->Dragging != NULL && GetCapture() == hWnd) + { + GetClientRect(hWnd, + &rcClient); + InflateRect(&rcClient, + szTearOff.cx, + szTearOff.cy); + + pt.x = GET_X_LPARAM(lParam); + pt.y = GET_Y_LPARAM(lParam); + + if (!PtInRect(&rcClient, + pt)) + { + REBARBANDINFO rbi; + UINT uBand; + RECT rc; + + /* Save all rebar band information, don't query RBBIM_HEADERSIZE because it + seems to cause problems with toolbars*/ + rbi.cbSize = sizeof(rbi); + rbi.fMask = RBBIM_BACKGROUND | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_COLORS | + RBBIM_IDEALSIZE | RBBIM_ID | RBBIM_IMAGE | RBBIM_LPARAM | RBBIM_SIZE | + RBBIM_STYLE | RBBIM_TEXT; + rbi.lpText = TbDocks->szTempText; + rbi.cch = sizeof(TbDocks->szTempText); + + uBand = (UINT)SendMessage(hWnd, + RB_IDTOINDEX, + (WPARAM)TbDocks->DraggingBandId, + 0); + + if (uBand != (UINT)-1 && + SendMessage(hWnd, + RB_GETBANDINFO, + (WPARAM)uBand, + (LPARAM)&rbi)) + { + MapWindowPoints(hWnd, + HWND_DESKTOP, + &pt, + 1); + + /* Check if the user is trying to drag it into another dock */ + for (Position = TOP_DOCK; Position < NO_DOCK; Position++) + { + if (TbDocks->hRebar[Position] != NULL && + TbDocks->hRebar[Position] != hWnd && + GetWindowRect(TbDocks->hRebar[Position], + &rc)) + { + InflateRect(&rc, + szTearOff.cx, + szTearOff.cy); + + if (PtInRect(&rc, + pt)) + { + DragTo = Position; + break; + } + } + } + + /* Get the current dock */ + for (Position = TOP_DOCK; Position < NO_DOCK; Position++) + { + if (TbDocks->hRebar[Position] == hWnd) + { + break; + } + } + + ReleaseCapture(); + + if (SendMessage(hWnd, + RB_SHOWBAND, + (WPARAM)uBand, + FALSE)) + { + /* Change the parent to the new rebar control */ + if (TbDocks->Dragging->hWndClient != NULL) + { + SetWindowPos(TbDocks->Dragging->hWndClient, + NULL, + 0, + 0, + 0, + 0, + SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER); + + SetParent(TbDocks->Dragging->hWndClient, + TbDocks->hRebar[DragTo]); + + SetWindowPos(TbDocks->Dragging->hWndClient, + NULL, + 0, + 0, + 0, + 0, + SWP_NOSIZE | SWP_NOZORDER); + } + + if (DragTo == NO_DOCK) + { + if (!TbdCreateToolbarWnd(TbDocks, + TbDocks->Dragging, + Position, + uBand, + &rbi, + pt, + hWnd, + uBand, + TRUE)) + { + goto MoveFailed; + } + } + else + { + BOOL Moved = FALSE; + + /* Remove the band from the current rebar control */ + if (SendMessage(hWnd, + RB_DELETEBAND, + (WPARAM)uBand, + 0)) + { + UINT uIndex; + + /* Calculate where to insert the new bar */ + uIndex = TbdCalculateInsertIndex(TbDocks, + DragTo, + pt); + + SetActiveWindow(TbDocks->hRebar[DragTo]); + + TbDocks->Dragging->Callbacks->DockBand(TbDocks, + &TbDocks->Dragging->DockBar, + TbDocks->Dragging->Context, + Position, + DragTo, + &rbi); + + if (rbi.fMask & RBBIM_CHILD) + TbDocks->Dragging->hWndClient = rbi.hwndChild; + else + TbDocks->Dragging->hWndClient = NULL; + + /* Insert the toolbar into the new rebar */ + rbi.fMask |= RBBIM_STYLE; + rbi.fStyle |= RBBS_HIDDEN; + if (SendMessage(TbDocks->hRebar[DragTo], + RB_INSERTBAND, + (WPARAM)uIndex, + (LPARAM)&rbi)) + { + uBand = (UINT)SendMessage(TbDocks->hRebar[DragTo], + RB_IDTOINDEX, + (WPARAM)TbDocks->DraggingBandId, + 0); + + SendMessage(TbDocks->hRebar[DragTo], + RB_SHOWBAND, + (WPARAM)uBand, + TRUE); + + /* Simulate a mouse click to continue dragging */ + if (uBand != (UINT)-1 && + TbDocks->Dragging->hWndClient != NULL && + GetWindowRect(TbDocks->Dragging->hWndClient, + &rc)) + { + switch (DragTo) + { + case LEFT_DOCK: + case RIGHT_DOCK: + pt.x = rc.left + ((rc.right - rc.left) / 2); + pt.y = rc.top - 1; + break; + + default: + pt.x = rc.left - 1; + pt.y = rc.top + ((rc.bottom - rc.top) / 2); + break; + } + + MapWindowPoints(HWND_DESKTOP, + TbDocks->hRebar[DragTo], + &pt, + 1); + + SetCursor(LoadCursor(NULL, IDC_SIZEALL)); + + SendMessage(TbDocks->hRebar[DragTo], + WM_LBUTTONDOWN, + wParam, + MAKELPARAM(pt.x, + pt.y)); + + Moved = TRUE; + } + } + } + + if (!Moved) + { +MoveFailed: + TbDocks->Dragging = NULL; + + SendMessage(hWnd, + RB_SHOWBAND, + (WPARAM)uBand, + TRUE); + } + } + } + } + } + } + } + + return Ret; +} + +VOID +TbdHandleEnabling(PTOOLBAR_DOCKS TbDocks, + HWND hWnd, + BOOL Enable) +{ + PDOCKBAR_ITEM Item; + + Item = TbDocks->Items; + while (Item != NULL) + { + if (Item->hWndTool != NULL && + Item->hWndTool != hWnd) + { + EnableWindow(Item->hWndTool, + Enable); + } + Item = Item->Next; + } +} + +VOID +TbdHandleActivation(PTOOLBAR_DOCKS TbDocks, + HWND hWnd, + WPARAM *wParam, + LPARAM *lParam) +{ + BOOL SynchronizeSiblings = TRUE; + BOOL KeepActive = *(BOOL*)wParam; + HWND hWndActivate = *(HWND*)lParam; + PDOCKBAR_ITEM Item; + + Item = TbDocks->Items; + while (Item != NULL) + { + if (Item->hWndTool != NULL && + Item->hWndTool == hWndActivate) + { + KeepActive = TRUE; + SynchronizeSiblings = FALSE; + break; + } + Item = Item->Next; + } + + if (hWndActivate != (HWND)-1) + { + if (SynchronizeSiblings) + { + Item = TbDocks->Items; + while (Item != NULL) + { + if (Item->hWndTool != NULL && + Item->hWndTool != hWnd && + Item->hWndTool != hWndActivate) + { + SendMessage(Item->hWndTool, + WM_NCACTIVATE, + (WPARAM)KeepActive, + (LPARAM)-1); + } + Item = Item->Next; + } + } + } + else + *lParam = 0; + + *wParam = (WPARAM)KeepActive; +} + +VOID +TbdShowFloatingToolbars(PTOOLBAR_DOCKS TbDocks, + BOOL Show) +{ + PDOCKBAR_ITEM Item; + + Item = TbDocks->Items; + while (Item != NULL) + { + if (Item->hWndTool != NULL) + { + if ((Show && !IsWindowVisible(Item->hWndTool)) || + (!Show && IsWindowVisible(Item->hWndTool))) + { + ShowWindow(Item->hWndTool, + (Show ? SW_SHOW : SW_HIDE)); + } + } + Item = Item->Next; + } +} + +VOID +TbdInitializeDocks(PTOOLBAR_DOCKS TbDocks, + HWND hWndParent, + PVOID Context, + PDOCKBAR_PARENTRESIZE ParentResizeProc) +{ + DWORD rbStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | + CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NOMOVEY | CCS_NOMOVEX | + RBS_VARHEIGHT | RBS_AUTOSIZE; + + DOCK_POSITION Position; + + TbDocks->hParent = hWndParent; + TbDocks->Context = Context; + TbDocks->ParentResize = ParentResizeProc; + + for (Position = TOP_DOCK; Position < NO_DOCK; Position++) + { + switch (Position) + { + case LEFT_DOCK: + case RIGHT_DOCK: + rbStyle |= CCS_VERT; + break; + default: + rbStyle &= ~CCS_VERT; + break; + } + + TbDocks->hRebar[Position] = CreateWindowEx(WS_EX_TOOLWINDOW, + REBARCLASSNAME, + NULL, + rbStyle, + 0, + 0, + 0, + 0, + TbDocks->hParent, + NULL, + hInstance, + NULL); + + if (TbDocks->hRebar[Position] != NULL) + { + SetWindowSubclass(TbDocks->hRebar[Position], + RebarSubclassProc, + 1, + (DWORD_PTR)TbDocks); + } + } +} + +BOOL +TbdInitImpl(VOID) +{ + WNDCLASSEX wc = {0}; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = ToolDockWndProc; + wc.cbWndExtra = TD_EXTRA_BYTES; + wc.hInstance = hInstance; + wc.hCursor = LoadCursor(NULL, + IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszClassName = szToolDockWndClass; + + return RegisterClassEx(&wc) != (ATOM)0; +} + +VOID +TbdUninitImpl(VOID) +{ + UnregisterClass(szToolDockWndClass, + hInstance); +} diff --git a/rosapps/imagesoft/tooldock.h b/rosapps/imagesoft/tooldock.h new file mode 100644 index 00000000000..0d635157df8 --- /dev/null +++ b/rosapps/imagesoft/tooldock.h @@ -0,0 +1,115 @@ + +typedef enum +{ + TOP_DOCK = 0, + LEFT_DOCK, + RIGHT_DOCK, + BOTTOM_DOCK, + NO_DOCK +} DOCK_POSITION; + +typedef struct _DOCKBAR +{ + UINT BarId; + LPCTSTR lpName; + UINT DisplayTextId; + DOCK_POSITION Position; +} DOCKBAR, *PDOCKBAR; + +struct _TOOLBAR_DOCKS; + +typedef BOOL (CALLBACK *PDOCKBAR_CREATECLIENT)(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + HWND hParent, + HWND *hwnd); +typedef BOOL (CALLBACK *PDOCKBAR_DESTROYCLIENT)(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + HWND hwnd); +typedef BOOL (CALLBACK *PDOCKBAR_INSERTBAND)(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + UINT *Index, + LPREBARBANDINFO rbi); +typedef VOID (CALLBACK *PDOCKBAR_DOCKBAND)(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + DOCK_POSITION DockFrom, + DOCK_POSITION DockTo, + LPREBARBANDINFO rbi); +typedef VOID (CALLBACK *PDOCKBAR_CHEVRONPUSHED)(struct _TOOLBAR_DOCKS *TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + HWND hwndChild, + LPNMREBARCHEVRON lpnm); + +typedef struct _DOCKBAR_ITEM_CALLBACKS +{ + PDOCKBAR_CREATECLIENT CreateClient; + PDOCKBAR_DESTROYCLIENT DestroyClient; + PDOCKBAR_INSERTBAND InsertBand; + PDOCKBAR_DOCKBAND DockBand; + PDOCKBAR_CHEVRONPUSHED ChevronPushed; +} DOCKBAR_ITEM_CALLBACKS, *PDOCKBAR_ITEM_CALLBACKS; + +typedef struct _DOCKBAR_ITEM +{ + struct _DOCKBAR_ITEM *Next; + DOCKBAR DockBar; + PVOID Context; + HWND hWndTool; + HWND hWndClient; + DOCK_POSITION PrevDock; + UINT PrevBandIndex; + const DOCKBAR_ITEM_CALLBACKS *Callbacks; +} DOCKBAR_ITEM, *PDOCKBAR_ITEM; + +typedef VOID (CALLBACK *PDOCKBAR_PARENTRESIZE)(PVOID Context, + WORD cx, + WORD cy); + +#define DOCKS_COUNT 4 +typedef struct _TOOLBAR_DOCKS +{ + HWND hParent; + PVOID Context; + HWND hRebar[DOCKS_COUNT]; + RECT rcRebar[DOCKS_COUNT]; + RECT rcClient; + PDOCKBAR_ITEM Items; + PDOCKBAR_PARENTRESIZE ParentResize; + PDOCKBAR_ITEM Dragging; + UINT DraggingBandId; + TCHAR szTempText[255]; +} TOOLBAR_DOCKS, *PTOOLBAR_DOCKS; + +VOID TbdInitializeDocks(PTOOLBAR_DOCKS TbDocks, + HWND hWndParent, + PVOID Context, + PDOCKBAR_PARENTRESIZE ParentResizeProc); +INT TbdAdjustUpdateClientRect(PTOOLBAR_DOCKS TbDocks, + PRECT rcClient); +HDWP TbdDeferDocks(HDWP hWinPosInfo, + PTOOLBAR_DOCKS TbDocks); +BOOL TbdAddToolbar(PTOOLBAR_DOCKS TbDocks, + const DOCKBAR *Dockbar, + PVOID Context, + const DOCKBAR_ITEM_CALLBACKS *DockbarCallbacks); +BOOL TbdDockBarIdFromClientWindow(PTOOLBAR_DOCKS TbDocks, + HWND hWndClient, + UINT *Id); +BOOL TbdHandleNotifications(PTOOLBAR_DOCKS TbDocks, + LPNMHDR pnmh, + LRESULT *Result); +VOID TbdHandleEnabling(PTOOLBAR_DOCKS TbDocks, + HWND hWnd, + BOOL Enable); +VOID TbdHandleActivation(PTOOLBAR_DOCKS TbDocks, + HWND hWnd, + WPARAM *wParam, + LPARAM *lParam); +VOID TbdShowFloatingToolbars(PTOOLBAR_DOCKS TbDocks, + BOOL Show); +BOOL TbdInitImpl(VOID); +VOID TbdUninitImpl(VOID); diff --git a/rosapps/net/dhcpd/AUTHORS b/rosapps/net/dhcpd/AUTHORS new file mode 100644 index 00000000000..6102d1615e6 --- /dev/null +++ b/rosapps/net/dhcpd/AUTHORS @@ -0,0 +1,3 @@ +Carlos Duclos Vergara, +Pablo Bleyer Kocik, +Manuel Jander, diff --git a/rosapps/net/dhcpd/COPYING b/rosapps/net/dhcpd/COPYING new file mode 100644 index 00000000000..3f061137320 --- /dev/null +++ b/rosapps/net/dhcpd/COPYING @@ -0,0 +1,222 @@ + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/rosapps/net/dhcpd/ChangeLog b/rosapps/net/dhcpd/ChangeLog new file mode 100644 index 00000000000..5c1dd5ed88d --- /dev/null +++ b/rosapps/net/dhcpd/ChangeLog @@ -0,0 +1,18 @@ +2002020701: +- I rewrite completely the code to get an ip. +- I delete threads beacuse of some deadlocks. +- I add _finally_ support for static ip host. + +2002013002: +- After some web surf and some hack there is (i hope so!) a windows port, please BE CAREFULL because i have no way to test it. + +2002013001: +- After a lot of work, this is finally working and now is being ported to auto GNU tools. +- I will add the routines to compile it under MSW boxes with winsock. + +20020121: +- Well, we have a working version with configuration file and with reduced functionality. If you find bugs, please report them. This version is the last and i'm accepting patches for this version. +20020117: +- Finally there is an alpha release. From now i will start logging what i'm doing. +This alpha release was compiled in a SuSE Linux 7.2 box, i've tested it with my embedded device +and it works. I've tested with one MS Windows 98 workstations and it doesn't work. diff --git a/rosapps/net/dhcpd/INSTALL b/rosapps/net/dhcpd/INSTALL new file mode 100644 index 00000000000..f12c2e64949 --- /dev/null +++ b/rosapps/net/dhcpd/INSTALL @@ -0,0 +1,188 @@ +NOTE: +->*nix Systems: use the configure script and everything should work without problems. +->MSW: FIRST you need the mingw compiler (i think cygwin must work too, but you will have to modify the configure.in and change MINGW32 for CYGWIN) +Then, run configure and pray. If it finds everything it needs (the only thing missed may be the pthreads library) is ready to compile. + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/rosapps/net/dhcpd/Makefile.am b/rosapps/net/dhcpd/Makefile.am new file mode 100644 index 00000000000..af437a64d6d --- /dev/null +++ b/rosapps/net/dhcpd/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/rosapps/net/dhcpd/Makefile.in b/rosapps/net/dhcpd/Makefile.in new file mode 100644 index 00000000000..b3d2e5465b5 --- /dev/null +++ b/rosapps/net/dhcpd/Makefile.in @@ -0,0 +1,352 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SUBDIRS = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS TODO aclocal.m4 config.h.in config.h.top \ +configure configure.in install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) config.h.top + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile config.h +all-redirect: all-recursive-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/rosapps/net/dhcpd/NEWS b/rosapps/net/dhcpd/NEWS new file mode 100644 index 00000000000..fb68d6ca6f2 --- /dev/null +++ b/rosapps/net/dhcpd/NEWS @@ -0,0 +1,2 @@ +20020130: +Finally autoconf and company are working. Now i will work on windows port. diff --git a/rosapps/net/dhcpd/README b/rosapps/net/dhcpd/README new file mode 100644 index 00000000000..5ecb78ff7ed --- /dev/null +++ b/rosapps/net/dhcpd/README @@ -0,0 +1,19 @@ +Disclaimer: +This project is released under GPL, see COPYING to get an idea of what this means. + +Building: +To build this you need a C compiler (i used gcc 2.95-3), and some luck. +Just type make, i'm working on autoconf and automake but is not finished yet. + +Running: +For some reason in some circumstances you have to add the following to your route table: +route add -host 255.255.255.255 dev eth0 +That is needed to allow the distribution of packets to the address 255.255.255.255 (as said in RFC 1531). + +NOTE FOR WINDOWS USERS: +I don't know how to add that route in MSW systems, looku yourself for help on that. + + +Comments: +Well, comments are always welcome. It doesn't matter if you want to tell me that i suck. If you find some bug and want to report it please do it to my email at: +carlos@embedded.cl with subject [ecl-dhcp]. If the circumstances allow that i will create a mail list. diff --git a/rosapps/net/dhcpd/README.ROS b/rosapps/net/dhcpd/README.ROS new file mode 100644 index 00000000000..779f20e988d --- /dev/null +++ b/rosapps/net/dhcpd/README.ROS @@ -0,0 +1,6 @@ +Embedded DHCP Server for ReactOS - Carlos Manuel Duclos Vergara + +TODO: +Make it a real Windows Service +Use the registry rather than a config file +Fix a few races and check to see how it can scale. \ No newline at end of file diff --git a/rosapps/net/dhcpd/TODO b/rosapps/net/dhcpd/TODO new file mode 100644 index 00000000000..b29327ffdac --- /dev/null +++ b/rosapps/net/dhcpd/TODO @@ -0,0 +1,8 @@ +There are two kind of things, the essentials and the optionals. + +Optionals: +- Implement a way to bypass the IP stack and send packets directly. +- Sort and beauty the code, maybe rewritting in C++. + +Essentials: +- Compile it and test it in MS Windows platforms(work in progress). diff --git a/rosapps/net/dhcpd/aclocal.m4 b/rosapps/net/dhcpd/aclocal.m4 new file mode 100644 index 00000000000..9f8add8f0d9 --- /dev/null +++ b/rosapps/net/dhcpd/aclocal.m4 @@ -0,0 +1,104 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + diff --git a/rosapps/net/dhcpd/config.cache b/rosapps/net/dhcpd/config.cache new file mode 100644 index 00000000000..665b5b63b1e --- /dev/null +++ b/rosapps/net/dhcpd/config.cache @@ -0,0 +1,26 @@ +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_func_socket=${ac_cv_func_socket=yes} +ac_cv_header_stdc=${ac_cv_header_stdc=yes} +ac_cv_header_unistd_h=${ac_cv_header_unistd_h=yes} +ac_cv_mingw32=${ac_cv_mingw32=no} +ac_cv_path_install=${ac_cv_path_install='$/usr/bin/install -c'} +ac_cv_prog_CC=${ac_cv_prog_CC=gcc} +ac_cv_prog_CPP=${ac_cv_prog_CPP='$gcc -E'} +ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no} +ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes} +ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes} +ac_cv_prog_gcc=${ac_cv_prog_gcc=yes} +ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes} diff --git a/rosapps/net/dhcpd/config.h b/rosapps/net/dhcpd/config.h new file mode 100644 index 00000000000..a78c0d4614b --- /dev/null +++ b/rosapps/net/dhcpd/config.h @@ -0,0 +1,25 @@ +/* config.h. Generated automatically by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* #undef MINGW32 */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the header file. */ +/* #undef HAVE_PTHREAD_H */ + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the pthread library (-lpthread). */ +/* #undef HAVE_LIBPTHREAD */ + +/* Name of package */ +#define PACKAGE "dhcptool" + +/* Version number of package */ +#define VERSION "0.0.1-alpha" + diff --git a/rosapps/net/dhcpd/config.h.in b/rosapps/net/dhcpd/config.h.in new file mode 100644 index 00000000000..3dd9ff0f414 --- /dev/null +++ b/rosapps/net/dhcpd/config.h.in @@ -0,0 +1,24 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +#undef MINGW32 + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the pthread library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/rosapps/net/dhcpd/config.h.top b/rosapps/net/dhcpd/config.h.top new file mode 100644 index 00000000000..a5c8595f4db --- /dev/null +++ b/rosapps/net/dhcpd/config.h.top @@ -0,0 +1 @@ +#undef MINGW32 diff --git a/rosapps/net/dhcpd/config.log b/rosapps/net/dhcpd/config.log new file mode 100644 index 00000000000..7f48064b6eb --- /dev/null +++ b/rosapps/net/dhcpd/config.log @@ -0,0 +1,22 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +configure:557: checking for a BSD compatible install +configure:610: checking whether build environment is sane +configure:667: checking whether make sets ${MAKE} +configure:713: checking for working aclocal +configure:726: checking for working autoconf +configure:739: checking for working automake +configure:752: checking for working autoheader +configure:765: checking for working makeinfo +configure:783: checking for gcc +configure:896: checking whether the C compiler (gcc ) works +configure:912: gcc -o conftest conftest.c 1>&5 +configure:938: checking whether the C compiler (gcc ) is a cross-compiler +configure:943: checking whether we are using GNU C +configure:971: checking whether gcc accepts -g +configure:1005: checking how to run the C preprocessor +configure:1085: checking for ANSI C header files +configure:1192: checking for unistd.h +configure:1230: checking for mingw32 environment +configure:1262: checking for socket diff --git a/rosapps/net/dhcpd/config.status b/rosapps/net/dhcpd/config.status new file mode 100644 index 00000000000..2592d8efae5 --- /dev/null +++ b/rosapps/net/dhcpd/config.status @@ -0,0 +1,251 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host steven: +# +# ./configure +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. +ac_given_INSTALL="$/usr/bin/install -c" + +trap 'rm -fr Makefile src/Makefile config.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@SHELL@%/bin/sh%g +s%@CFLAGS@%-g -O2%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@FFLAGS@%%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr/local%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@INSTALL_PROGRAM@%${INSTALL}%g +s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g +s%@INSTALL_DATA@%${INSTALL} -m 644%g +s%@PACKAGE@%dhcptool%g +s%@VERSION@%0.0.1-alpha%g +s%@ACLOCAL@%aclocal%g +s%@AUTOCONF@%autoconf%g +s%@AUTOMAKE@%automake%g +s%@AUTOHEADER@%autoheader%g +s%@MAKEINFO@%makeinfo%g +s%@SET_MAKE@%%g +s%@CC@%gcc%g +s%@CPP@%$gcc -E%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"Makefile src/Makefile"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then + CONFIG_HEADERS="config.h" +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag < conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + + +exit 0 diff --git a/rosapps/net/dhcpd/configure b/rosapps/net/dhcpd/configure new file mode 100644 index 00000000000..e2f1eca4a6d --- /dev/null +++ b/rosapps/net/dhcpd/configure @@ -0,0 +1,1678 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=src/main.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:557: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:610: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:667: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=dhcptool + +VERSION=0.0.1-alpha + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:713: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:726: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:739: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:752: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:765: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:783: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:813: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:864: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:896: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 907 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:938: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:943: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:971: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1005: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1085: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1192: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1230: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +for ac_func in socket +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1262: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile src/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/rosapps/net/dhcpd/configure.in b/rosapps/net/dhcpd/configure.in new file mode 100644 index 00000000000..3effb635278 --- /dev/null +++ b/rosapps/net/dhcpd/configure.in @@ -0,0 +1,24 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(src/main.c) + +AM_INIT_AUTOMAKE( dhcptool, 0.0.1-alpha) + +AC_CONFIG_HEADER(config.h) +dnl Checks for programs. +AC_PROG_CC + +dnl Checks for libraries. +dnl AC_CHECK_LIB(pthread, pthread_create, ,exit) + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) +dnl AC_CHECK_HEADERS(pthread.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_MINGW32 + +dnl Checks for library functions. +AC_CHECK_FUNCS(socket) + +AC_OUTPUT(Makefile src/Makefile) diff --git a/rosapps/net/dhcpd/dhcpd.rc b/rosapps/net/dhcpd/dhcpd.rc new file mode 100644 index 00000000000..69b439b3884 --- /dev/null +++ b/rosapps/net/dhcpd/dhcpd.rc @@ -0,0 +1,6 @@ +/* $Id$ */ + +#define REACTOS_STR_FILE_DESCRIPTION "DHCP server service\0" +#define REACTOS_STR_INTERNAL_NAME "dhcpd\0" +#define REACTOS_STR_ORIGINAL_FILENAME "dhcpd.exe\0" +#include diff --git a/rosapps/net/dhcpd/install-sh b/rosapps/net/dhcpd/install-sh new file mode 100644 index 00000000000..e9de23842dc --- /dev/null +++ b/rosapps/net/dhcpd/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/rosapps/net/dhcpd/missing b/rosapps/net/dhcpd/missing new file mode 100644 index 00000000000..7789652e877 --- /dev/null +++ b/rosapps/net/dhcpd/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/rosapps/net/dhcpd/mkinstalldirs b/rosapps/net/dhcpd/mkinstalldirs new file mode 100644 index 00000000000..6b3b5fc5d4d --- /dev/null +++ b/rosapps/net/dhcpd/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/rosapps/net/dhcpd/samples/dhcp.conf b/rosapps/net/dhcpd/samples/dhcp.conf new file mode 100644 index 00000000000..9e7a6aec4e2 --- /dev/null +++ b/rosapps/net/dhcpd/samples/dhcp.conf @@ -0,0 +1,8 @@ +# DHCP CONFIGURATION, DO NOT ERASE OR MOVE THIS LINE! +subnet 192.168.2.0 +lease 30 +range 2 5 +mask 255.255.255.0 +router 192.168.2.1 +server 192.168.2.1 +# DHCP CONFIGURATION, DO NOT ERASE OR MOVE THIS LINE! diff --git a/rosapps/net/dhcpd/src/Makefile.am b/rosapps/net/dhcpd/src/Makefile.am new file mode 100644 index 00000000000..25d3fbe1e25 --- /dev/null +++ b/rosapps/net/dhcpd/src/Makefile.am @@ -0,0 +1,6 @@ +SUBDIRS = display leases parsing utils +INCLUDES = -Iinclude +CFLAGS = display.o leases.o parser.o utils.o -Wall +bin_PROGRAMS = dhcp +dhcp_SOURCES = main.c +dhcp_OBJS = display.o leases.o parser.o utils.o diff --git a/rosapps/net/dhcpd/src/Makefile.in b/rosapps/net/dhcpd/src/Makefile.in new file mode 100644 index 00000000000..e46b8499152 --- /dev/null +++ b/rosapps/net/dhcpd/src/Makefile.in @@ -0,0 +1,388 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SUBDIRS = display leases parsing utils +INCLUDES = -Iinclude +CFLAGS = display.o leases.o parser.o utils.o -Wall +bin_PROGRAMS = dhcp +dhcp_SOURCES = main.c +dhcp_OBJS = display.o leases.o parser.o utils.o +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +dhcp_OBJECTS = main.o +dhcp_LDADD = $(LDADD) +dhcp_DEPENDENCIES = +dhcp_LDFLAGS = +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +DEP_FILES = .deps/main.P +SOURCES = $(dhcp_SOURCES) +OBJECTS = $(dhcp_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +dhcp: $(dhcp_OBJECTS) $(dhcp_DEPENDENCIES) + @rm -f dhcp + $(LINK) $(dhcp_LDFLAGS) $(dhcp_OBJECTS) $(dhcp_LDADD) $(LIBS) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: install-binPROGRAMS +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-binPROGRAMS +uninstall: uninstall-recursive +all-am: Makefile $(PROGRAMS) +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ + distclean-depend distclean-generic clean-am + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile install-data-recursive \ +uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/rosapps/net/dhcpd/src/dhcp.conf b/rosapps/net/dhcpd/src/dhcp.conf new file mode 100644 index 00000000000..e2e3803721f --- /dev/null +++ b/rosapps/net/dhcpd/src/dhcp.conf @@ -0,0 +1,9 @@ +# DHCP CONFIGURATION, DO NOT ERASE OR MOVE THIS LINE! +subnet 192.168.2.0 +lease 30 +range 2 5 +mask 255.255.255.0 +router 192.168.2.1 +server 192.168.2.1 +host 52:54:40:22:65:BD 192.168.2.200 +# DHCP CONFIGURATION, DO NOT ERASE OR MOVE THIS LINE! diff --git a/rosapps/net/dhcpd/src/display/display.c b/rosapps/net/dhcpd/src/display/display.c new file mode 100644 index 00000000000..d2de8a5aa1d --- /dev/null +++ b/rosapps/net/dhcpd/src/display/display.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +int display_dhcp_packet( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo ) +{ + char *mtype; + if( dhcpm == NULL ) + return -1; + + fprintf( stdout, "op: %s\t|htype: %s\t|hlen: %u\t|hops: %u\n", (dhcpm->op == 1)?"BOOTREQUEST":"BOOTREPLY", (dhcpm->htype==1)?"Ethernet 10Mb":"unknown", dhcpm->hlen, dhcpm->hops); + fprintf( stdout, "xid: %u \n", dhcpm->xid ); + fprintf( stdout, "secs: %u\t\t|flags: %u\n", dhcpm->secs, dhcpm->flags ); + fprintf( stdout, "ciaddr: %u.%u.%u.%u \n", (dhcpm->ciaddr >> 24), ((dhcpm->ciaddr>>16)&0xFF), ((dhcpm->ciaddr>>8)&0xFF), ((dhcpm->ciaddr)&0xFF)); + fprintf( stdout, "yiaddr: %u.%u.%u.%u \n", (dhcpm->yiaddr >> 24), ((dhcpm->yiaddr>>16)&0xFF), ((dhcpm->yiaddr>>8)&0xFF), ((dhcpm->yiaddr)&0xFF)); + fprintf( stdout, "siaddr: %u.%u.%u.%u \n", (dhcpm->siaddr >> 24), ((dhcpm->siaddr>>16)&0xFF), ((dhcpm->siaddr>>8)&0xFF), ((dhcpm->siaddr)&0xFF)); + fprintf( stdout, "giaddr: %u.%u.%u.%u \n", (dhcpm->giaddr >> 24), ((dhcpm->giaddr>>16)&0xFF), ((dhcpm->giaddr>>8)&0xFF), ((dhcpm->giaddr)&0xFF)); + fprintf( stdout, "chaddr: %X::%X::%X::%X::%X::%X \n", dhcpm->chaddr[0], dhcpm->chaddr[1], dhcpm->chaddr[2], dhcpm->chaddr[3], dhcpm->chaddr[4], dhcpm->chaddr[5] ); + fprintf( stdout, "sname: %s \n", dhcpm->sname ); + fprintf( stdout, "file: %s \n", dhcpm->file ); + /* options come here */ + switch( dhcpo->type ) + { + case DHCPDISCOVER: + mtype = (char *)malloc( strlen( "DHCPDISCOVER" ) +1); + strcpy( mtype, "DHCPDISCOVER" ); + break; + case DHCPREQUEST: + mtype = (char *)malloc( strlen( "DHCPREQUEST" ) +1); + strcpy( mtype, "DHCPREQUEST" ); + break; + case DHCPACK: + mtype = (char *)malloc( strlen( "DHCPACK" ) +1); + strcpy( mtype, "DHCPACK" ); + break; + case DHCPNAK: + mtype = (char *)malloc( strlen( "DHCPNAK" ) +1); + strcpy( mtype, "DHCPNAK" ); + break; + case DHCPRELEASE: + mtype = (char *)malloc( strlen( "DHCPRELEASE" ) +1); + strcpy( mtype, "DHCPRELEASE" ); + break; + case DHCPDECLINE: + mtype = (char *)malloc( strlen( "DHCPDECLINE" ) +1); + strcpy( mtype, "DHCPDECLINE" ); + break; + case DHCPOFFER: + mtype = (char *)malloc( strlen( "DHCPOFFER" ) +1); + strcpy( mtype, "DHCPOFFER" ); + break; + default: + mtype = (char *)malloc( strlen("Unknown Type") +1); + strcpy( mtype, "Unknown Type" ); + break; + } + fprintf( stdout, "Message Type: %s \n", mtype ); + return 0; +} + diff --git a/rosapps/net/dhcpd/src/include/datatypes.h b/rosapps/net/dhcpd/src/include/datatypes.h new file mode 100644 index 00000000000..a99a10d1261 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/datatypes.h @@ -0,0 +1,56 @@ +#ifndef DATATYPES_H +#define DATATYPES_H + +typedef unsigned char u8b; +typedef unsigned short u16b; +typedef unsigned int u32b; + +typedef struct{ + u8b op; + u8b htype; + u8b hlen; + u8b hops; + u32b xid; + u16b secs; + u16b flags; + u32b ciaddr; + u32b yiaddr; + u32b siaddr; + u32b giaddr; + u8b chaddr[16]; + u8b sname[64]; + u8b file[128]; + u8b options[312]; +} DHCPMESSAGE; + +typedef struct{ + u8b type; + u32b r_ip; + u32b r_mask; + u32b r_router; + u32b r_lease; + char *hostname; +} DHCPOPTIONS; + +typedef struct{ + u32b ip; + u32b router; + u32b mask; + u32b lease; + u32b siaddr; +} DHCPLEASE; + +struct _DHCPLIST{ + u8b available; + u32b xid; + u8b chaddr[16]; + u8b type; + u32b ltime; + DHCPLEASE data; + struct _DHCPLIST *next; + struct _DHCPLIST *back; +}; + +typedef struct _DHCPLIST DHCPLIST; + +#endif diff --git a/rosapps/net/dhcpd/src/include/display.h b/rosapps/net/dhcpd/src/include/display.h new file mode 100644 index 00000000000..833ab988ae6 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/display.h @@ -0,0 +1,6 @@ +#ifndef DISPLAY_H +#define DISPLAY_H + +int display_dhcp_packet( DHCPMESSAGE *, DHCPOPTIONS *); + +#endif diff --git a/rosapps/net/dhcpd/src/include/headers.h b/rosapps/net/dhcpd/src/include/headers.h new file mode 100644 index 00000000000..e4ca9e7aa68 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/headers.h @@ -0,0 +1,25 @@ +#ifndef HEADERS_H +#define HEADERS_H + +#ifdef __MINGW32__ + +#include +#include +#include + +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif + +#endif diff --git a/rosapps/net/dhcpd/src/include/iputils.h b/rosapps/net/dhcpd/src/include/iputils.h new file mode 100644 index 00000000000..6ab028540a2 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/iputils.h @@ -0,0 +1,7 @@ +#ifndef IPUTILS_H +#define IPUTILS_H + +int split_ip( char *, u8b *, int ); +int get_ip( char *, u32b * ); + +#endif diff --git a/rosapps/net/dhcpd/src/include/leases.h b/rosapps/net/dhcpd/src/include/leases.h new file mode 100644 index 00000000000..577be67b84d --- /dev/null +++ b/rosapps/net/dhcpd/src/include/leases.h @@ -0,0 +1,10 @@ +#ifndef LEASES_H +#define LEASES_H + +extern DHCPLIST *list; +int find_lease( DHCPLEASE *, u32b, u8b * ); +int init_leases_list(); +int confirm_lease( DHCPLEASE *, u32b ); +int release_lease( DHCPLEASE *, u32b, u8b * ); + +#endif diff --git a/rosapps/net/dhcpd/src/include/lock.h b/rosapps/net/dhcpd/src/include/lock.h new file mode 100644 index 00000000000..6d1e36e2905 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/lock.h @@ -0,0 +1,11 @@ +#ifndef LOCK_H +#define LOCK_H + +extern DHCPLIST *leased_list; + +int check_leased_list(); +static int test_and_set(); +int lock_list(); +int unlock_list(); + +#endif diff --git a/rosapps/net/dhcpd/src/include/macutils.h b/rosapps/net/dhcpd/src/include/macutils.h new file mode 100644 index 00000000000..471c52e9e76 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/macutils.h @@ -0,0 +1,7 @@ +#ifndef MACUTILS_H +#define MACUTILS_H + +int maccmp( u8b *, u8b *); +int maccpy( u8b *, u8b *); + +#endif diff --git a/rosapps/net/dhcpd/src/include/options.h b/rosapps/net/dhcpd/src/include/options.h new file mode 100644 index 00000000000..d89176c4f5c --- /dev/null +++ b/rosapps/net/dhcpd/src/include/options.h @@ -0,0 +1,118 @@ +/* This software is GPL, see http://www.gnu.org to see exactly what it means */ + +/* This file contains some useful constant declarations */ + +#ifndef OPTIONS_H +#define OPTIONS_H + +#define VERSION "ecl-dhcp-0.0.2-snoopy" + +#define MAX_PROCESS_TIME 15 + +#define FALSE 0 +#define TRUE 1 + +#define BOOTREQUEST 0x1 +#define BOOTREPLY 0x2 + + /* Message types */ + +#define DHCPDISCOVER 0x1 +#define DHCPOFFER 0x2 +#define DHCPREQUEST 0x3 +#define DHCPDECLINE 0x4 +#define DHCPACK 0x5 +#define DHCPNAK 0x6 +#define DHCPRELEASE 0x7 +#define DHCPINFORM 0x8 + + +#define PAD 0x00 +#define MASK 0x01 +#define TOFFSET 0x02 +#define ROUTER 0x03 +#define TIMESERVER 0x04 +#define NS 0x05 +#define DNS 0x06 +#define LOGSERVER 0x07 +#define COOKIESERVER 0x08 +#define LPRSERVER 0x09 +#define IMPSERVER 0x0A +#define RESLOCSERVER 0x0B +#define HOSTNAME 0x0C +#define BOOTFILESIZE 0x0D +#define MERITDUMPFILE 0x0E +#define DOMAINNAME 0x0F +#define SWAPSERVER 0x10 +#define ROOTPATH 0x11 +#define EXTENSIONPATH 0x12 +#define IPFORWARD 0x13 +#define NONLOCAL 0x14 +#define POLICYFILTER 0x15 +#define MAXIMUMDATAG 0x16 +#define DEFAULTTTL 0x17 +#define PATHMTUATO 0x18 +#define PATHMTUPTO 0x19 +#define IMTU 0x1A +#define ALLSUBLOCAL 0x1B +#define BROADCAST 0x1C +#define PMASKDISCOVERY 0x1D +#define MASKSUPPLIER 0x1E +#define PROUTERDISCOVE 0x1F +#define RSOLICIADDRESS 0x20 +#define STATICROUTE 0x21 +#define TENCAPSULATION 0x22 +#define ARPCACHE 0x23 +#define ETHENCAPSUL 0x24 +#define TCPDEFTTL 0x25 +#define TCPKAI 0x26 +#define TCPKAG 0x27 +#define NISDOMAIN 0x28 +#define NISSERVER 0x29 +#define NTPSERVER 0x2A +#define VENDORSP 0x2B +#define NBTCPIPNS 0x2C +#define NBTCPIPDDS 0x2D +#define NBTCPIPNT 0x2E +#define NBTCPIPSC 0x2F +#define XWINFONTSERVER 0x30 +#define XWINDISPLAY 0x31 +#define IP 0x32 +#define LEASE 0x33 +#define OVERLOAD 0x34 +#define MESSAGETYPE 0x35 +#define SERVER 0x36 +#define PREQUEST 0x37 +#define MESSAGE 0x38 +#define MAXIMUMDHCP 0x39 +#define RENEWALTIME 0x3A +#define REBINDING 0x3B +#define VENDORCLASS 0x3C +#define CLIENT 0x3D +#define NISPLUSDOMAIN 0x40 +#define NISPLUSSERVER 0x41 +#define TFTPSERVER 0x42 +#define BOOTFILE 0x43 +#define MOBILEIP 0x44 +#define SMTPSERVER 0x45 +#define POP3SERVER 0x46 +#define NNTPSERVER 0x47 +#define HTTPSERVER 0x48 +#define FINGERSERVER 0x49 +#define IRCSERVER 0x4A +#define STREETTALKSE 0x4B +#define STREETTALKDA 0x4C +#define END 0xFF + + /* Constants */ +#define FREE 0x01 +#define PROCESSING 0x02 +#define BUSY 0x00 + +#define DYNAMIC 0x00 +#ifdef STATIC +#undef STATIC +#endif +#define STATIC 0x01 + +#endif diff --git a/rosapps/net/dhcpd/src/include/parser.h b/rosapps/net/dhcpd/src/include/parser.h new file mode 100644 index 00000000000..6ecc47d3b47 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/parser.h @@ -0,0 +1,8 @@ +#ifndef PARSER_H +#define PARSER_H + +int parse_dhcp_options( DHCPMESSAGE *, DHCPOPTIONS *); +int process_dhcp_packet( DHCPMESSAGE *, DHCPOPTIONS *); +int write_packet( DHCPMESSAGE *, char *); + +#endif diff --git a/rosapps/net/dhcpd/src/include/utils.h b/rosapps/net/dhcpd/src/include/utils.h new file mode 100644 index 00000000000..2c00a9d1ac5 --- /dev/null +++ b/rosapps/net/dhcpd/src/include/utils.h @@ -0,0 +1,7 @@ +#ifndef UTILS_H +#define UTILS_H + +#include +#include + +#endif diff --git a/rosapps/net/dhcpd/src/include/wutils.h b/rosapps/net/dhcpd/src/include/wutils.h new file mode 100644 index 00000000000..b9f150fbadb --- /dev/null +++ b/rosapps/net/dhcpd/src/include/wutils.h @@ -0,0 +1,6 @@ +#ifndef WUTILS_H +#define WUTILS_H + +u8b try_lock( u8b * ); + +#endif diff --git a/rosapps/net/dhcpd/src/leases/leases.c b/rosapps/net/dhcpd/src/leases/leases.c new file mode 100644 index 00000000000..de56f3f0d69 --- /dev/null +++ b/rosapps/net/dhcpd/src/leases/leases.c @@ -0,0 +1,231 @@ +#include +#include +#include +#include +#include +#include + +int init_leases_list() +{ + DHCPLIST *temp; + int i, j; + u8b chaddr[16]; + FILE *config; + char line[80]; + char textsubnet[16]; + char textlease[5]; + char textrouter[16]; + char textmask[16]; + char textlowrange[4], texthighrange[4]; + char textserver[16]; + u8b ip0, ip1, ip2, ip3; + u8b lowrange, highrange; + u8b textmac[17], textip[16]; + u32b lease; + + /* Be nice variables and behave yourselves */ + + for( j = 0; j < 16; j++ ) + { + chaddr[j] = 0; + textsubnet[j] = 0; + textrouter[j] = 0; + textmask[j] = 0; + textip[j] = 0; + textmac[j] = 0; + } + + textlease[0] = 0; + textlowrange[0] = 0; + texthighrange[0] = 0; + + /* Now we can read our configuration file */ + + config = fopen( "dhcp.conf", "r" ); + if( !config ) + { + perror("Reading config files"); + exit( 0 ); + } + + /* We _DO_ need a better parser */ + list = (DHCPLIST *)malloc( sizeof( DHCPLIST )); + temp = list; + temp->back = NULL; + + while( (!feof( config )) && ( line )) + { + fscanf( config, "%s", line); + if( !strcmp( line, "subnet" )) + /* Read subnet parameters */ + fscanf( config, "%s", textsubnet ); + + if( !strcmp( line, "lease" )) + /* read lease parameters */ + fscanf( config, "%s", textlease ); + + if( !strcmp( line, "router" )) + fscanf( config, "%s", textrouter ); + + if( !strcmp( line, "mask" )) + fscanf( config, "%s", textmask ); + + if( !strcmp( line, "range" )) + fscanf( config, "%s %s", textlowrange, texthighrange ); + if( !strcmp( line, "server" )) + fscanf( config, "%s", textserver ); + if( !strcmp( line, "host" )) + { + /* Host Specific Configuration */ + fscanf( config, "%s %s", textmac, textip ); + str2mac( textmac, temp->chaddr ); + temp->type = STATIC; + temp->data.ip = inet_addr( textip ); + temp->next = (DHCPLIST *)malloc( sizeof( DHCPLIST )); + temp->next->back = temp; + temp = temp->next; + temp->next =NULL; + } + } + fclose( config ); + + lowrange = (u8b)atoi( textlowrange ); + highrange = (u8b)atoi( texthighrange ); + lease = (u32b)atoi( textlease ); + + /* Creating Static IP */ + + for( temp = list; temp->next; temp = temp->next ) + { + temp->available = FREE; + temp->xid = 0; + temp->data.router = inet_addr( textrouter ); + temp->data.mask = inet_addr( textmask ); + temp->data.lease = lease; + temp->data.siaddr = inet_addr( textserver ); + } + + /* Creating Dynamic IP */ + + for( i = lowrange; i < (highrange + 1); i++ ) + { + temp->available = FREE; + temp->xid = 0; + temp->type = DYNAMIC; + maccpy( temp->chaddr, chaddr ); + split_ip( textsubnet, &ip0, 0 ); + split_ip( textsubnet, &ip1, 1 ); + split_ip( textsubnet, &ip2, 2 ); + temp->data.ip = i; + temp->data.ip = temp->data.ip << 8; + temp->data.ip += ip2; + temp->data.ip = temp->data.ip << 8; + temp->data.ip += ip1; + temp->data.ip = temp->data.ip << 8; + temp->data.ip += ip0; + temp->data.router = inet_addr( textrouter ); + temp->data.mask = inet_addr( textmask ); + temp->data.lease = lease; + temp->data.siaddr = inet_addr( textserver ); + temp->next = (DHCPLIST *)malloc( sizeof( DHCPLIST )); + temp->next->back = temp; + temp = temp->next; + } + return 0; +} + +int find_lease( DHCPLEASE *dhcpl, u32b xid, u8b chaddr[] ) +{ + int result = -2; + DHCPLIST *temp; + + if( !dhcpl ) + return -1; + + for( temp = list; temp; temp=temp->next ) + if( !maccmp( temp->chaddr, chaddr ) ) + release_lease( dhcpl, xid, chaddr); + + for( temp = list; temp; temp=temp->next ) + if( ( !maccmp( temp->chaddr, chaddr )) && ( temp->type == STATIC )) + { + dhcpl->ip = temp->data.ip; + dhcpl->router = temp->data.router; + dhcpl->mask = temp->data.mask; + dhcpl->lease = temp->data.lease; + dhcpl->siaddr = temp->data.siaddr; + fprintf( stdout, "Assigning Static IP! \n"); + temp->available = PROCESSING; + temp->xid = xid; + temp->ltime = MAX_PROCESS_TIME; + maccpy( temp->chaddr, chaddr); + result = 0; + return result; + } + else if( ( temp->available & FREE ) && ( temp->type == DYNAMIC )) + { + dhcpl->ip = temp->data.ip; + dhcpl->router = temp->data.router; + dhcpl->mask = temp->data.mask; + dhcpl->lease = temp->data.lease; + dhcpl->siaddr = temp->data.siaddr; + fprintf( stdout, "Assigning Dynamic IP! \n"); + temp->available = PROCESSING; + temp->xid = xid; + temp->ltime = MAX_PROCESS_TIME; + maccpy( temp->chaddr, chaddr); + result = 0; + return result; + } + return result; +} + +int confirm_lease( DHCPLEASE *dhcpl, u32b xid ) +{ + int result = -1; + DHCPLIST *temp; + + for( temp = list; temp; temp=temp->next ) + if( temp->xid == xid ) + { + dhcpl->ip = temp->data.ip; + dhcpl->router = temp->data.router; + dhcpl->mask = temp->data.mask; + dhcpl->lease = temp->data.lease; + dhcpl->siaddr = temp->data.siaddr; + temp->available = BUSY; + temp->ltime = temp->data.lease; + result = 0; + return result; + } + return result; +} + +int release_lease( DHCPLEASE *dhcpl, u32b xid, u8b chaddr[16] ) +{ + int result = -1, i; + DHCPLIST *temp; + u8b nchaddr[16]; + + for( i = 0; i < 16; i++ ) + nchaddr[i] = 0; + + if( !dhcpl ) + return -1; + + for( temp = list; temp; temp=temp->next ) + if( !maccmp( temp->chaddr, chaddr ) ) + { + /* We found the address */ + result = 0; + fprintf( stdout, "Deleting %X::%X::%X::%X::%X::%X \n", temp->chaddr[0], temp->chaddr[1], temp->chaddr[2], temp->chaddr[3], temp->chaddr[4], temp->chaddr[5] ); + temp->available = FREE; + temp->xid = 0; + /* maccpy( temp->chaddr, nchaddr ); */ + } else { + /* No such address */ + result = -1; + } + + return result; +} diff --git a/rosapps/net/dhcpd/src/lock/locker.c b/rosapps/net/dhcpd/src/lock/locker.c new file mode 100644 index 00000000000..3998a82437d --- /dev/null +++ b/rosapps/net/dhcpd/src/lock/locker.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include + +int check_leased_list() +{ + DHCPLIST *temp, *ntemp; + int count = 1, i; + + /* fprintf( stdout, "checking list! \n" ); */ + + return 0; +} + +static int test_and_set() +{ + /* Test lock, if it's locked return FALSE */ + + return TRUE; +} + +int lock_list() +{ + int count = 1; + + while( !test_and_set() ) + { + sleep( 1 ); + count++; + } + + return count; +} + +int unlock_list() +{ + return TRUE; +} diff --git a/rosapps/net/dhcpd/src/main.c b/rosapps/net/dhcpd/src/main.c new file mode 100644 index 00000000000..da7d52fa190 --- /dev/null +++ b/rosapps/net/dhcpd/src/main.c @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include +#include + +#define MYPORT 67 +DHCPLIST *list; +/*DHCPLIST *leased_list;*/ + +int main( int argc, char *argv[] ) +{ +#ifdef __MINGW32__ + WSADATA wsaData; + int nCode; +#endif + int sockfd; + struct sockaddr_in my_addr; + struct sockaddr_in their_addr; + int addr_len, numbytes; + DHCPMESSAGE dhcpm; + DHCPOPTIONS dhcpo; + +#ifdef __MINGW32__ + if ((nCode = WSAStartup(MAKEWORD(1, 1), &wsaData)) != 0) + { + perror("WSAStartup"); + return 0; + } +#endif + + if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { + perror("socket"); + exit(1); + } + + init_leases_list(); + + my_addr.sin_family = AF_INET; + my_addr.sin_port = htons(MYPORT); + my_addr.sin_addr.s_addr = INADDR_ANY; + memset(&(my_addr.sin_zero), '\0', 8); + + if (bind(sockfd, (struct sockaddr *)&my_addr, + sizeof(struct sockaddr)) == -1) { + perror("bind"); + exit(1); + } + + addr_len = sizeof(struct sockaddr); + while((numbytes=recvfrom(sockfd,&dhcpm, sizeof( DHCPMESSAGE ), 0, + (struct sockaddr *)&their_addr, &addr_len)) != -1) { + /* Parse DHCP */ + display_dhcp_packet( &dhcpm, &dhcpo ); + if( parse_dhcp_options( &dhcpm, &dhcpo ) < 0 ) + continue; + if( display_dhcp_packet( &dhcpm, &dhcpo ) < 0 ) + continue; + if( process_dhcp_packet( &dhcpm, &dhcpo ) < 0 ) + continue; + } + + close(sockfd); + +#ifdef __MINGW32__ + WSACleanup(); +#endif + + return 0; + +} diff --git a/rosapps/net/dhcpd/src/parsing/parser.c b/rosapps/net/dhcpd/src/parsing/parser.c new file mode 100644 index 00000000000..80adda1ad97 --- /dev/null +++ b/rosapps/net/dhcpd/src/parsing/parser.c @@ -0,0 +1,402 @@ +#include +#include +#include +#include +#include +#include + +int parse_dhcp_options( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo ) +{ + int pointer, opointer; + int olength; + + pointer = 0; + + fprintf( stdout, "parse_dhcp_options [begin]!\n"); + + /* Options Initialization */ + /* No message type */ + dhcpo->type = 0; + /* No ip address, 0.0.0.0 */ + dhcpo->r_ip = 0; + /* No mask address, 0.0.0.0 */ + dhcpo->r_mask = 0; + /* No router, 0.0.0.0 */ + dhcpo->r_router = 0; + /* No lease 0 */ + dhcpo->r_lease = 0; + /* No name '\n' */ + dhcpo->hostname = NULL; + + while( pointer< 312 ) + { + if(( dhcpm->options[0] != 99 ) && (dhcpm->options[1]!=130) && (dhcpm->options[2]!=83) && (dhcpm->options[3]!= 99)) + { + fprintf( stdout, "No magic cookie! Aborting! \n" ); + return -1; + } + switch( dhcpm->options[pointer] ){ + case PAD: + pointer++; + break; + case MESSAGETYPE: + /* Try to figure out the kind of message and start the configuring process */ + pointer += 2; + dhcpo->type = dhcpm->options[pointer++]; + break; + case PREQUEST: + /* Take note of the requested parameters */ + opointer = pointer + 2; + olength = pointer + dhcpm->options[pointer + 1]; + while( opointer < olength ) + { + switch( dhcpm->options[opointer] ){ + case IP: + /* Take note of the requested ip */ + opointer += 2; + dhcpo->r_ip += dhcpm->options[opointer++]; + dhcpo->r_ip = dhcpo->r_ip << 8; + dhcpo->r_ip += dhcpm->options[opointer++]; + dhcpo->r_ip = dhcpo->r_ip << 8; + dhcpo->r_ip += dhcpm->options[opointer++]; + dhcpo->r_ip = dhcpo->r_ip << 8; + dhcpo->r_ip += dhcpm->options[opointer++]; + break; + case MASK: + /* Take note of the requested mask */ + opointer += 2; + dhcpo->r_mask += dhcpm->options[opointer++]; + dhcpo->r_mask = dhcpo->r_ip << 8; + dhcpo->r_mask += dhcpm->options[opointer++]; + dhcpo->r_mask = dhcpo->r_ip << 8; + dhcpo->r_mask += dhcpm->options[opointer++]; + dhcpo->r_mask = dhcpo->r_ip << 8; + dhcpo->r_mask += dhcpm->options[opointer++]; + break; + case ROUTER: + /* Take note of the requested router */ + opointer += 2; + dhcpo->r_router += dhcpm->options[opointer++]; + dhcpo->r_router = dhcpo->r_ip << 8; + dhcpo->r_router += dhcpm->options[opointer++]; + dhcpo->r_router = dhcpo->r_ip << 8; + dhcpo->r_router += dhcpm->options[opointer++]; + dhcpo->r_router = dhcpo->r_ip << 8; + dhcpo->r_router += dhcpm->options[opointer++]; + break; + case LEASE: + opointer += 2; + dhcpo->r_lease += dhcpm->options[opointer++]; + dhcpo->r_lease = dhcpo->r_ip << 8; + dhcpo->r_lease += dhcpm->options[opointer++]; + dhcpo->r_lease = dhcpo->r_ip << 8; + dhcpo->r_lease += dhcpm->options[opointer++]; + dhcpo->r_lease = dhcpo->r_ip << 8; + dhcpo->r_lease += dhcpm->options[opointer++]; + break; + case HOSTNAME: + opointer += 1; + dhcpo->hostname = (char *)malloc( dhcpm->options[opointer] + 1); + strncpy( dhcpo->hostname, &dhcpm->options[opointer+1], dhcpm->options[opointer] ); + opointer += dhcpm->options[opointer] + 1; + default: + /* Ignore option */ + opointer++; + break; + } + } + pointer = opointer; + break; + case TOFFSET: + case TIMESERVER: + case NS: + case DNS: + case LOGSERVER: + case COOKIESERVER: + case LPRSERVER: + case IMPSERVER: + case RESLOCSERVER: + case BOOTFILESIZE: + case MERITDUMPFILE: + case DOMAINNAME: + case SWAPSERVER: + case ROOTPATH: + case EXTENSIONPATH: + case IPFORWARD: + case NONLOCAL: + case POLICYFILTER: + case MAXIMUMDATAG: + case DEFAULTTTL: + case PATHMTUATO: + case PATHMTUPTO: + case IMTU: + case ALLSUBLOCAL: + case BROADCAST: + case PMASKDISCOVERY: + case MASKSUPPLIER: + case PROUTERDISCOVE: + case RSOLICIADDRESS: + case STATICROUTE: + case TENCAPSULATION: + case ARPCACHE: + case ETHENCAPSUL: + case TCPDEFTTL: + case TCPKAI: + case TCPKAG: + case NISDOMAIN: + case NISSERVER: + case NTPSERVER: + case VENDORSP: + case NBTCPIPNS: + case NBTCPIPDDS: + case NBTCPIPNT: + case NBTCPIPSC: + case XWINFONTSERVER: + case XWINDISPLAY: + case OVERLOAD: + case SERVER: + case MESSAGE: + case MAXIMUMDHCP: + case RENEWALTIME: + case REBINDING: + case VENDORCLASS: + case NISPLUSDOMAIN: + case NISPLUSSERVER: + case TFTPSERVER: + case BOOTFILE: + case MOBILEIP: + case SMTPSERVER: + case POP3SERVER: + case NNTPSERVER: + case HTTPSERVER: + case FINGERSERVER: + case IRCSERVER: + case STREETTALKSE: + case STREETTALKDA: + case CLIENT: + pointer++; + pointer += dhcpm->options[pointer]; + case END: + /* return to the calling functions because this is over */ + fprintf( stdout, "parse_dhcp_options: END option found! [end]!\n"); + return 0; + default: + /* ignored */ + pointer++; + break; + } + } + fprintf( stdout, "parse_dhcp_options [end]!\n"); + return 0; +} + +int process_dhcp_packet( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo ) +{ + int pointer = 4; + DHCPLEASE dhcpl; + char *name; + + fprintf( stdout, "process_dhcp_packet [begin]!\n"); + + if( (!dhcpm) || (!dhcpo) ) + return -1; + + name = (char *)malloc( 16 ); + switch( dhcpo->type ){ + + case DHCPDISCOVER: + /* We need to send a DHCPOFFER */ + if( find_lease( &dhcpl, dhcpm->xid, dhcpm->chaddr ) < 0 ) + { + fprintf( stdout, "No free leases! \n" ); + return -1; + } + dhcpm->op = BOOTREPLY; + dhcpm->yiaddr = dhcpl.ip; + dhcpm->siaddr = dhcpl.siaddr; + strcpy(dhcpm->sname, VERSION); + dhcpm->options[pointer++] = MESSAGETYPE; + dhcpm->options[pointer++] = 1; + dhcpm->options[pointer++] = DHCPOFFER; + dhcpm->options[pointer++] = ROUTER; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.router & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.router >> 8) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.router >> 16) &0xFF); + dhcpm->options[pointer++] = (dhcpl.router >> 24); + dhcpm->options[pointer++] = MASK; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.mask & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.mask >> 8) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.mask >> 16) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.mask >> 24); + dhcpm->options[pointer++] = SERVER; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.siaddr & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.siaddr >> 8) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.siaddr >> 16) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.siaddr >> 24); + dhcpm->options[pointer++] = LEASE; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.lease >> 24); + dhcpm->options[pointer++] = ((dhcpl.lease >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.lease >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.lease & 0xFF); + dhcpm->options[pointer++] = REBINDING; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.lease >> 24); + dhcpm->options[pointer++] = ((dhcpl.lease >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.lease >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.lease & 0xFF) - 5; + dhcpm->options[pointer++] = RENEWALTIME; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.lease >> 24); + dhcpm->options[pointer++] = ((dhcpl.lease >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.lease >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.lease & 0xFF) - 5; + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = END; + for( ; pointer < 312; pointer++ ) + dhcpm->options[pointer] = PAD; + dhcpo->type = DHCPOFFER; + strcpy( name, "255.255.255.255" ); + break; + + case DHCPREQUEST: + /* We need to send an DHCPACK */ + dhcpm->op = BOOTREPLY; + dhcpm->yiaddr = dhcpm->ciaddr; + strcpy(dhcpm->sname, VERSION); + if( confirm_lease( &dhcpl, dhcpm->xid ) < 0) + { + dhcpm->options[pointer++] = MESSAGETYPE; + dhcpm->options[pointer++] = 1; + dhcpm->options[pointer++] = DHCPNAK; + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = END; + for( ; pointer < 312; pointer++ ) + dhcpm->options[pointer] = PAD; + sprintf( name, "%u.%u.%u.%u", (dhcpm->ciaddr &0xFF), ((dhcpm->ciaddr>>8)&0xFF), ((dhcpm->ciaddr>>16)&0xFF), ((dhcpm->ciaddr>>24)&0xFF)); + display_dhcp_packet( dhcpm, dhcpo ); + write_packet( dhcpm, name ); + return -1; + } + dhcpm->siaddr = dhcpl.siaddr; + dhcpm->options[pointer++] = MESSAGETYPE; + dhcpm->options[pointer++] = 1; + dhcpm->options[pointer++] = DHCPACK; + dhcpm->options[pointer++] = ROUTER; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.router >> 24); + dhcpm->options[pointer++] = ((dhcpl.router >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.router >> 8) &0xFF); + dhcpm->options[pointer++] = (dhcpl.router & 0xFF); + dhcpm->options[pointer++] = MASK; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.mask >> 24); + dhcpm->options[pointer++] = ((dhcpl.mask >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.mask >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.mask & 0xFF); + dhcpm->options[pointer++] = SERVER; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = dhcpl.siaddr >> 24; + dhcpm->options[pointer++] = ((dhcpl.siaddr >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.siaddr >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.siaddr & 0xFF); + dhcpm->options[pointer++] = LEASE; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.lease >> 24); + dhcpm->options[pointer++] = ((dhcpl.lease >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.lease >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.lease & 0xFF); + dhcpm->options[pointer++] = REBINDING; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.lease >> 24); + dhcpm->options[pointer++] = ((dhcpl.lease >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.lease >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.lease & 0xFF); + dhcpm->options[pointer++] = RENEWALTIME; + dhcpm->options[pointer++] = 4; + dhcpm->options[pointer++] = (dhcpl.lease >> 24); + dhcpm->options[pointer++] = ((dhcpl.lease >> 16) & 0xFF); + dhcpm->options[pointer++] = ((dhcpl.lease >> 8) & 0xFF); + dhcpm->options[pointer++] = (dhcpl.lease & 0xFF); + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = PAD; + dhcpm->options[pointer++] = END; + for( ; pointer < 312; pointer++ ) + dhcpm->options[pointer] = PAD; + dhcpo->type = DHCPACK; + sprintf( name, "%u.%u.%u.%u", (dhcpl.ip & 0xFF), ((dhcpl.ip>>8) & 0xFF), ((dhcpl.ip>>16)&0xFF), (dhcpl.ip>>24)); + break; + + default: + break; + } + display_dhcp_packet( dhcpm, dhcpo ); + write_packet( dhcpm, name ); + fprintf( stdout, "process_dhcp_packet [end]!\n"); + return 0; +} + +int write_packet( DHCPMESSAGE *dhcpm, char *name ) +{ + int sockfd; + struct sockaddr_in their_addr; // connector's address information + struct hostent *he; + int numbytes; + int enable = 1; + + fprintf( stdout, "write_packet [begin]\n" ); + + if( !dhcpm ) + return -1; + + if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { + perror("socket"); + exit(1); + } + + if( setsockopt( sockfd, SOL_SOCKET, SO_BROADCAST, &enable, sizeof( enable )) == -1 ) + { + perror("setsockopt"); + exit(1); + } + + if( strcmp( "255.255.255.255", name ) ) + { + if ((he=gethostbyname(name)) == NULL) { // get the host info + perror("gethostbyname"); + fprintf( stdout, "Unknown host %s \n", name ); + return -1; + } + their_addr.sin_family = AF_INET; // host byte order + their_addr.sin_port = htons(68); // short, network byte order + their_addr.sin_addr = *((struct in_addr *)he->h_addr); + } else { + their_addr.sin_family = AF_INET; // host byte order + their_addr.sin_port = htons(68); // short, network byte order + their_addr.sin_addr.s_addr = 0xFFFFFFFF; + } + + fprintf( stdout, "IP a buscar: %s \n", name ); + memset(&(their_addr.sin_zero), '\0', 8); // zero the rest of the struct + + if ((numbytes=sendto(sockfd, dhcpm, sizeof(DHCPMESSAGE), 0, + (struct sockaddr *)&their_addr, sizeof(struct sockaddr))) == -1) { + perror("sendto"); + exit(1); + } + + printf("sent %d bytes to %s\n", numbytes, + inet_ntoa(their_addr.sin_addr)); + + close(sockfd); + + fprintf( stdout, "write_packet [end]\n" ); + + return 0; +} diff --git a/rosapps/net/dhcpd/src/utils/iputils.c b/rosapps/net/dhcpd/src/utils/iputils.c new file mode 100644 index 00000000000..1b605c3bc60 --- /dev/null +++ b/rosapps/net/dhcpd/src/utils/iputils.c @@ -0,0 +1,59 @@ +#include +#include +#include +#include + +int split_ip( char *text, u8b *dest, int place ) +{ + int dotcount; + + /* Don't touch this, unless you like pointer aritmethic */ + + *dest = 0; + + if( !text ) + return -1; + + for( dotcount = 0; (dotcount < place) && ( text ); text++ ) + if( *text == '.' ) + dotcount++; + + if( !text ) + return -2; + + while(( *text != '.' ) && ( *text != '\0' )) + { + *dest *= 10; + *dest += (u8b)(*text-48); + /* 48 is not a hack, is just the code of 0 */ + text++; + } + + return 0; +} + +int get_ip( char *text, u32b *dest ) +{ + /* Don't touch this, unless you like pointer aritmethic */ + + *dest = 0; + + if( !text ) + return -1; + + while( *text != '\0' ) + { + if( *text == '.' ) + { + *dest = *dest << 8; + text++; + continue; + } + *dest *= 10; + *dest += (u8b)(*text-48); + /* 48 is not a hack, is just the code of 0 */ + text++; + } + + return 0; +} diff --git a/rosapps/net/dhcpd/src/utils/macutils.c b/rosapps/net/dhcpd/src/utils/macutils.c new file mode 100644 index 00000000000..e4601348c9e --- /dev/null +++ b/rosapps/net/dhcpd/src/utils/macutils.c @@ -0,0 +1,46 @@ +#include +#include + +int maccpy( u8b dest[16], u8b source[16] ) +{ + int i; + for( i = 0; i < 16; i++ ) + dest[i] = source[i]; + return 0; +} + +int maccmp( u8b dest[16], u8b source[16] ) +{ + int i; + char equal = 0; + + for( i = 0; i < 16; i++ ) + if( dest[i] != source[i] ) + equal = -1; + + return equal; +} + +int str2mac( u8b from[17], u8b to[16] ) +{ + int i, j, length; + u8b buffer; + u8b dif; + + length = (int)strlen( from ); + + for( i = 0, j = 0; i < length; ) + { + buffer = 0; + while( (from[i] != ':' ) && (from[i]!= '\0' )) + { + buffer = buffer << 4; + (from[i]>57)?(dif=55):(dif=48); + buffer += (from[i] - dif); + i++; + } + to[j++] = buffer; + i++; + } + return 0; +} diff --git a/rosapps/net/dhcpd/src/utils/macutils.h b/rosapps/net/dhcpd/src/utils/macutils.h new file mode 100644 index 00000000000..2c80dc6ad5b --- /dev/null +++ b/rosapps/net/dhcpd/src/utils/macutils.h @@ -0,0 +1,8 @@ +#ifndef MACUTILS_H +#define MACUTILS_H + +int maccmp( u8b *, u8b *); +int maccpy( u8b *, u8b *); +int str2mac( u8b *, u8b * ); + +#endif diff --git a/rosapps/net/dhcpd/src/utils/utils.h b/rosapps/net/dhcpd/src/utils/utils.h new file mode 100644 index 00000000000..74200279361 --- /dev/null +++ b/rosapps/net/dhcpd/src/utils/utils.h @@ -0,0 +1,6 @@ +#ifndef UTILS_H +#define UTILS_H + +#include + +#endif diff --git a/rosapps/net/dhcpd/src/utils/wutils.c b/rosapps/net/dhcpd/src/utils/wutils.c new file mode 100644 index 00000000000..f684544f836 --- /dev/null +++ b/rosapps/net/dhcpd/src/utils/wutils.c @@ -0,0 +1,9 @@ +#include +#include + +u8b try_lock( u8b *key ) +{ + if( *key == TRUE ) + return FALSE; + return TRUE; +} diff --git a/rosapps/net/dhcpd/stamp-h b/rosapps/net/dhcpd/stamp-h new file mode 100644 index 00000000000..9788f70238c --- /dev/null +++ b/rosapps/net/dhcpd/stamp-h @@ -0,0 +1 @@ +timestamp diff --git a/rosapps/net/dhcpd/stamp-h.in b/rosapps/net/dhcpd/stamp-h.in new file mode 100644 index 00000000000..9788f70238c --- /dev/null +++ b/rosapps/net/dhcpd/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/rosapps/net/tditest/DIRS b/rosapps/net/tditest/DIRS new file mode 100644 index 00000000000..0f4605a5db3 --- /dev/null +++ b/rosapps/net/tditest/DIRS @@ -0,0 +1 @@ +DIRS= tditest diff --git a/rosapps/net/tditest/include/debug.h b/rosapps/net/tditest/include/debug.h new file mode 100644 index 00000000000..a2bae7b81d5 --- /dev/null +++ b/rosapps/net/tditest/include/debug.h @@ -0,0 +1,89 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TDI test driver + * FILE: include/debug.h + * PURPOSE: Debugging support macros + * DEFINES: DBG - Enable debug output + * NASSERT - Disable assertions + */ +#ifndef __DEBUG_H +#define __DEBUG_H + +#define NORMAL_MASK 0x000000FF +#define SPECIAL_MASK 0xFFFFFF00 +#define MIN_TRACE 0x00000001 +#define MID_TRACE 0x00000002 +#define MAX_TRACE 0x00000003 + +#define DEBUG_ULTRA 0xFFFFFFFF + +#ifdef DBG + +extern ULONG DebugTraceLevel; + +#ifdef _MSC_VER + +#define TDI_DbgPrint(_t_, _x_) \ + if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \ + ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \ + DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ + DbgPrint _x_ ; \ + } + +#else /* _MSC_VER */ + +#define TDI_DbgPrint(_t_, _x_) \ + if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \ + ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \ + DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ + DbgPrint _x_ ; \ + } + +#endif /* _MSC_VER */ + +#ifdef ASSERT +#undef ASSERT +#endif + +#ifdef NASSERT +#define ASSERT(x) +#else /* NASSERT */ +#define ASSERT(x) if (!(x)) { TDI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); } +#endif /* NASSERT */ +#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x)) + +#else /* DBG */ + +#define TDI_DbgPrint(_t_, _x_) + +#define ASSERT_IRQL(x) +#define ASSERT(x) + +#endif /* DBG */ + + +#define assert(x) ASSERT(x) +#define assert_irql(x) ASSERT_IRQL(x) + + +#ifdef _MSC_VER + +#define UNIMPLEMENTED \ + TDI_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \ + but come back another day.\n", __FILE__, __LINE__)); + +#else /* _MSC_VER */ + +#define UNIMPLEMENTED \ + TDI_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, \ + but come back another day.\n", __FUNCTION__, __FILE__, __LINE__)); + +#endif /* _MSC_VER */ + + +#define CHECKPOINT \ +do { TDI_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0); + +#endif /* __DEBUG_H */ + +/* EOF */ diff --git a/rosapps/net/tditest/include/tditest.h b/rosapps/net/tditest/include/tditest.h new file mode 100644 index 00000000000..d2ddac8c62a --- /dev/null +++ b/rosapps/net/tditest/include/tditest.h @@ -0,0 +1,127 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TDI test driver + * FILE: include/tditest.h + * PURPOSE: Testing TDI drivers + */ +#ifndef __TDITEST_H +#define __TDITEST_H + +#ifdef _MSC_VER +#include +#include +#include +#else +#include +#include +#include +#endif +#include "debug.h" + + +/* Name of UDP device */ +#define UDP_DEVICE_NAME L"\\Device\\Udp" + +#ifdef i386 + +/* DWORD network to host byte order conversion for i386 */ +#define DN2H(dw) \ + ((((dw) & 0xFF000000L) >> 24) | \ + (((dw) & 0x00FF0000L) >> 8) | \ + (((dw) & 0x0000FF00L) << 8) | \ + (((dw) & 0x000000FFL) << 24)) + +/* DWORD host to network byte order conversion for i386 */ +#define DH2N(dw) \ + ((((dw) & 0xFF000000L) >> 24) | \ + (((dw) & 0x00FF0000L) >> 8) | \ + (((dw) & 0x0000FF00L) << 8) | \ + (((dw) & 0x000000FFL) << 24)) + +/* WORD network to host order conversion for i386 */ +#define WN2H(w) \ + ((((w) & 0xFF00) >> 8) | \ + (((w) & 0x00FF) << 8)) + +/* WORD host to network byte order conversion for i386 */ +#define WH2N(w) \ + ((((w) & 0xFF00) >> 8) | \ + (((w) & 0x00FF) << 8)) + +#else /* i386 */ + +/* DWORD network to host byte order conversion for other architectures */ +#define DN2H(dw) \ + (dw) + +/* DWORD host to network byte order conversion for other architectures */ +#define DH2N(dw) \ + (dw) + +/* WORD network to host order conversion for other architectures */ +#define WN2H(w) \ + (w) + +/* WORD host to network byte order conversion for other architectures */ +#define WH2N(w) \ + (w) + +#endif /* i386 */ + + +typedef struct IPSNMP_INFO { + ULONG Forwarding; + ULONG DefaultTTL; + ULONG InReceives; + ULONG InHdrErrors; + ULONG InAddrErrors; + ULONG ForwDatagrams; + ULONG InUnknownProtos; + ULONG InDiscards; + ULONG InDelivers; + ULONG OutRequests; + ULONG RoutingDiscards; + ULONG OutDiscards; + ULONG OutNoRoutes; + ULONG ReasmTimeout; + ULONG ReasmReqds; + ULONG ReasmOks; + ULONG ReasmFails; + ULONG FragOks; + ULONG FragFails; + ULONG FragCreates; + ULONG NumIf; + ULONG NumAddr; + ULONG NumRoutes; +} IPSNMP_INFO, *PIPSNMP_INFO; + +typedef struct IPADDR_ENTRY { + ULONG Addr; + ULONG Index; + ULONG Mask; + ULONG BcastAddr; + ULONG ReasmSize; + USHORT Context; + USHORT Pad; +} IPADDR_ENTRY, *PIPADDR_ENTRY; + + +#define TL_INSTANCE 0 + +#define IP_MIB_STATS_ID 0x1 +#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102 + + +/* IOCTL codes */ +#define IOCTL_TCP_QUERY_INFORMATION_EX \ + CTL_CODE(FILE_DEVICE_NETWORK, 0, METHOD_NEITHER, FILE_ANY_ACCESS) +#define IOCTL_TCP_SET_INFORMATION_EX \ + CTL_CODE(FILE_DEVICE_NETWORK, 1, METHOD_BUFFERED, FILE_WRITE_ACCESS) + + +#define TEST_PORT 2000 + +#endif /*__TDITEST_H */ + +/* EOF */ + diff --git a/rosapps/net/tditest/readme.txt b/rosapps/net/tditest/readme.txt new file mode 100644 index 00000000000..41e6e9c03f4 --- /dev/null +++ b/rosapps/net/tditest/readme.txt @@ -0,0 +1,18 @@ +Build instructions for TDITEST driver +------------------------------------- + +Building with Visual C++ and Windows NT DDK: + +Variables: +%BASEDIR% = path to NT4 DDK (e.g. c:\ntddk) +%DDKBUILDENV% = DDK build environment (free or checked) + +DDK environment variables must be set! (run setenv.bat) + + - Create the directory objects/i386/%DDKBUILDENV% + - Run "build" to build the driver + + +Building with Mingw32 and ReactOS include files: + + - Run "make tditest" FROM THE ReactOS ROOT DIRECTORY to build the driver diff --git a/rosapps/net/tditest/tditest.def b/rosapps/net/tditest/tditest.def new file mode 100644 index 00000000000..2acbb5be174 --- /dev/null +++ b/rosapps/net/tditest/tditest.def @@ -0,0 +1,7 @@ +; TDI test driver - ReactOS Operating System + +LIBRARY TDITEST.SYS + +EXPORTS + +; EOF diff --git a/rosapps/net/tditest/tditest.rc b/rosapps/net/tditest/tditest.rc new file mode 100644 index 00000000000..1c529d8e9f3 --- /dev/null +++ b/rosapps/net/tditest/tditest.rc @@ -0,0 +1,7 @@ +/* $Id$ */ + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "TDI test driver\0" +#define REACTOS_STR_INTERNAL_NAME "tditest\0" +#define REACTOS_STR_ORIGINAL_FILENAME "tditest.sys\0" +#include diff --git a/rosapps/net/tditest/tditest/SOURCES b/rosapps/net/tditest/tditest/SOURCES new file mode 100644 index 00000000000..91ac6a13484 --- /dev/null +++ b/rosapps/net/tditest/tditest/SOURCES @@ -0,0 +1,14 @@ +TARGETNAME=tditest +TARGETPATH=obj +TARGETTYPE=DRIVER + +TARGETLIBS=$(DDK_LIB_PATH)\tdi.lib \ + $(DDK_LIB_PATH)\ndis.lib + +C_DEFINES=$(C_DEFINES) -DDBG + +INCLUDES=..\include;..\..\..\..\include\net;$(BASEDIR)\inc + +SOURCES= tditest.c + +MSC_WARNING_LEVEL=/W3 /WX diff --git a/rosapps/net/tditest/tditest/tditest.c b/rosapps/net/tditest/tditest/tditest.c new file mode 100644 index 00000000000..59f0831b647 --- /dev/null +++ b/rosapps/net/tditest/tditest/tditest.c @@ -0,0 +1,961 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TDI test driver + * FILE: tditest.c + * PURPOSE: Testing TDI drivers + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * Vizzini (vizzini@plasmic.com) + * REVISIONS: + * CSH 01/08-2000 Created + * 26-Nov-2003 Vizzini Updated to run properly on Win2ksp4 + */ +#include + + +#ifdef DBG + +/* See debug.h for debug/trace constants */ +ULONG DebugTraceLevel = -1; + +#endif /* DBG */ + + +HANDLE TdiTransport = 0; +PFILE_OBJECT TdiTransportObject = NULL; +ULONG LocalAddress; +BOOLEAN OpenError; +KEVENT StopEvent; +HANDLE SendThread; +HANDLE ReceiveThread; + +NTSTATUS TdiCall( + PIRP Irp, + PDEVICE_OBJECT DeviceObject, + PIO_STATUS_BLOCK IoStatusBlock, + BOOLEAN CanCancel) +/* + * FUNCTION: Calls a transport driver device + * ARGUMENTS: + * Irp = Pointer to I/O Request Packet + * DeviceObject = Pointer to device object to call + * IoStatusBlock = Address of buffer with I/O status block + * CanCancel = TRUE if the IRP can be cancelled, FALSE if not + * RETURNS: + * Status of operation + * NOTES + * All requests are completed synchronously. A request may be cancelled + */ +{ + KEVENT Event; + PKEVENT Events[2]; + NTSTATUS Status; + Events[0] = &StopEvent; + Events[1] = &Event; + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + Irp->UserEvent = &Event; + Irp->UserIosb = IoStatusBlock; + + Status = IoCallDriver(DeviceObject, Irp); + + if (Status == STATUS_PENDING) + { + if (CanCancel) + { + Status = KeWaitForMultipleObjects(2, (PVOID)Events, WaitAny, Executive, KernelMode, FALSE, NULL, NULL); + + if (KeReadStateEvent(&StopEvent) != 0) + { + if (IoCancelIrp(Irp)) + { + TDI_DbgPrint(MAX_TRACE, ("Cancelled IRP.\n")); + } + else + { + TDI_DbgPrint(MIN_TRACE, ("Could not cancel IRP.\n")); + } + return STATUS_CANCELLED; + } + } + else + Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + } + + return (Status == STATUS_SUCCESS)? IoStatusBlock->Status : STATUS_SUCCESS; +} + + +NTSTATUS TdiOpenDevice( + PWSTR Protocol, + ULONG EaLength, + PFILE_FULL_EA_INFORMATION EaInfo, + PHANDLE Handle, + PFILE_OBJECT *Object) +/* + * FUNCTION: Opens a device + * ARGUMENTS: + * Protocol = Pointer to buffer with name of device + * EaLength = Length of EA information + * EaInfo = Pointer to buffer with EA information + * Handle = Address of buffer to place device handle + * Object = Address of buffer to place device object + * RETURNS: + * Status of operation + */ +{ + OBJECT_ATTRIBUTES Attr; + IO_STATUS_BLOCK Iosb; + UNICODE_STRING Name; + NTSTATUS Status; + + RtlInitUnicodeString(&Name, Protocol); + InitializeObjectAttributes( + &Attr, /* Attribute buffer */ + &Name, /* Device name */ + OBJ_CASE_INSENSITIVE, /* Attributes */ + NULL, /* Root directory */ + NULL); /* Security descriptor */ + + Status = ZwCreateFile( + Handle, /* Return file handle */ + GENERIC_READ | GENERIC_WRITE, /* Desired access */ + &Attr, /* Object attributes */ + &Iosb, /* IO status */ + 0, /* Initial allocation size */ + FILE_ATTRIBUTE_NORMAL, /* File attributes */ + FILE_SHARE_READ | FILE_SHARE_WRITE, /* Share access */ + FILE_OPEN_IF, /* Create disposition */ + 0, /* Create options */ + EaInfo, /* EA buffer */ + EaLength); /* EA length */ + + if (NT_SUCCESS(Status)) + { + Status = ObReferenceObjectByHandle( + *Handle, /* Handle to open file */ + GENERIC_READ | GENERIC_WRITE, /* Access mode */ + NULL, /* Object type */ + KernelMode, /* Access mode */ + (PVOID*)Object, /* Pointer to object */ + NULL); /* Handle information */ + + if (!NT_SUCCESS(Status)) + { + TDI_DbgPrint(MIN_TRACE, ("ObReferenceObjectByHandle() failed with status (0x%X).\n", Status)); + ZwClose(*Handle); + } + } + else + { + TDI_DbgPrint(MIN_TRACE, ("ZwCreateFile() failed with status (0x%X)\n", Status)); + } + + return Status; +} + + +NTSTATUS TdiCloseDevice( + HANDLE Handle, + PFILE_OBJECT FileObject) +{ + if (FileObject) + ObDereferenceObject(FileObject); + + if (Handle) + ZwClose(Handle); + + return STATUS_SUCCESS; +} + + +NTSTATUS TdiOpenTransport( + PWSTR Protocol, + USHORT Port, + PHANDLE Transport, + PFILE_OBJECT *TransportObject) +/* + * FUNCTION: Opens a transport driver + * ARGUMENTS: + * Protocol = Pointer to buffer with name of device + * Port = Port number to use + * Transport = Address of buffer to place transport device handle + * TransportObject = Address of buffer to place transport object + * RETURNS: + * Status of operation + */ +{ + PFILE_FULL_EA_INFORMATION EaInfo; + PTA_IP_ADDRESS Address; + NTSTATUS Status; + ULONG EaLength; + + /* EaName must be 0-termed, even though TDI_TRANSPORT_ADDRESS_LENGTH does *not* include the 0 */ + EaLength = sizeof(FILE_FULL_EA_INFORMATION) + TDI_TRANSPORT_ADDRESS_LENGTH + sizeof(TA_IP_ADDRESS) + 1; + EaInfo = (PFILE_FULL_EA_INFORMATION)ExAllocatePool(NonPagedPool, EaLength); + + if (!EaInfo) + { + TDI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlZeroMemory(EaInfo, EaLength); + + EaInfo->EaNameLength = TDI_TRANSPORT_ADDRESS_LENGTH; + + /* don't copy the 0; we have already zeroed it */ + RtlCopyMemory(EaInfo->EaName, TdiTransportAddress, TDI_TRANSPORT_ADDRESS_LENGTH); + + EaInfo->EaValueLength = sizeof(TA_IP_ADDRESS); + Address = (PTA_IP_ADDRESS)(EaInfo->EaName + TDI_TRANSPORT_ADDRESS_LENGTH + 1); // 0-term + Address->TAAddressCount = 1; + Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP; + Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; + Address->Address[0].Address[0].sin_port = WH2N(Port); + Address->Address[0].Address[0].in_addr = 0; + + Status = TdiOpenDevice(Protocol, EaLength, EaInfo, Transport, TransportObject); + + ExFreePool(EaInfo); + + return Status; +} + + +NTSTATUS TdiQueryDeviceControl( + PFILE_OBJECT FileObject, + ULONG IoControlCode, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength, + PULONG Return) +/* + * FUNCTION: Queries a device for information + * ARGUMENTS: + * FileObject = Pointer to device object + * IoControlCode = I/O control code + * InputBuffer = Pointer to buffer with input data + * InputBufferLength = Length of InputBuffer + * OutputBuffer = Address of buffer to place output data + * OutputBufferLength = Length of OutputBuffer + * RETURNS: + * Status of operation + */ +{ + PDEVICE_OBJECT DeviceObject; + PIO_STACK_LOCATION IoStack; + IO_STATUS_BLOCK Iosb; + NTSTATUS Status; + PIRP Irp; + + DeviceObject = IoGetRelatedDeviceObject(FileObject); + Irp = IoBuildDeviceIoControlRequest(IoControlCode, DeviceObject, InputBuffer, InputBufferLength, OutputBuffer, + OutputBufferLength, FALSE, NULL, NULL); + + if (!Irp) + { + TDI_DbgPrint(MIN_TRACE, ("IoBuildDeviceIoControlRequest() failed.\n")); + return STATUS_INSUFFICIENT_RESOURCES; + } + + IoStack = IoGetNextIrpStackLocation(Irp); + IoStack->DeviceObject = DeviceObject; + IoStack->FileObject = FileObject; + Status = TdiCall(Irp, DeviceObject, &Iosb, FALSE); + + if (Return) + *Return = Iosb.Information; + + return Status; +} + + +NTSTATUS TdiQueryInformationEx( + PFILE_OBJECT FileObject, + ULONG Entity, + ULONG Instance, + ULONG Class, + ULONG Type, + ULONG Id, + PVOID OutputBuffer, + PULONG OutputLength) +/* + * FUNCTION: Extended query for information + * ARGUMENTS: + * FileObject = Pointer to transport object + * Entity = Entity + * Instance = Instance + * Class = Entity class + * Type = Entity type + * Id = Entity id + * OutputBuffer = Address of buffer to place data + * OutputLength = Address of buffer with length of OutputBuffer (updated) + * RETURNS: + * Status of operation + */ +{ + TCP_REQUEST_QUERY_INFORMATION_EX QueryInfo; + + RtlZeroMemory(&QueryInfo, sizeof(TCP_REQUEST_QUERY_INFORMATION_EX)); + QueryInfo.ID.toi_entity.tei_entity = Entity; + QueryInfo.ID.toi_entity.tei_instance = Instance; + QueryInfo.ID.toi_class = Class; + QueryInfo.ID.toi_type = Type; + QueryInfo.ID.toi_id = Id; + + return TdiQueryDeviceControl( + FileObject, /* Transport/connection object */ + IOCTL_TCP_QUERY_INFORMATION_EX, /* Control code */ + &QueryInfo, /* Input buffer */ + sizeof(TCP_REQUEST_QUERY_INFORMATION_EX), /* Input buffer length */ + OutputBuffer, /* Output buffer */ + *OutputLength, /* Output buffer length */ + OutputLength); /* Return information */ +} + + +NTSTATUS TdiQueryAddress( + PFILE_OBJECT FileObject, + PULONG Address) +/* + * FUNCTION: Queries for a local IP address + * ARGUMENTS: + * FileObject = Pointer to file object + * Address = Address of buffer to place local address + * RETURNS: + * Status of operation + */ +{ + ULONG i; + TDIEntityID *Entities; + ULONG EntityCount; + ULONG EntityType; + IPSNMP_INFO SnmpInfo; + PIPADDR_ENTRY IpAddress; + ULONG BufferSize; + NTSTATUS Status = STATUS_SUCCESS; + + TDI_DbgPrint(MAX_TRACE, ("Called\n")); + + BufferSize = sizeof(TDIEntityID) * 20; + Entities = (TDIEntityID*)ExAllocatePool(NonPagedPool, BufferSize); + + if (!Entities) + { + TDI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Query device for supported entities */ + Status = TdiQueryInformationEx( + FileObject, /* File object */ + GENERIC_ENTITY, /* Entity */ + TL_INSTANCE, /* Instance */ + INFO_CLASS_GENERIC, /* Entity class */ + INFO_TYPE_PROVIDER, /* Entity type */ + ENTITY_LIST_ID, /* Entity id */ + Entities, /* Output buffer */ + &BufferSize); /* Output buffer size */ + + if (!NT_SUCCESS(Status)) + { + TDI_DbgPrint(MIN_TRACE, ("Unable to get list of supported entities (Status = 0x%X).\n", Status)); + ExFreePool(Entities); + return Status; + } + + /* Locate an IP entity */ + EntityCount = BufferSize / sizeof(TDIEntityID); + + TDI_DbgPrint(MAX_TRACE, ("EntityCount = %d\n", EntityCount)); + + for (i = 0; i < EntityCount; i++) + { + if (Entities[i].tei_entity == CL_NL_ENTITY) + { + /* Query device for entity type */ + BufferSize = sizeof(EntityType); + Status = TdiQueryInformationEx( + FileObject, /* File object */ + CL_NL_ENTITY, /* Entity */ + Entities[i].tei_instance, /* Instance */ + INFO_CLASS_GENERIC, /* Entity class */ + INFO_TYPE_PROVIDER, /* Entity type */ + ENTITY_TYPE_ID, /* Entity id */ + &EntityType, /* Output buffer */ + &BufferSize); /* Output buffer size */ + + if (!NT_SUCCESS(Status) || (EntityType != CL_NL_IP)) + { + TDI_DbgPrint(MIN_TRACE, ("Unable to get entity of type IP (Status = 0x%X).\n", Status)); + break; + } + + /* Query device for SNMP information */ + BufferSize = sizeof(SnmpInfo); + Status = TdiQueryInformationEx( + FileObject, /* File object */ + CL_NL_ENTITY, /* Entity */ + Entities[i].tei_instance, /* Instance */ + INFO_CLASS_PROTOCOL, /* Entity class */ + INFO_TYPE_PROVIDER, /* Entity type */ + IP_MIB_STATS_ID, /* Entity id */ + &SnmpInfo, /* Output buffer */ + &BufferSize); /* Output buffer size */ + + if (!NT_SUCCESS(Status) || (SnmpInfo.NumAddr == 0)) + { + TDI_DbgPrint(MIN_TRACE, ("Unable to get SNMP information or no IP addresses available (Status = 0x%X).\n", Status)); + break; + } + + /* Query device for all IP addresses */ + if (SnmpInfo.NumAddr != 0) + { + BufferSize = SnmpInfo.NumAddr * sizeof(IPADDR_ENTRY); + IpAddress = (PIPADDR_ENTRY)ExAllocatePool(NonPagedPool, BufferSize); + if (!IpAddress) + { + TDI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); + break; + } + + Status = TdiQueryInformationEx( + FileObject, /* File object */ + CL_NL_ENTITY, /* Entity */ + Entities[i].tei_instance, /* Instance */ + INFO_CLASS_PROTOCOL, /* Entity class */ + INFO_TYPE_PROVIDER, /* Entity type */ + IP_MIB_ADDRTABLE_ENTRY_ID, /* Entity id */ + IpAddress, /* Output buffer */ + &BufferSize); /* Output buffer size */ + + if (!NT_SUCCESS(Status)) + { + TDI_DbgPrint(MIN_TRACE, ("Unable to get IP address (Status = 0x%X).\n", Status)); + ExFreePool(IpAddress); + break; + } + + if (SnmpInfo.NumAddr != 1) + { + /* Skip loopback address */ + *Address = DN2H(((PIPADDR_ENTRY)((ULONG)IpAddress + sizeof(IPADDR_ENTRY)))->Addr); + } + else + { + /* Select the first address returned */ + *Address = DN2H(IpAddress->Addr); + } + ExFreePool(IpAddress); + + } + else + { + Status = STATUS_UNSUCCESSFUL; + break; + } + } + } + + ExFreePool(Entities); + + TDI_DbgPrint(MAX_TRACE, ("Leaving\n")); + + return Status; +} + + +NTSTATUS TdiSendDatagram( + PFILE_OBJECT TransportObject, + USHORT Port, + ULONG Address, + PVOID Buffer, + ULONG BufferSize) +/* + * FUNCTION: Sends a datagram + * ARGUMENTS: + * TransportObject = Pointer to transport object + * Port = Remote port + * Address = Remote address + * Buffer = Pointer to buffer with data to send + * BufferSize = Length of Buffer + * RETURNS: + * Status of operation + */ +{ + PIRP Irp; + PMDL Mdl; + PDEVICE_OBJECT DeviceObject; + PTDI_CONNECTION_INFORMATION ConnectInfo; + PTA_IP_ADDRESS TA; + PTDI_ADDRESS_IP IpAddress; + IO_STATUS_BLOCK Iosb; + NTSTATUS Status; + + DeviceObject = IoGetRelatedDeviceObject(TransportObject); + ConnectInfo = (PTDI_CONNECTION_INFORMATION) + ExAllocatePool(NonPagedPool, + sizeof(TDI_CONNECTION_INFORMATION) + + sizeof(TA_IP_ADDRESS)); + + if (!ConnectInfo) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlZeroMemory(ConnectInfo, sizeof(TDI_CONNECTION_INFORMATION) + sizeof(TA_IP_ADDRESS)); + + ConnectInfo->RemoteAddressLength = sizeof(TA_IP_ADDRESS); + ConnectInfo->RemoteAddress = (PUCHAR) ((ULONG)ConnectInfo + sizeof(TDI_CONNECTION_INFORMATION)); + + TA = (PTA_IP_ADDRESS)(ConnectInfo->RemoteAddress); + TA->TAAddressCount = 1; + TA->Address[0].AddressLength = sizeof(TDI_ADDRESS_IP); + TA->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; + IpAddress = (PTDI_ADDRESS_IP)(TA->Address[0].Address); + IpAddress->sin_port = WH2N(Port); + IpAddress->in_addr = DH2N(Address); + Irp = TdiBuildInternalDeviceControlIrp( + TDI_SEND_DATAGRAM, /* Sub function */ + DeviceObject, /* Device object */ + TransportObject, /* File object */ + NULL, /* Event */ + NULL); /* Return buffer */ + + if (!Irp) + { + TDI_DbgPrint(MIN_TRACE, ("TdiBuildInternalDeviceControlIrp() failed.\n")); + ExFreePool(ConnectInfo); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Mdl = IoAllocateMdl( + Buffer, /* Virtual address of buffer */ + BufferSize, /* Length of buffer */ + FALSE, /* Not secondary */ + FALSE, /* Don't charge quota */ + NULL); /* Don't use IRP */ + + if (!Mdl) + { + TDI_DbgPrint(MIN_TRACE, ("IoAllocateMdl() failed.\n")); + IoFreeIrp(Irp); + ExFreePool(ConnectInfo); + return STATUS_INSUFFICIENT_RESOURCES; + } + +#ifdef _MSC_VER + try + { +#endif + MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess); +#ifdef _MSC_VER + } + except(EXCEPTION_EXECUTE_HANDLER) + { + TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); + IoFreeMdl(Mdl); + IoFreeIrp(Irp); + ExFreePool(ConnectInfo); + return STATUS_UNSUCCESSFUL; + } +#endif + + TdiBuildSendDatagram( + Irp, /* I/O Request Packet */ + DeviceObject, /* Device object */ + TransportObject, /* File object */ + NULL, /* Completion routine */ + NULL, /* Completion context */ + Mdl, /* Descriptor for data buffer */ + BufferSize, /* Size of data to send */ + ConnectInfo); /* Connection information */ + + Status = TdiCall(Irp, DeviceObject, &Iosb, FALSE); + + ExFreePool(ConnectInfo); + + return Status; +} + + +NTSTATUS TdiReceiveDatagram( + PFILE_OBJECT TransportObject, + USHORT Port, + PULONG Address, + PUCHAR Buffer, + PULONG BufferSize) +/* + * FUNCTION: Receives a datagram + * ARGUMENTS: + * TransportObject = Pointer to transport object + * Port = Port to receive on + * Address = Address of buffer to place remote address + * Buffer = Address of buffer to place received data + * BufferSize = Address of buffer with length of Buffer (updated) + * RETURNS: + * Status of operation + */ +{ + PTDI_CONNECTION_INFORMATION ReceiveInfo; + PTDI_CONNECTION_INFORMATION ReturnInfo; + PTA_IP_ADDRESS ReturnAddress; + PDEVICE_OBJECT DeviceObject; + PTDI_ADDRESS_IP IpAddress; + IO_STATUS_BLOCK Iosb; + PVOID MdlBuffer; + NTSTATUS Status; + PIRP Irp; + PMDL Mdl; + + DeviceObject = IoGetRelatedDeviceObject(TransportObject); + if (!DeviceObject) + return STATUS_INVALID_PARAMETER; + + ReceiveInfo = (PTDI_CONNECTION_INFORMATION) ExAllocatePool(NonPagedPool, + sizeof(TDI_CONNECTION_INFORMATION) + + sizeof(TDI_CONNECTION_INFORMATION) + + sizeof(TA_IP_ADDRESS)); + + if (!ReceiveInfo) + return STATUS_INSUFFICIENT_RESOURCES; + + MdlBuffer = ExAllocatePool(PagedPool, *BufferSize); + if (!MdlBuffer) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlZeroMemory(ReceiveInfo, sizeof(TDI_CONNECTION_INFORMATION) + sizeof(TDI_CONNECTION_INFORMATION) + + sizeof(TA_IP_ADDRESS)); + + RtlCopyMemory(MdlBuffer, Buffer, *BufferSize); + + /* Receive from any address */ + ReceiveInfo->RemoteAddressLength = 0; + ReceiveInfo->RemoteAddress = NULL; + + ReturnInfo = (PTDI_CONNECTION_INFORMATION) ((ULONG)ReceiveInfo + sizeof(TDI_CONNECTION_INFORMATION)); + ReturnInfo->RemoteAddressLength = sizeof(TA_IP_ADDRESS); + ReturnInfo->RemoteAddress = (PUCHAR) ((ULONG)ReturnInfo + sizeof(TDI_CONNECTION_INFORMATION)); + + ReturnAddress = (PTA_IP_ADDRESS)(ReturnInfo->RemoteAddress); + ReturnAddress->TAAddressCount = 1; + ReturnAddress->Address[0].AddressLength = sizeof(TDI_ADDRESS_IP); + ReturnAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; + + IpAddress = (PTDI_ADDRESS_IP)(ReturnAddress->Address[0].Address); + IpAddress->sin_port = WH2N(Port); + IpAddress->in_addr = DH2N(LocalAddress); + + Irp = TdiBuildInternalDeviceControlIrp( + TDI_RECEIVE_DATAGRAM, /* Sub function */ + DeviceObject, /* Device object */ + TransportObject, /* File object */ + NULL, /* Event */ + NULL); /* Return buffer */ + + if (!Irp) + { + ExFreePool(MdlBuffer); + ExFreePool(ReceiveInfo); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Mdl = IoAllocateMdl( + MdlBuffer, /* Virtual address */ + *BufferSize, /* Length of buffer */ + FALSE, /* Not secondary */ + FALSE, /* Don't charge quota */ + NULL); /* Don't use IRP */ + + if (!Mdl) + { + IoFreeIrp(Irp); + ExFreePool(MdlBuffer); + ExFreePool(ReceiveInfo); + return STATUS_INSUFFICIENT_RESOURCES; + } + +#ifdef _MSC_VER + try + { +#endif + MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess); +#ifdef _MSC_VER + } + except (EXCEPTION_EXECUTE_HANDLER) + { + TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); + IoFreeMdl(Mdl); + IoFreeIrp(Irp); + ExFreePool(MdlBuffer); + ExFreePool(ReceiveInfo); + return STATUS_INSUFFICIENT_RESOURCES; + } +#endif + + TdiBuildReceiveDatagram( + Irp, /* I/O Request Packet */ + DeviceObject, /* Device object */ + TransportObject, /* File object */ + NULL, /* Completion routine */ + NULL, /* Completion context */ + Mdl, /* Data buffer */ + *BufferSize, /* Size of data buffer */ + ReceiveInfo, /* Connection information */ + ReturnInfo, /* Connection information */ + TDI_RECEIVE_NORMAL); /* Flags */ + + Status = TdiCall(Irp, DeviceObject, &Iosb, TRUE); + + if (NT_SUCCESS(Status)) + { + RtlCopyMemory(Buffer, MdlBuffer, Iosb.Information); + *BufferSize = Iosb.Information; + *Address = DN2H(IpAddress->in_addr); + } + + ExFreePool(MdlBuffer); + ExFreePool(ReceiveInfo); + + return Status; +} + + +VOID TdiSendThread( + PVOID Context) +/* + * FUNCTION: Send thread + * ARGUMENTS: + * Context = Pointer to context information + * NOTES: + * Transmits an UDP packet every two seconds to ourselves on the chosen port + */ +{ + KEVENT Event; + PKEVENT Events[2]; + LARGE_INTEGER Timeout; + NTSTATUS Status = STATUS_SUCCESS; + UCHAR Data[40] = "Testing one, two, three, ..."; + + if (!OpenError) + { + Timeout.QuadPart = 10000000L; /* Second factor */ + Timeout.QuadPart *= 2; /* Number of seconds */ + Timeout.QuadPart = -(Timeout.QuadPart); /* Relative time */ + + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + + Events[0] = &StopEvent; + Events[1] = &Event; + + while (NT_SUCCESS(Status)) + { + /* Wait until timeout or stop flag is set */ + KeWaitForMultipleObjects( 2, (PVOID)Events, WaitAny, Executive, KernelMode, FALSE, &Timeout, NULL); + + if (KeReadStateEvent(&StopEvent) != 0) + { + TDI_DbgPrint(MAX_TRACE, ("Received terminate signal...\n")); + break; + } + + DbgPrint("Sending data - '%s'\n", Data); + + Status = TdiSendDatagram(TdiTransportObject, TEST_PORT, LocalAddress, Data, sizeof(Data)); + + if (!NT_SUCCESS(Status)) + DbgPrint("Failed sending data (Status = 0x%X)\n", Status); + } + } + + TDI_DbgPrint(MAX_TRACE, ("Terminating send thread...\n")); + + PsTerminateSystemThread(STATUS_SUCCESS); +} + + +VOID TdiReceiveThread( + PVOID Context) +/* + * FUNCTION: Receive thread + * ARGUMENTS: + * Context = Pointer to context information + * NOTES: + * Waits until an UDP packet is received on the chosen endpoint and displays the data + */ +{ + ULONG Address; + UCHAR Data[40]; + ULONG Size; + NTSTATUS Status = STATUS_SUCCESS; + + if (!OpenError) + { + while (NT_SUCCESS(Status)) + { + Size = sizeof(Data); + RtlZeroMemory(Data, Size); + + Status = TdiReceiveDatagram(TdiTransportObject, TEST_PORT, &Address, Data, &Size); + + if (NT_SUCCESS(Status)) + { + DbgPrint("Received data - '%s'\n", Data); + } + else + if (Status != STATUS_CANCELLED) + { + TDI_DbgPrint(MIN_TRACE, ("Receive error (Status = 0x%X).\n", Status)); + } + else + { + TDI_DbgPrint(MAX_TRACE, ("IRP was cancelled.\n")); + } + } + } + + TDI_DbgPrint(MAX_TRACE, ("Terminating receive thread...\n")); + + PsTerminateSystemThread(STATUS_SUCCESS); +} + + +VOID TdiOpenThread( + PVOID Context) +/* + * FUNCTION: Open thread + * ARGUMENTS: + * Context = Pointer to context information (event) + */ +{ + NTSTATUS Status; + + TDI_DbgPrint(MAX_TRACE, ("Called.\n")); + + OpenError = TRUE; + + Status = TdiOpenTransport(UDP_DEVICE_NAME, TEST_PORT, &TdiTransport, &TdiTransportObject); + + if (NT_SUCCESS(Status)) + { + Status = TdiQueryAddress(TdiTransportObject, &LocalAddress); + + if (NT_SUCCESS(Status)) + { + OpenError = FALSE; + DbgPrint("Using local IP address 0x%X\n", LocalAddress); + } + else + { + TDI_DbgPrint(MIN_TRACE, ("Unable to determine local IP address.\n")); + } + } + else + TDI_DbgPrint(MIN_TRACE, ("Cannot open transport (Status = 0x%X).\n", Status)); + + TDI_DbgPrint(MAX_TRACE, ("Setting close event.\n")); + + KeSetEvent((PKEVENT)Context, 0, FALSE); + + TDI_DbgPrint(MIN_TRACE, ("Leaving.\n")); +} + + +VOID TdiUnload( + PDRIVER_OBJECT DriverObject) +/* + * FUNCTION: Unload routine + * ARGUMENTS: + * DriverObject = Pointer to a driver object for this driver + */ +{ + PVOID ReceiveThreadObject = 0; + PVOID SendThreadObject = 0; + + TDI_DbgPrint(MAX_TRACE, ("Setting stop flag\n")); + + /* Get pointers to the thread objects */ + ObReferenceObjectByHandle(SendThread, THREAD_ALL_ACCESS, NULL, KernelMode, &SendThreadObject, NULL); + ObReferenceObjectByHandle(ReceiveThread, THREAD_ALL_ACCESS, NULL, KernelMode, &ReceiveThreadObject, NULL); + + KeSetEvent(&StopEvent, 0, FALSE); + + /* Wait for send thread to stop */ + KeWaitForSingleObject(SendThreadObject, Executive, KernelMode, FALSE, NULL); + + /* Wait for receive thread to stop */ + KeWaitForSingleObject(ReceiveThreadObject, Executive, KernelMode, FALSE, NULL); + + /* Close device */ + TdiCloseDevice(TdiTransport, TdiTransportObject); +} + + +NTSTATUS +#ifndef _MSC_VER +STDCALL +#endif +DriverEntry( + PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Main driver entry point + * ARGUMENTS: + * DriverObject = Pointer to a driver object for this driver + * RegistryPath = Registry node for configuration parameters + * RETURNS: + * Status of driver initialization + */ +{ + KEVENT Event; + NTSTATUS Status; + WORK_QUEUE_ITEM WorkItem; + + KeInitializeEvent(&StopEvent, NotificationEvent, FALSE); + + /* Call TdiOpenThread() */ + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + ExInitializeWorkItem(&WorkItem, TdiOpenThread, &Event); + ExQueueWorkItem(&WorkItem, DelayedWorkQueue); + KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, NULL); + + /* Create a UDP send thread that sends a dgram every 2 seconds */ + Status = PsCreateSystemThread( + &SendThread, /* Thread handle */ + 0, /* Desired access */ + NULL, /* Object attributes */ + NULL, /* Process handle */ + NULL, /* Client id */ + (PKSTART_ROUTINE)TdiSendThread, /* Start routine */ + NULL); /* Start context */ + + if (!NT_SUCCESS(Status)) + { + TDI_DbgPrint(MIN_TRACE, ("PsCreateSystemThread() failed for send thread (Status = 0x%X).\n", Status)); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Create a UDP receive thread */ + Status = PsCreateSystemThread( + &ReceiveThread, /* Thread handle */ + 0, /* Desired access */ + NULL, /* Object attributes */ + NULL, /* Process handle */ + NULL, /* Client id */ + (PKSTART_ROUTINE)TdiReceiveThread, /* Start routine */ + NULL); /* Start context */ + + if (!NT_SUCCESS(Status)) + { + TDI_DbgPrint(MIN_TRACE, ("PsCreateSystemThread() failed for receive thread (Status = 0x%X).\n", Status)); + ZwClose(SendThread); + return STATUS_INSUFFICIENT_RESOURCES; + } + + DriverObject->DriverUnload = (PDRIVER_UNLOAD)TdiUnload; + + return STATUS_SUCCESS; +} + +/* EOF */ + diff --git a/rosapps/ramdrv/minix/bitops.c b/rosapps/ramdrv/minix/bitops.c new file mode 100644 index 00000000000..2acabaf041e --- /dev/null +++ b/rosapps/ramdrv/minix/bitops.c @@ -0,0 +1,203 @@ +/* + * ReactOS kernel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 1992, Linus Torvalds. + */ +/* + * These have to be done with inline assembly: that way the bit-setting + * is guaranteed to be atomic. All bit operations return 0 if the bit + * was cleared before the operation and != 0 if it was not. + * + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +#ifdef __SMP__ +#define LOCK_PREFIX "lock ; " +#else +#define LOCK_PREFIX "" +#endif + +/* + * Function prototypes to keep gcc -Wall happy + */ +extern void set_bit(int nr, volatile void * addr); +extern void clear_bit(int nr, volatile void * addr); +extern void change_bit(int nr, volatile void * addr); +extern int test_and_set_bit(int nr, volatile void * addr); +extern int test_and_clear_bit(int nr, volatile void * addr); +extern int test_and_change_bit(int nr, volatile void * addr); +extern int __constant_test_bit(int nr, const volatile void * addr); +extern int __test_bit(int nr, volatile void * addr); +extern int find_first_zero_bit(void * addr, unsigned size); +extern int find_next_zero_bit (void * addr, int size, int offset); +extern unsigned long ffz(unsigned long word); + +/* + * Some hacks to defeat gcc over-optimizations.. + */ +struct __dummy { unsigned long a[100]; }; +#define ADDR (*(volatile struct __dummy *) addr) +#define CONST_ADDR (*(volatile const struct __dummy *) addr) + +void set_bit(int nr, volatile void * addr) +{ + __asm__ __volatile__( LOCK_PREFIX + "btsl %1,%0" + :"=m" (ADDR) + :"Ir" (nr)); +} + +void clear_bit(int nr, volatile void * addr) +{ + __asm__ __volatile__( LOCK_PREFIX + "btrl %1,%0" + :"=m" (ADDR) + :"Ir" (nr)); +} + +void change_bit(int nr, volatile void * addr) +{ + __asm__ __volatile__( LOCK_PREFIX + "btcl %1,%0" + :"=m" (ADDR) + :"Ir" (nr)); +} + +int test_and_set_bit(int nr, volatile void * addr) +{ + int oldbit; + + __asm__ __volatile__( LOCK_PREFIX + "btsl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"Ir" (nr)); + return oldbit; +} + +int test_and_clear_bit(int nr, volatile void * addr) +{ + int oldbit; + + __asm__ __volatile__( LOCK_PREFIX + "btrl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"Ir" (nr)); + return oldbit; +} + +int test_and_change_bit(int nr, volatile void * addr) +{ + int oldbit; + + __asm__ __volatile__( LOCK_PREFIX + "btcl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"Ir" (nr)); + return oldbit; +} + +/* + * This routine doesn't need to be atomic. + */ +int __constant_test_bit(int nr, const volatile void * addr) +{ + return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; +} + +int test_bit(int nr, volatile void * addr) +{ + int oldbit; + + __asm__ __volatile__( + "btl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit) + :"m" (ADDR),"Ir" (nr)); + return oldbit; +} + +#if 0 +#define test_bit(nr,addr) \ +(__builtin_constant_p(nr) ? \ + __constant_test_bit((nr),(addr)) : \ + __test_bit((nr),(addr))) +#endif + +/* + * Find-bit routines.. + */ +int find_first_zero_bit(void * addr, unsigned size) +{ + int d0, d1, d2; + int res; + + if (!size) + return 0; + __asm__("cld\n\t" + "movl $-1,%%eax\n\t" + "xorl %%edx,%%edx\n\t" + "repe; scasl\n\t" + "je 1f\n\t" + "xorl -4(%%edi),%%eax\n\t" + "subl $4,%%edi\n\t" + "bsfl %%eax,%%edx\n" + "1:\tsubl %%ebx,%%edi\n\t" + "shll $3,%%edi\n\t" + "addl %%edi,%%edx" + :"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2) + :"1" ((size + 31) >> 5), "2" (addr), "b" (addr)); + return res; +} + +int find_next_zero_bit (void * addr, int size, int offset) +{ + unsigned long * p = ((unsigned long *) addr) + (offset >> 5); + int set = 0, bit = offset & 31, res; + + if (bit) { + /* + * Look for zero in first byte + */ + __asm__("bsfl %1,%0\n\t" + "jne 1f\n\t" + "movl $32, %0\n" + "1:" + : "=r" (set) + : "r" (~(*p >> bit))); + if (set < (32 - bit)) + return set + offset; + set = 32 - bit; + p++; + } + /* + * No zero yet, search remaining full bytes for a zero + */ + res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr)); + return (offset + set + res); +} + +/* + * ffz = Find First Zero in word. Undefined if no zero exists, + * so code should check against ~0UL first.. + */ +unsigned long ffz(unsigned long word) +{ + __asm__("bsfl %1,%0" + :"=r" (word) + :"r" (~word)); + return word; +} diff --git a/rosapps/ramdrv/minix/bitops.h b/rosapps/ramdrv/minix/bitops.h new file mode 100644 index 00000000000..7c0123bbd3a --- /dev/null +++ b/rosapps/ramdrv/minix/bitops.h @@ -0,0 +1,30 @@ +#ifndef _I386_BITOPS_H +#define _I386_BITOPS_H + +/* + * Copyright 1992, Linus Torvalds. + */ + +/* + * These have to be done with inline assembly: that way the bit-setting + * is guaranteed to be atomic. All bit operations return 0 if the bit + * was cleared before the operation and != 0 if it was not. + * + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +/* + * Function prototypes to keep gcc -Wall happy + */ +extern void set_bit(int nr, volatile void * addr); +extern void clear_bit(int nr, volatile void * addr); +extern void change_bit(int nr, volatile void * addr); +extern int test_and_set_bit(int nr, volatile void * addr); +extern int test_and_clear_bit(int nr, volatile void * addr); +extern int test_and_change_bit(int nr, volatile void * addr); +extern int test_bit(int nr, volatile void * addr); +extern int find_first_zero_bit(void * addr, unsigned size); +extern int find_next_zero_bit (void * addr, int size, int offset); +extern unsigned long ffz(unsigned long word); + +#endif /* _I386_BITOPS_H */ diff --git a/rosapps/ramdrv/minix/block.c b/rosapps/ramdrv/minix/block.c new file mode 100644 index 00000000000..33b6813d310 --- /dev/null +++ b/rosapps/ramdrv/minix/block.c @@ -0,0 +1,109 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/minix.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include + +//#define NDEBUG +#include + +#include "minix.h" + +/* FUNCTIONS ****************************************************************/ + +static unsigned int MinixGetBlock(PDEVICE_OBJECT DeviceObject, + PMINIX_DEVICE_EXTENSION DeviceExt, + struct minix_inode* inode, + ULONG FileOffset) +{ + int block; + PVOID BaseAddress; + ULONG blk; + + blk = FileOffset / BLOCKSIZE; + + DPRINT("MinixGetBlock(inode %x, blk %d)\n",inode,blk); + + /* + * The first few blocks are available in the inode + */ + if (blk < 7) + { + block = inode->i_zone[blk]; + return(block); + } + blk = blk - 7; + + /* + * Retrieve a single-indirect block + */ + if (blk < 512) + { + block = inode->i_zone[7]; + + BaseAddress = ExAllocatePool(NonPagedPool, 512); + + MinixReadSector(DeviceObject, + block, + BaseAddress); + + block = ((PUSHORT)(BaseAddress))[blk]; + + ExFreePool(BaseAddress); + + return(block); + } + + /* + * Get a double indirect block + */ + blk = blk - 512; + block = inode->i_zone[8]; + + BaseAddress = ExAllocatePool(NonPagedPool, 512); + + MinixReadSector(DeviceObject, + block, + BaseAddress); + + block = ((PUSHORT)BaseAddress)[(blk>>9)&511]; + + ExFreePool(BaseAddress); + + + BaseAddress = ExAllocatePool(NonPagedPool, 512); + + MinixReadSector(DeviceObject, + block, + BaseAddress); + + block = ((PUSHORT)BaseAddress)[blk&512]; + + ExFreePool(BaseAddress); + + return(block); +} + +NTSTATUS MinixReadBlock(PDEVICE_OBJECT DeviceObject, + PMINIX_DEVICE_EXTENSION DeviceExt, + struct minix_inode* inode, + ULONG FileOffset, + PULONG DiskOffset) +{ + unsigned int block; + + DPRINT("MinixReadBlock()\n"); + + block = MinixGetBlock(DeviceObject, DeviceExt,inode, FileOffset); + + (*DiskOffset) = block * BLOCKSIZE; + + return(STATUS_SUCCESS); +} diff --git a/rosapps/ramdrv/minix/blockdev.c b/rosapps/ramdrv/minix/blockdev.c new file mode 100644 index 00000000000..387280d305d --- /dev/null +++ b/rosapps/ramdrv/minix/blockdev.c @@ -0,0 +1,154 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/minix.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +#define NDEBUG +#include + +#include "minix.h" + +/* FUNCTIONS ***************************************************************/ + +BOOLEAN MinixReadPage(PDEVICE_OBJECT DeviceObject, + ULONG Offset, + PVOID Buffer) +{ + ULONG i; + BOOLEAN Result; + + for (i=0; i<4; i++) + { + Result = MinixReadSector(DeviceObject, + (Offset + (i * PAGE_SIZE)) / BLOCKSIZE, + (Buffer + (i * PAGE_SIZE))); + if (!Result) + { + return(Result); + } + } + return(TRUE); +} + +BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN PVOID Buffer) +{ + LARGE_INTEGER sectorNumber; + PIRP irp; + IO_STATUS_BLOCK ioStatus; + KEVENT event; + NTSTATUS status; + ULONG sectorSize; + PULONG mbr; + + DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); + + sectorNumber.u.HighPart = 0; + sectorNumber.u.LowPart = DiskSector * BLOCKSIZE; + + KeInitializeEvent(&event, NotificationEvent, FALSE); + + sectorSize = BLOCKSIZE; + + mbr = ExAllocatePool(NonPagedPool, sectorSize); + + if (!mbr) { + return FALSE; + } + + + irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, + pDeviceObject, + mbr, + sectorSize, + §orNumber, + &event, + &ioStatus ); + + if (!irp) { + ExFreePool(mbr); + return FALSE; + } + + status = IoCallDriver(pDeviceObject, + irp); + + if (status == STATUS_PENDING) { + KeWaitForSingleObject(&event, + Suspended, + KernelMode, + FALSE, + NULL); + status = ioStatus.Status; + } + + if (!NT_SUCCESS(status)) { + ExFreePool(mbr); + return FALSE; + } + + RtlCopyMemory(Buffer,mbr,sectorSize); + + ExFreePool(mbr); + return TRUE; +} + +BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN PVOID Buffer) +{ + LARGE_INTEGER sectorNumber; + PIRP irp; + IO_STATUS_BLOCK ioStatus; + KEVENT event; + NTSTATUS status; + ULONG sectorSize; + + DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n", + pDeviceObject,DiskSector,Buffer); + + sectorNumber.u.HighPart = 0; + sectorNumber.u.LowPart = DiskSector * BLOCKSIZE; + + KeInitializeEvent(&event, NotificationEvent, FALSE); + + sectorSize = BLOCKSIZE; + + irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE, + pDeviceObject, + Buffer, + sectorSize, + §orNumber, + &event, + &ioStatus ); + + + status = IoCallDriver(pDeviceObject, + irp); + + if (status == STATUS_PENDING) { + KeWaitForSingleObject(&event, + Suspended, + KernelMode, + FALSE, + NULL); + status = ioStatus.Status; + } + + if (!NT_SUCCESS(status)) { + return FALSE; + } + + return TRUE; +} diff --git a/rosapps/ramdrv/minix/cache.c b/rosapps/ramdrv/minix/cache.c new file mode 100644 index 00000000000..417932ca76c --- /dev/null +++ b/rosapps/ramdrv/minix/cache.c @@ -0,0 +1,45 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/cache.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +//#define NDEBUG +#include + +#include "minix.h" + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS MinixRequestCacheBlock(PDEVICE_OBJECT DeviceObject, + PBCB Bcb, + ULONG FileOffset, + PVOID* BaseAddress, + PCACHE_SEGMENT* CacheSeg) +{ + BOOLEAN UptoDate; + + CcRosRequestCacheSegment(Bcb, + FileOffset, + BaseAddress, + &UptoDate, + CacheSeg); + if (!UptoDate) + { + MinixReadPage(DeviceObject, + PAGE_ROUND_DOWN(FileOffset), + BaseAddress); + } + BaseAddress = BaseAddress + (FileOffset % PAGE_SIZE); + + return(STATUS_SUCCESS); +} + diff --git a/rosapps/ramdrv/minix/dir.c b/rosapps/ramdrv/minix/dir.c new file mode 100644 index 00000000000..0b727c3f6dc --- /dev/null +++ b/rosapps/ramdrv/minix/dir.c @@ -0,0 +1,234 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/minix.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +//#define NDEBUG +#include + +#include "minix.h" + +/* FUNCTIONS ****************************************************************/ + +BOOLEAN MinixCompareUnicodeStringToAnsi(PCH AnsiStr, + PWCHAR UnicodeStr, + ULONG MaxLen) +{ + unsigned int i = 0; + + while (ii_size/MINIX_DIR_ENTRY_SIZE);i++) + { + CHECKPOINT; + offset = i*MINIX_DIR_ENTRY_SIZE; + if ((offset%BLOCKSIZE)==0) + { + MinixReadBlock(DeviceObject, + DeviceExt, + dir, + offset/BLOCKSIZE, + &DiskOffset); + MinixReadSector(DeviceObject, + DiskOffset, + Block); + } + current_entry = (struct minix_dir_entry *) + (Block+offset%BLOCKSIZE); + DPRINT("Inode %x Name %.30s\n",current_entry->inode, + current_entry->name); + if (MinixCompareUnicodeStringToAnsi(current_entry->name, + Name,30)) + { + inode = current_entry->inode; + ExFreePool(Block); + DPRINT("MinixDirLookup() = %d\n",inode); + return(inode); + } + } + CHECKPOINT; + ExFreePool(Block); + DPRINT("MinixDirLookup() = %d\n",0); + return(0); +} + +NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject, + MINIX_DEVICE_EXTENSION* DeviceExt, + PFILE_OBJECT FileObject, + PMINIX_FSCONTEXT result, + PULONG Information) +{ + PWSTR current; + PWSTR next; + PWSTR string; + struct minix_inode current_dir; + unsigned int current_ino; + + string = ExAllocatePool(NonPagedPool, + 2*(wcslen(FileObject->FileName.Buffer)+1)); + wcscpy(string, FileObject->FileName.Buffer); + + DbgPrint("MinixOpen(DeviceObject %x, DeviceName %S, result %x)\n", + DeviceObject,string,result); + + + next = &string[0]; + current = next+1; + + current_ino = MINIX_ROOT_INO; + + while (next != NULL && current_ino != 0) + { + MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir); + + DPRINT("current %S next %x\n",current,next); + + *next = '\\'; + current = next+1; + next = wcschr(next+1,'\\'); + if (next!=NULL) + { + *next=0; + } + + current_ino = MinixDirLookup(DeviceExt, + DeviceObject, + ¤t_dir, + current); + } + if (next == NULL && current_ino != 0) + { + MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir); + } + else + { + (*Information) = FILE_DOES_NOT_EXIST; + return(STATUS_UNSUCCESSFUL); + } + + result = ExAllocatePool(NonPagedPool, sizeof(MINIX_FSCONTEXT)); + memcpy(&result->inode,¤t_dir,sizeof(struct minix_inode)); + + DPRINT("MinxOpen() = STATUS_SUCCESS\n",0); + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +MinixClose(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + + DPRINT("MinixClose(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + ExFreePool(FileObject->FsContext); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +MinixDirectoryControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); +// PFILE_OBJECT FileObject = Stack->FileObject; + + if (Stack->MinorFunction != IRP_MN_QUERY_DIRECTORY) + { + return(STATUS_NOT_IMPLEMENTED); + } + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +MinixCreate(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + NTSTATUS Status; + PMINIX_FSCONTEXT result; + MINIX_DEVICE_EXTENSION* DeviceExt; + + DPRINT("MinixCreate(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); + DPRINT("Opening file %x %S\n",FileObject->FileName.Buffer, + FileObject->FileName.Buffer); + DPRINT("FileObject->FileName.Buffer %x\n", + FileObject->FileName.Buffer); + + DeviceExt = (MINIX_DEVICE_EXTENSION *)DeviceObject->DeviceExtension; + result = ExAllocatePool(NonPagedPool,sizeof(struct minix_inode)); + DPRINT("result %x\n",result); + Status = MinixOpen(DeviceExt->AttachedDevice, + DeviceExt, + FileObject, + result, + &Irp->IoStatus.Information); + + if (NT_SUCCESS(Status)) + { + FileObject->FsContext = result; + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + DPRINT("Finished MinixCreate()\n"); + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + diff --git a/rosapps/ramdrv/minix/inode.c b/rosapps/ramdrv/minix/inode.c new file mode 100644 index 00000000000..d7a38c34587 --- /dev/null +++ b/rosapps/ramdrv/minix/inode.c @@ -0,0 +1,136 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/minix.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include "bitops.h" +#include + +#define NDEBUG +#include + +#include "minix.h" + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS MinixDeleteInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt, + ULONG ino) +{ + PULONG Buffer; + ULONG off; + + Buffer = ExAllocatePool(NonPagedPool,BLOCKSIZE); + MinixReadSector(Volume, (ino / 8192)+2, (PVOID)Buffer); + off = ino % 8192; + clear_bit(off%32,&Buffer[off/32]); + MinixWriteSector(Volume, (ino / 8192)+2, (PVOID)Buffer); + return(STATUS_SUCCESS); +} + +static ULONG MinixAllocateInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt) +{ + ULONG i; + PULONG Buffer; + ULONG ino; + + Buffer = ExAllocatePool(NonPagedPool,BLOCKSIZE); + for (i=0; isb->s_imap_blocks; i++) + { + MinixReadSector(Volume,i + 2,Buffer); + ino = find_first_zero_bit(Buffer,8192); + if (ino < 8192) + { + set_bit(ino%32,&Buffer[32]); + MinixWriteSector(Volume,i + 2,Buffer); + ExFreePool(Buffer); + return(ino + (i*8192)); + } + } + ExFreePool(Buffer); + return(0); +} + +ULONG MinixNewInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt, + struct minix_inode* new_inode) +{ + ULONG ino; + + ino = MinixAllocateInode(Volume,DeviceExt); + if (ino == 0) + { + return(0); + } + MinixWriteInode(Volume,DeviceExt,ino,new_inode); + return(ino); +} + +NTSTATUS MinixWriteInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt, + ULONG ino, + struct minix_inode* result) +{ + int block; + char* buffer; + struct minix_inode* inodes; + + DPRINT("MinixWriteInode(ino %x, result %x)\n",ino,result); + + buffer = ExAllocatePool(NonPagedPool,1024); + inodes = (struct minix_inode *)buffer; + + block = 2 + DeviceExt->sb->s_imap_blocks + DeviceExt->sb->s_zmap_blocks + + ((ino-1) / MINIX_INODES_PER_BLOCK); + MinixReadSector(Volume,block,buffer); + memcpy(&inodes[(ino-1)%MINIX_INODES_PER_BLOCK],result, + sizeof(struct minix_inode)); + MinixWriteSector(Volume,block,buffer); + + ExFreePool(buffer); + return(STATUS_SUCCESS); +} + +NTSTATUS MinixReadInode(PDEVICE_OBJECT DeviceObject, + MINIX_DEVICE_EXTENSION* DeviceExt, + ULONG ino, + struct minix_inode* result) +{ + int block; + struct minix_inode* inodes; + PVOID BaseAddress; + + DPRINT("MinixReadInode(ino %x, result %x)\n",ino,result); + + block = 2 + DeviceExt->sb->s_imap_blocks + DeviceExt->sb->s_zmap_blocks + + ((ino-1) / MINIX_INODES_PER_BLOCK); + DPRINT("Reading block %x offset %x\n",block,block*BLOCKSIZE); + DPRINT("Index %x\n",(ino-1)%MINIX_INODES_PER_BLOCK); + + BaseAddress = ExAllocatePool(NonPagedPool, PAGE_SIZE); + + MinixReadPage(DeviceObject, + block, + BaseAddress); + + inodes = (struct minix_inode *)(BaseAddress + ((block % 4) * 512)); + + memcpy(result, + &inodes[(ino-1)%MINIX_INODES_PER_BLOCK], + sizeof(struct minix_inode)); + DPRINT("result->i_uid %x\n",result->i_uid); + DPRINT("result->i_size %x\n",result->i_size); + + ExFreePool(BaseAddress); + + return(STATUS_SUCCESS); +} diff --git a/rosapps/ramdrv/minix/minix.h b/rosapps/ramdrv/minix/minix.h new file mode 100644 index 00000000000..5b9b4780cac --- /dev/null +++ b/rosapps/ramdrv/minix/minix.h @@ -0,0 +1,133 @@ +#include +#include + +#define MINIX_ROOT_INO 1 + +/* Not the same as the bogus LINK_MAX in . Oh well. */ +#define MINIX_LINK_MAX 250 + +#define MINIX_I_MAP_SLOTS 8 +#define MINIX_Z_MAP_SLOTS 64 +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ +#define MINIX_VALID_FS 0x0001 /* Clean fs. */ +#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ + +#define MINIX_INODES_PER_BLOCK ((BLOCKSIZE)/(sizeof (struct minix_inode))) +#define MINIX2_INODES_PER_BLOCK ((BLOCKSIZE)/(sizeof (struct minix2_inode))) + +#define MINIX_V1 0x0001 /* original minix fs */ +#define MINIX_V2 0x0002 /* minix V2 fs */ + + +/* + * This is the original minix inode layout on disk. + * Note the 8-bit gid and atime and ctime. + */ +struct minix_inode { + unsigned short int i_mode; + unsigned short int i_uid; + unsigned long i_size; + unsigned long i_time; + unsigned char i_gid; + unsigned char i_nlinks; + unsigned short int i_zone[9]; +}; + +/* + * The new minix inode has all the time entries, as well as + * long block numbers and a third indirect block (7+1+1+1 + * instead of 7+1+1). Also, some previously 8-bit values are + * now 16-bit. The inode is now 64 bytes instead of 32. + */ +struct minix2_inode { + unsigned short int i_mode; + unsigned short int i_nlinks; + unsigned short int i_uid; + unsigned short int i_gid; + unsigned long i_size; + unsigned long i_atime; + unsigned long i_mtime; + unsigned long i_ctime; + unsigned long i_zone[10]; +}; + +/* + * minix super-block data on disk + */ +struct minix_super_block { + unsigned short int s_ninodes; + unsigned short int s_nzones; + unsigned short int s_imap_blocks; + unsigned short int s_zmap_blocks; + unsigned short int s_firstdatazone; + unsigned short int s_log_zone_size; + unsigned long s_max_size; + unsigned short int s_magic; + unsigned short int s_state; + unsigned long s_zones; +}; + +struct minix_dir_entry { + unsigned short int inode; + char name[0]; +}; +#define MINIX_DIR_ENTRY_SIZE (sizeof(struct minix_dir_entry)+30) + +BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN PVOID Buffer); +BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN PVOID Buffer); + +#define BLOCKSIZE (1024) + +//extern PDRIVER_OBJECT DriverObject; + +typedef struct +{ + PDEVICE_OBJECT AttachedDevice; + struct minix_inode root_inode; + char superblock_buf[BLOCKSIZE]; + struct minix_super_block* sb; + PFILE_OBJECT FileObject; +} MINIX_DEVICE_EXTENSION, *PMINIX_DEVICE_EXTENSION; + +typedef struct +{ + struct minix_inode inode; +} MINIX_FSCONTEXT, *PMINIX_FSCONTEXT; + +NTSTATUS STDCALL MinixCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL MinixClose(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL MinixWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS STDCALL MinixDirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); + +ULONG MinixNewInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt, + struct minix_inode* new_inode); +NTSTATUS MinixWriteInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt, + ULONG ino, + struct minix_inode* result); +NTSTATUS MinixReadInode(PDEVICE_OBJECT DeviceObject, + MINIX_DEVICE_EXTENSION* DeviceExt, + ULONG ino, + struct minix_inode* result); +NTSTATUS MinixDeleteInode(PDEVICE_OBJECT Volume, + MINIX_DEVICE_EXTENSION* DeviceExt, + ULONG ino); + +NTSTATUS MinixReadBlock(PDEVICE_OBJECT DeviceObject, + PMINIX_DEVICE_EXTENSION DeviceExt, + struct minix_inode* inode, + ULONG FileOffset, + PULONG DiskOffset); + +BOOLEAN MinixReadPage(PDEVICE_OBJECT DeviceObject, + ULONG Offset, + PVOID Buffer); diff --git a/rosapps/ramdrv/minix/minix.rc b/rosapps/ramdrv/minix/minix.rc new file mode 100644 index 00000000000..b234bf6cbb9 --- /dev/null +++ b/rosapps/ramdrv/minix/minix.rc @@ -0,0 +1,7 @@ +/* $Id$ */ + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Minix IFS Driver\0" +#define REACTOS_STR_INTERNAL_NAME "minix\0" +#define REACTOS_STR_ORIGINAL_FILENAME "minix.sys\0" +#include diff --git a/rosapps/ramdrv/minix/minix_fs.h b/rosapps/ramdrv/minix/minix_fs.h new file mode 100644 index 00000000000..8cfdb9005c7 --- /dev/null +++ b/rosapps/ramdrv/minix/minix_fs.h @@ -0,0 +1,80 @@ +#define MINIX_ROOT_INO 1 + +/* Not the same as the bogus LINK_MAX in . Oh well. */ +#define MINIX_LINK_MAX 250 + +#define MINIX_I_MAP_SLOTS 8 +#define MINIX_Z_MAP_SLOTS 64 +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ +#define MINIX_VALID_FS 0x0001 /* Clean fs. */ +#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ + +#define MINIX_INODES_PER_BLOCK ((BLOCKSIZE)/(sizeof (struct minix_inode))) +#define MINIX2_INODES_PER_BLOCK ((BLOCKSIZE)/(sizeof (struct minix2_inode))) + +#define MINIX_V1 0x0001 /* original minix fs */ +#define MINIX_V2 0x0002 /* minix V2 fs */ + + +/* + * This is the original minix inode layout on disk. + * Note the 8-bit gid and atime and ctime. + */ +struct minix_inode { + unsigned short int i_mode; + unsigned short int i_uid; + unsigned long i_size; + unsigned long i_time; + unsigned char i_gid; + unsigned char i_nlinks; + unsigned short int i_zone[9]; +}; + +/* + * The new minix inode has all the time entries, as well as + * long block numbers and a third indirect block (7+1+1+1 + * instead of 7+1+1). Also, some previously 8-bit values are + * now 16-bit. The inode is now 64 bytes instead of 32. + */ +struct minix2_inode { + unsigned short int i_mode; + unsigned short int i_nlinks; + unsigned short int i_uid; + unsigned short int i_gid; + unsigned long i_size; + unsigned long i_atime; + unsigned long i_mtime; + unsigned long i_ctime; + unsigned long i_zone[10]; +}; + +/* + * minix super-block data on disk + */ +struct minix_super_block { + unsigned short int s_ninodes; + unsigned short int s_nzones; + unsigned short int s_imap_blocks; + unsigned short int s_zmap_blocks; + unsigned short int s_firstdatazone; + unsigned short int s_log_zone_size; + unsigned long s_max_size; + unsigned short int s_magic; + unsigned short int s_state; + unsigned long s_zones; +}; + +struct minix_dir_entry { + unsigned short int inode; + char name[0]; +}; +#define MINIX_DIR_ENTRY_SIZE (sizeof(struct minix_dir_entry)+30) + +BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject, + IN ULONG DiskSector, + IN UCHAR* Buffer); + +#define BLOCKSIZE (1024) diff --git a/rosapps/ramdrv/minix/mount.c b/rosapps/ramdrv/minix/mount.c new file mode 100644 index 00000000000..d8e228d3c48 --- /dev/null +++ b/rosapps/ramdrv/minix/mount.c @@ -0,0 +1,160 @@ +/* + * ReactOS kernel + * Copyright (C) 2000 David Welch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/minix.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +//#define NDEBUG +#include + +#include "minix.h" + +/* GLOBALS *******************************************************************/ + +static PDRIVER_OBJECT DriverObject; + +/* FUNCTIONS ****************************************************************/ + +VOID MinixMount(PDEVICE_OBJECT DeviceToMount) +{ + PDEVICE_OBJECT DeviceObject; + MINIX_DEVICE_EXTENSION* DeviceExt; + + IoCreateDevice(DriverObject, + sizeof(MINIX_DEVICE_EXTENSION), + NULL, + FILE_DEVICE_FILE_SYSTEM, + 0, + FALSE, + &DeviceObject); + DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO; + DeviceExt = DeviceObject->DeviceExtension; + + MinixReadSector(DeviceToMount,1,DeviceExt->superblock_buf); + DeviceExt->sb = (struct minix_super_block *)(DeviceExt->superblock_buf); + + DeviceExt->StorageDevice = DeviceToMount; + DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject; + DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice; + DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED; + DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1; + DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; + + DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject); +} + +NTSTATUS STDCALL +MinixFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); +// PVPB vpb = Stack->Parameters.Mount.Vpb; + PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject; + NTSTATUS Status; + char* superblock_buf; + struct minix_super_block* sb; + + DbgPrint("MinixFileSystemControl(DeviceObject %x, Irp %x)\n",DeviceObject, + Irp); + DPRINT("DeviceToMount %x\n",DeviceToMount); + + superblock_buf = ExAllocatePool(NonPagedPool,BLOCKSIZE); + + DPRINT("MinixReadSector %x\n",MinixReadSector); + MinixReadSector(DeviceToMount,1,superblock_buf); + sb = (struct minix_super_block *)superblock_buf; + DPRINT("Magic %x\n",sb->s_magic); + DPRINT("Imap blocks %x\n",sb->s_imap_blocks); + DPRINT("Zmap blocks %x\n",sb->s_zmap_blocks); + if (sb->s_magic==MINIX_SUPER_MAGIC2) + { + DPRINT("%s() = STATUS_SUCCESS\n",__FUNCTION__); + MinixMount(DeviceToMount); + Status = STATUS_SUCCESS; + } + else + { + DPRINT("%s() = STATUS_UNRECOGNIZED_VOLUME\n",__FUNCTION__); + Status = STATUS_UNRECOGNIZED_VOLUME; + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + +NTSTATUS STDCALL +DriverEntry(PDRIVER_OBJECT _DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Called by the system to initalize the driver + * ARGUMENTS: + * DriverObject = object describing this driver + * RegistryPath = path to our configuration entries + * RETURNS: Success or failure + */ +{ + PDEVICE_OBJECT DeviceObject; + NTSTATUS ret; + UNICODE_STRING DeviceName; + + DbgPrint("Minix FSD 0.0.1\n"); + + DriverObject = _DriverObject; + + RtlInitUnicodeString(&DeviceName, + L"\\Device\\Minix"); + ret = IoCreateDevice(DriverObject, + 0, + &DeviceName, + FILE_DEVICE_FILE_SYSTEM, + 0, + FALSE, + &DeviceObject); + if (!NT_SUCCESS(ret)) + { + return(ret); + } + + DeviceObject->Flags = 0; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = MinixClose; + DriverObject->MajorFunction[IRP_MJ_CREATE] = MinixCreate; + DriverObject->MajorFunction[IRP_MJ_READ] = MinixRead; + DriverObject->MajorFunction[IRP_MJ_WRITE] = MinixWrite; + DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = + MinixFileSystemControl; + DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = + MinixDirectoryControl; + DriverObject->DriverUnload = NULL; + + IoRegisterFileSystem(DeviceObject); + + return(STATUS_SUCCESS); +} + diff --git a/rosapps/ramdrv/minix/rw.c b/rosapps/ramdrv/minix/rw.c new file mode 100644 index 00000000000..4bf0310e229 --- /dev/null +++ b/rosapps/ramdrv/minix/rw.c @@ -0,0 +1,162 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/minix/rw.c + * PURPOSE: Minix FSD + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include + +#define NDEBUG +#include + +#include "minix.h" + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +MinixWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT("MinixWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} + +static NTSTATUS MinixReadFilePage(PDEVICE_OBJECT DeviceObject, + PMINIX_DEVICE_EXTENSION DeviceExt, + PMINIX_FSCONTEXT FsContext, + ULONG Offset, + PVOID* Buffer) +{ + NTSTATUS Status; + ULONG i; + ULONG DiskOffset; + + *Buffer = ExAllocatePool(NonPagedPool, 4096); + + for (i=0; i<4; i++) + { + Status = MinixReadBlock(DeviceObject, + DeviceExt, + &FsContext->inode, + Offset + (i * BLOCKSIZE), + &DiskOffset); + MinixReadSector(DeviceObject, + DiskOffset / BLOCKSIZE, + (*Buffer) + (i * BLOCKSIZE)); + } + return(STATUS_SUCCESS); +} + +NTSTATUS STDCALL +MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + ULONG Length; + PVOID Buffer; + ULONG Offset; + ULONG CurrentOffset; + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + MINIX_DEVICE_EXTENSION* DeviceExt = DeviceObject->DeviceExtension; + PMINIX_FSCONTEXT FsContext = (PMINIX_FSCONTEXT)FileObject->FsContext; + unsigned int i; + PVOID DiskBuffer; + + DPRINT("MinixRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); + + Length = Stack->Parameters.Read.Length; + Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); + Offset = Stack->Parameters.Read.ByteOffset.u.LowPart; + + DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset); + + CurrentOffset=Offset; + + DPRINT("inode->i_size %d\n",inode->i_size); + + if (Offset > FsContext->inode.i_size) + { + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp,IO_NO_INCREMENT); + return(STATUS_UNSUCCESSFUL); + } + if ((Offset+Length) > FsContext->inode.i_size) + { + Length = FsContext->inode.i_size - Offset; + } + + if ((Offset%PAGE_SIZE)!=0) + { + CurrentOffset = Offset - (Offset%PAGE_SIZE); + + MinixReadFilePage(DeviceObject, + DeviceExt, + FsContext, + CurrentOffset, + &DiskBuffer); + + memcpy(Buffer, + DiskBuffer+(Offset%PAGE_SIZE), + min(PAGE_SIZE - (Offset%PAGE_SIZE),Length)); + + ExFreePool(DiskBuffer); + + DPRINT("(BLOCKSIZE - (Offset%BLOCKSIZE)) %d\n", + (BLOCKSIZE - (Offset%BLOCKSIZE))); + DPRINT("Length %d\n",Length); + CurrentOffset = CurrentOffset + PAGE_SIZE; + Buffer = Buffer + PAGE_SIZE - (Offset%PAGE_SIZE); + Length = Length - min(PAGE_SIZE - (Offset%PAGE_SIZE),Length); + DPRINT("CurrentOffset %d Buffer %x Length %d\n",CurrentOffset,Buffer, + Length); + } + for (i=0;i<(Length/PAGE_SIZE);i++) + { + CHECKPOINT; + + DPRINT("Length %d\n",Length); + + MinixReadFilePage(DeviceObject, + DeviceExt, + FsContext, + CurrentOffset, + &DiskBuffer); + memcpy(Buffer, DiskBuffer, PAGE_SIZE); + + ExFreePool(DiskBuffer); + + CurrentOffset = CurrentOffset + PAGE_SIZE; + Buffer = Buffer + PAGE_SIZE; + } + if ((Length%PAGE_SIZE) > 0) + { + CHECKPOINT; + + DPRINT("Length %x Buffer %x\n",(Length%PAGE_SIZE),Buffer); + + MinixReadFilePage(DeviceObject, + DeviceExt, + FsContext, + CurrentOffset, + &DiskBuffer); + + memcpy(Buffer, DiskBuffer, (Length%PAGE_SIZE)); + + ExFreePool(DiskBuffer); + + } + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = Length; + IoCompleteRequest(Irp,IO_NO_INCREMENT); + return(STATUS_SUCCESS); +} diff --git a/rosapps/ramdrv/ramdrv.c b/rosapps/ramdrv/ramdrv.c new file mode 100644 index 00000000000..797924eca79 --- /dev/null +++ b/rosapps/ramdrv/ramdrv.c @@ -0,0 +1,242 @@ +#include +#include +#include "ramdrv.h" +#include +#include "bzlib.h" + +static NTSTATUS STDCALL RamdrvDispatchDeviceControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IrpStack; + ULONG ControlCode, InputLength, OutputLength; + NTSTATUS Status; + + DPRINT("RamdrvDispatchDeviceControl\n"); + + IrpStack = IoGetCurrentIrpStackLocation(Irp); + ControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode; + InputLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength; + OutputLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength; + + switch (ControlCode) + { + case IOCTL_DISK_GET_DRIVE_GEOMETRY: + if (OutputLength < sizeof(DISK_GEOMETRY)) + { + Status = STATUS_INVALID_PARAMETER; + } + else + { + PDISK_GEOMETRY Geometry = Irp->AssociatedIrp.SystemBuffer; + Geometry->MediaType = F3_1Pt44_512; + Geometry->Cylinders.QuadPart = 80; + Geometry->TracksPerCylinder = 2 * 18; + Geometry->SectorsPerTrack = 18; + Geometry->BytesPerSector = 512; + Status = STATUS_SUCCESS; + Irp->IoStatus.Information = sizeof(DISK_GEOMETRY); + } + break; + default: + Status = STATUS_INVALID_DEVICE_REQUEST; + } + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT); + return Status; +} + +static NTSTATUS STDCALL RamdrvDispatchReadWrite(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PRAMDRV_DEVICE_EXTENSION devext = (PRAMDRV_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + PIO_STACK_LOCATION Stk = IoGetCurrentIrpStackLocation( Irp ); + + if( Stk->Parameters.Read.ByteOffset.u.HighPart || + Stk->Parameters.Read.ByteOffset.u.LowPart >= devext->Size ) + { + Irp->IoStatus.Status = STATUS_END_OF_FILE; + Irp->IoStatus.Information = 0; + IoCompleteRequest( Irp, 0 ); + return STATUS_END_OF_FILE; + } + if( (Stk->Parameters.Read.ByteOffset.u.LowPart + Stk->Parameters.Read.Length) > devext->Size ) + Stk->Parameters.Read.Length = devext->Size - Stk->Parameters.Read.ByteOffset.u.LowPart; + if( Stk->MajorFunction == IRP_MJ_READ ) + RtlCopyMemory( MmGetSystemAddressForMdl( Irp->MdlAddress ), + (PVOID)((ULONG_PTR)devext->Buffer + Stk->Parameters.Read.ByteOffset.u.LowPart), + Stk->Parameters.Read.Length ); + else RtlCopyMemory( (PVOID)((ULONG_PTR)devext->Buffer + Stk->Parameters.Read.ByteOffset.u.LowPart), + MmGetSystemAddressForMdl( Irp->MdlAddress ), + Stk->Parameters.Read.Length ); + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = Stk->Parameters.Read.Length; + IoCompleteRequest( Irp, 0 ); + return STATUS_SUCCESS; +} + +static NTSTATUS STDCALL RamdrvDispatchOpenClose(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + DPRINT("RamdrvDispatchOpenClose\n"); + return STATUS_SUCCESS; +} + +NTSTATUS STDCALL DriverEntry(IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath) +{ + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Ramdisk"); + NTSTATUS Status; + PDEVICE_OBJECT DeviceObject; + PRAMDRV_DEVICE_EXTENSION devext; + UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\??\\Z:"); + UNICODE_STRING ImageName = RTL_CONSTANT_STRING(L"\\Device\\Floppy0\\ramdisk.bz2"); + HANDLE file; + OBJECT_ATTRIBUTES objattr; + IO_STATUS_BLOCK iosb; + LARGE_INTEGER allocsize; + HANDLE event; + void *tbuff; + unsigned int dstlen = 1024 * 1440; + FILE_STANDARD_INFORMATION finfo; + ULONG err; + + DPRINT("Ramdisk driver\n"); + + /* Export other driver entry points... */ + DriverObject->MajorFunction[IRP_MJ_CREATE] = RamdrvDispatchOpenClose; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = RamdrvDispatchOpenClose; + DriverObject->MajorFunction[IRP_MJ_READ] = RamdrvDispatchReadWrite; + DriverObject->MajorFunction[IRP_MJ_WRITE] = RamdrvDispatchReadWrite; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = RamdrvDispatchDeviceControl; + + + // create device and symbolic link + Status = IoCreateDevice( DriverObject, + sizeof( RAMDRV_DEVICE_EXTENSION ), + &DeviceName, + FILE_DEVICE_DISK, + 0, + FALSE, + &DeviceObject ); + if( !NT_SUCCESS( Status ) ) + return Status; + DeviceObject->Flags |= DO_DIRECT_IO; + devext = (PRAMDRV_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + devext->Size = 1440 * 1024; + devext->Buffer = ExAllocatePool( PagedPool, devext->Size ); + if( !devext->Buffer ) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto cleandevice; + } + IoCreateSymbolicLink( &LinkName, &DeviceName ); + + InitializeObjectAttributes( &objattr, + &ImageName, + 0, + 0, + 0 ); + allocsize.u.LowPart = allocsize.u.HighPart = 0; + + Status = ZwOpenFile( &file, + GENERIC_READ, + &objattr, + &iosb, + FILE_SHARE_READ, + FILE_NO_INTERMEDIATE_BUFFERING ); + + if( !NT_SUCCESS( Status ) ) + { + DPRINT( "Failed to open floppy\n" ); + goto cleanbuffer; + } + + InitializeObjectAttributes( &objattr, + 0, + 0, + 0, + 0 ); + Status = ZwCreateEvent( &event, + 0, + &objattr, + NotificationEvent, + FALSE ); + if( !NT_SUCCESS( Status ) ) + { + DPRINT( "Failed to create event\n" ); + goto cleanfile; + } + + Status = ZwQueryInformationFile( file, + &iosb, + &finfo, + sizeof( finfo ), + FileStandardInformation ); + + if( !NT_SUCCESS( Status ) ) + { + DPRINT1( "Failed to query file information\n" ); + goto cleanevent; + } + tbuff = ExAllocatePool( PagedPool, finfo.EndOfFile.u.LowPart ); + if( !tbuff ) + { + DPRINT1( "Failed to allocate buffer of size %d\n", finfo.EndOfFile.u.LowPart ); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto cleanevent; + } + + Status = ZwReadFile( file, + event, + 0, + 0, + &iosb, + tbuff, + finfo.EndOfFile.u.LowPart, + &allocsize, + 0 ); + + if( !NT_SUCCESS( Status ) ) + { + DPRINT( "Failed to read floppy\n" ); + goto cleantbuff; + } + Status = ZwWaitForSingleObject( event, FALSE, 0 ); + if( Status != STATUS_WAIT_0 || !NT_SUCCESS( iosb.Status ) ) + { + DPRINT( "Failed to read floppy\n" ); + goto cleantbuff; + } + DPRINT( "RAMDRV: Read in %d bytes, decompressing now\n", iosb.Information ); + err = BZ2_bzBuffToBuffDecompress( devext->Buffer, + &dstlen, + tbuff, + iosb.Information, + 1, + 0 ); + if( err == 0 ) + { + DPRINT( "RAMDRV: Image Decompressed\n"); + } + else DbgPrint( "RAMDRV: Failed to decomparess image, error: %d\n", err ); + ExFreePool( tbuff ); + ZwClose( file ); + ZwClose( event ); + return STATUS_SUCCESS; + + cleantbuff: + ExFreePool( tbuff ); + cleanevent: + ZwClose( event ); + cleanfile: + ZwClose( file ); + cleanbuffer: + ExFreePool( devext->Buffer ); + + cleandevice: + IoDeleteDevice( DeviceObject ); + for(;;); + + return Status; +} + diff --git a/rosapps/ramdrv/ramdrv.h b/rosapps/ramdrv/ramdrv.h new file mode 100644 index 00000000000..c391ae883da --- /dev/null +++ b/rosapps/ramdrv/ramdrv.h @@ -0,0 +1,8 @@ +typedef struct _RAMDRV_DEVICE_EXTENSION { + void *Buffer; + unsigned long Size; +} RAMDRV_DEVICE_EXTENSION, *PRAMDRV_DEVICE_EXTENSION; + +NTSTATUS STDCALL DriverEntry(IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath); + diff --git a/rosapps/ramdrv/ramdrv.rbuild b/rosapps/ramdrv/ramdrv.rbuild new file mode 100644 index 00000000000..183d2d62fc5 --- /dev/null +++ b/rosapps/ramdrv/ramdrv.rbuild @@ -0,0 +1,10 @@ + + . + . + + ntoskrnl + hal + bzip2 + ramdrv.c + ramdrv.rc + diff --git a/rosapps/ramdrv/ramdrv.rc b/rosapps/ramdrv/ramdrv.rc new file mode 100644 index 00000000000..9a0ffbb883b --- /dev/null +++ b/rosapps/ramdrv/ramdrv.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "RAM Disk Device Driver\0" +#define REACTOS_STR_INTERNAL_NAME "ramdrv\0" +#define REACTOS_STR_ORIGINAL_FILENAME "ramdrv.sys\0" +#include diff --git a/rosapps/roshttpd/common/list.cpp b/rosapps/roshttpd/common/list.cpp new file mode 100644 index 00000000000..29c6912cf55 --- /dev/null +++ b/rosapps/roshttpd/common/list.cpp @@ -0,0 +1,94 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: list.cpp + * PURPOSE: A doubly linked list implementation + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + * NOTES: The linked list does it's own heap management for + * better performance + * TODO: - InsertBefore(), InsertAfter(), Move() + */ +#include +#include + +// **************************** CListNode **************************** + +HANDLE CListNode::hHeap = NULL; +INT CListNode::nRef = 0; + +// Default constructor +CListNode::CListNode() +{ + Element = NULL; + Next = NULL; + Prev = NULL; +} + +// Constructor with element and next as starter values +CListNode::CListNode(PVOID element, CListNode *next, CListNode *prev) +{ + Element = element; + Next = next; + Prev = prev; +} + +void* CListNode::operator new(/*size_t*/ UINT size) +{ + PVOID p; + if (hHeap == NULL) { + SYSTEM_INFO inf; + GetSystemInfo(&inf); + hHeap = HeapCreate(0, inf.dwAllocationGranularity, 0); + } + if ((p = HeapAlloc(hHeap, 0, size)) != NULL) + nRef++; + return p; +} + +VOID CListNode::operator delete(void* p) +{ + if (HeapFree(hHeap, 0, p) != FALSE) + nRef--; + if (nRef == 0) { + HeapDestroy(hHeap); + hHeap = NULL; + } +} + +// Set element +VOID CListNode::SetElement(PVOID element) +{ + Element = element; +} + +// Set pointer to next node in list +VOID CListNode::SetNext(CListNode *next) +{ + Next = next; +} + +// Set pointer to previous node in list +VOID CListNode::SetPrev(CListNode *prev) +{ + Prev = prev; +} + +// Get element of node +PVOID CListNode::GetElement() +{ + return Element; +} + +// Get pointer to next node in list +CListNode *CListNode::GetNext() +{ + return Next; +} + +// Get pointer to previous node in list +CListNode *CListNode::GetPrev() +{ + return Prev; +} diff --git a/rosapps/roshttpd/common/roshttpd.rc b/rosapps/roshttpd/common/roshttpd.rc new file mode 100644 index 00000000000..b11ae969203 --- /dev/null +++ b/rosapps/roshttpd/common/roshttpd.rc @@ -0,0 +1,6 @@ +/* $Id$ */ + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS HTTP Win32 Server\0" +#define REACTOS_STR_INTERNAL_NAME "roshttpd\0" +#define REACTOS_STR_ORIGINAL_FILENAME "roshttpd.exe\0" +#include diff --git a/rosapps/roshttpd/common/socket.cpp b/rosapps/roshttpd/common/socket.cpp new file mode 100644 index 00000000000..b42e3650d26 --- /dev/null +++ b/rosapps/roshttpd/common/socket.cpp @@ -0,0 +1,344 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: socket.cpp + * PURPOSE: Socket classes + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + */ +#include +#include +#include +#include + +// ***************************** CSocket ***************************** + +// Default constructor +CSocket::CSocket() +{ + Active = FALSE; + Event = WSA_INVALID_EVENT; + Events = 0; + Socket = INVALID_SOCKET; + + // INET address family + SockAddrIn.sin_family = AF_INET; + + // Any address will do + SockAddrIn.sin_addr.s_addr = INADDR_ANY; + + // Convert to network ordering + SockAddrIn.sin_port = htons(0); +} + +// Default destructor +CSocket::~CSocket() +{ +} + +// Return winsock socket handle +SOCKET CSocket::GetSocket() +{ + return Socket; +} + +// Set winsock socket handle +VOID CSocket::SetSocket(SOCKET socket) +{ + Socket = socket; +} + + +// Return socket address +SOCKADDR_IN CSocket::GetSockAddrIn() +{ + return SockAddrIn; +} + +// Set socket address +VOID CSocket::SetSockAddrIn(SOCKADDR_IN sockaddrin) +{ + SockAddrIn = sockaddrin; +} + +// Associate winsock events with socket +VOID CSocket::SetEvents(LONG lEvents) +{ + if (Event == WSA_INVALID_EVENT) { + // Create socket event + Event = WSACreateEvent(); + if (Event == WSA_INVALID_EVENT) + throw ESocketOpen(TS("Unable to create event.")); + } + + if (lEvents != Events) { + // Associate network events with socket + if (WSAEventSelect(Socket, Event, lEvents) == SOCKET_ERROR) + throw ESocketOpen(TS("Unable to select socket events.")); + Events = lEvents; + } +} + +// Return associated winsock events +LONG CSocket::GetEvents() +{ + return Events; +} + +// Open socket +VOID CSocket::Open() +{ +} + +// Close socket +VOID CSocket::Close() +{ +} + + +// *********************** CServerClientSocket *********************** + +// Constructor with serversocket as parameter +CServerClientSocket::CServerClientSocket(LPCServerSocket lpServerSocket) +{ + ServerSocket = lpServerSocket; +} + +// Transmit data to socket +INT CServerClientSocket::Transmit( LPCSTR lpsBuffer, UINT nLength) +{ + return send(Socket, lpsBuffer, nLength, 0); +} + +// Send a string to socket +INT CServerClientSocket::SendText( LPCSTR lpsText) +{ + static CHAR crlf[3] = {0x0D, 0x0A, 0x00}; + INT nCount; + + nCount = Transmit(lpsText, strlen(lpsText)); + nCount += Transmit(crlf, strlen(crlf)); + return nCount; +} + +// Receive data from socket +INT CServerClientSocket::Receive(LPSTR lpsBuffer, UINT nLength) +{ + return recv(Socket, lpsBuffer, nLength, 0); +} + +// Process winsock messages if any +VOID CServerClientSocket::MessageLoop() +{ + UINT nStatus; + WSANETWORKEVENTS NetworkEvents; + + nStatus = WSAWaitForMultipleEvents(1, &Event, FALSE, 0, FALSE); + if ((nStatus == 0) && (WSAEnumNetworkEvents(Socket, Event, &NetworkEvents) != SOCKET_ERROR)) { + if ((NetworkEvents.lNetworkEvents & FD_READ) != 0) { + OnRead(); + } + if ((NetworkEvents.lNetworkEvents & FD_CLOSE) != 0) { + OnClose(); + } + } +} + +// Return server socket that own this socket +LPCServerSocket CServerClientSocket::GetServerSocket() +{ + return ServerSocket; +} + + +// *********************** CServerClientThread *********************** + +CServerClientThread::CServerClientThread(LPCServerClientSocket lpSocket) +{ + ClientSocket = lpSocket; +} + +CServerClientThread::~CServerClientThread() +{ + ClientSocket->GetServerSocket()->RemoveClient((LPCServerClientThread) this); +} + + +// ************************** CServerSocket ************************** + +// Default constructor +CServerSocket::CServerSocket() +{ +} + +// Default destructor +CServerSocket::~CServerSocket() +{ + if (Active) + Close(); +} + +// Open server socket so clients can connect +VOID CServerSocket::Open() +{ + assert(!Active); + + // Convert to network ordering + SockAddrIn.sin_port = htons(Port); + + if (Socket == INVALID_SOCKET) { + // Create socket + Socket = socket(AF_INET, SOCK_STREAM, 0); + if (Socket == INVALID_SOCKET) + throw ESocketOpen(TS("Unable to allocate a socket.")); + } + + // Associate an address with server socket + if (bind(Socket, (struct sockaddr FAR *) &SockAddrIn, sizeof(SockAddrIn)) == SOCKET_ERROR) + throw ESocketOpen(TS("Unable to associate address with socket.")); + + // Listen for incoming connections + if (listen(Socket, MAX_PENDING_CONNECTS) != 0) + throw ESocketOpen(TS("Unable to listen on socket.")); + + // Associate network events with socket + SetEvents(FD_ACCEPT | FD_CONNECT | FD_CLOSE); + + Active = TRUE; +} + +// Close server socket and all current connections +VOID CServerSocket::Close() +{ + assert(Active); + + if (Event != WSA_INVALID_EVENT) { + // Tell winsock not to notify us about any events + if (WSAEventSelect(Socket, Event, 0) == SOCKET_ERROR) + throw ESocketClose(TS("Unable to select socket events.")); + + if (!WSACloseEvent(Event)) + throw ESocketClose(TS("Unable to close socket event.")); + Event = WSA_INVALID_EVENT; + } + + CIterator *i = Connections.CreateIterator(); + + // Terminate and free all client threads + for (i->First(); !i->IsDone(); i->Next()) { + //i->CurrentItem()->Terminate(); + delete i->CurrentItem(); + } + delete i; + Connections.RemoveAll(); + + closesocket(Socket); + Socket = INVALID_SOCKET; + + Active = FALSE; +} + +// Set port number to listen on +VOID CServerSocket::SetPort(UINT nPort) +{ + assert(!Active); + + Port = nPort; +} + +// Process messages from winsock if any +VOID CServerSocket::MessageLoop() +{ + UINT nStatus; + INT nAddrLen; + SOCKET ClientSocket; + SOCKADDR_IN SockAddrIn; + WSANETWORKEVENTS NetworkEvents; + LPCServerClientSocket lpClient; + LPCServerClientThread lpThread; + + nStatus = WSAWaitForMultipleEvents(1, &Event, FALSE, 0, FALSE); + if ((nStatus == 0) && (WSAEnumNetworkEvents(Socket, Event, &NetworkEvents) != SOCKET_ERROR)) { + if ((NetworkEvents.lNetworkEvents & FD_ACCEPT) != 0) { + lpClient = OnGetSocket(this); + nAddrLen = sizeof(SockAddrIn); + ClientSocket = accept(Socket, (SOCKADDR *) &SockAddrIn, &nAddrLen); + if (ClientSocket != INVALID_SOCKET) { + // Set socket handle + lpClient->SetSocket(ClientSocket); + // Set socket address + lpClient->SetSockAddrIn(SockAddrIn); + // Set winsock events + lpClient->SetEvents(FD_READ | FD_CLOSE); + // Create client connection thread + lpThread = OnGetThread(lpClient); + // Add client thread to connection list + InsertClient(lpThread); + // Call OnAccept event handler + OnAccept(lpThread); + } else { + delete lpClient; + lpClient = NULL; + throw ESocketOpen(TS("No more sockets available.")); + } + } + /*if ((NetworkEvents.lNetworkEvents & FD_CONNECT) != 0) { + } + if ((NetworkEvents.lNetworkEvents & FD_CLOSE) != 0) { + }*/ + } +} + +// Insert client into connection list +VOID CServerSocket::InsertClient(LPCServerClientThread lpClient) +{ + Connections.Insert(lpClient); +} + +// Remove client from connection list +VOID CServerSocket::RemoveClient(LPCServerClientThread lpClient) +{ + Connections.Remove(lpClient); +} + +// OnGetSocket event handler +LPCServerClientSocket CServerSocket::OnGetSocket(LPCServerSocket lpServerSocket) +{ + return NULL; +} + +// OnGetThread event handler +LPCServerClientThread CServerSocket::OnGetThread(LPCServerClientSocket lpSocket) +{ + return NULL; +} + + +// Initialize WinSock DLL +VOID InitWinsock() +{ + WORD wVersionRequested; + WSADATA wsaData; + + wVersionRequested = MAKEWORD(2, 0); + + if (WSAStartup(wVersionRequested, &wsaData) != 0) + // Return FALSE as we couldn't find a usable WinSock DLL + throw ESocketWinsock(TS("Unable to initialize winsock dll.")); + + /* Confirm that the WinSock DLL supports 2.0 */ + + if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) { + // We couldn't find a usable winsock dll + WSACleanup(); + throw ESocketDll(TS("Winsock dll version is not 2.0 or higher.")); + } +} + +// Deinitialize WinSock DLL +VOID DeinitWinsock() +{ + if (WSACleanup() != 0) + throw ESocketWinsock(TS("Unable to deinitialize winsock dll.")); +} diff --git a/rosapps/roshttpd/common/thread.cpp b/rosapps/roshttpd/common/thread.cpp new file mode 100644 index 00000000000..3f54c1a7bb5 --- /dev/null +++ b/rosapps/roshttpd/common/thread.cpp @@ -0,0 +1,80 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: thread.cpp + * PURPOSE: Generic thread class + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + */ +#include +#include +#include +#include + +// This is the thread entry code +DWORD WINAPI ThreadEntry(LPVOID parameter) +{ + ThreadData *p = (ThreadData*) parameter; + + p->ClassPtr->Execute(); + + SetEvent(p->hFinished); + return 0; +} + +// Default constructor +CThread::CThread() +{ + bTerminated = FALSE; + // Points to the class that is executed within thread + Data.ClassPtr = this; + // Create synchronization event + Data.hFinished = CreateEvent(NULL, TRUE, FALSE, NULL); + + // FIXME: Do some error handling + assert(Data.hFinished != NULL); + + // Create thread + hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadEntry, &Data, 0, &dwThreadId); + + // FIXME: Do some error handling + assert(hThread != NULL); +} + +// Default destructor +CThread::~CThread() +{ + if ((hThread != NULL) && (Data.hFinished != NULL)) { + if (!bTerminated) + Terminate(); + WaitForSingleObject(Data.hFinished, INFINITE); + CloseHandle(Data.hFinished); + CloseHandle(hThread); + hThread = NULL; + } +} + +// Execute thread code +void CThread::Execute() +{ + while (!bTerminated) Sleep(0); +} + +// Post a message to the thread's message queue +BOOL CThread::PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam) +{ + return PostThreadMessage(dwThreadId, Msg, wParam, lParam); +} + +// Gracefully terminate thread +void CThread::Terminate() +{ + bTerminated = TRUE; +} + +// Returns TRUE if thread is terminated, FALSE if not +BOOL CThread::Terminated() +{ + return bTerminated; +} diff --git a/rosapps/roshttpd/config.cpp b/rosapps/roshttpd/config.cpp new file mode 100644 index 00000000000..b689e1674b2 --- /dev/null +++ b/rosapps/roshttpd/config.cpp @@ -0,0 +1,131 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: config.cpp + * PURPOSE: Daemon configuration + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + */ +#include +#include +#include +#include +#include + +using namespace std; + +LPCConfig pConfiguration; +LPCHttpDaemonThread pDaemonThread; + +// Default constructor +CConfig::CConfig() +{ + Reset(); +} + +// Default destructor +CConfig::~CConfig() +{ + Clear(); +} + +// Clear configuration +void CConfig::Reset() +{ + MainBase = NULL; + HttpBase = NULL; + DefaultResources.RemoveAll(); +} + +// Create default configuration. Can throw bad_alloc +void CConfig::Default() +{ + Clear(); + MainBase = _wcsdup((LPWSTR)dcfgMainBase); + HttpBase = _strdup(dcfgHttpBase); + + LPSTR lpsStr; + try { + lpsStr = _strdup(dcfgDefaultResource); + DefaultResources.Insert(lpsStr); + } catch (bad_alloc e) { + free((void *)lpsStr); + Clear(); + throw; + } + + Port = dcfgDefaultPort; +} + +// Clear configuration +void CConfig::Clear() +{ + if (MainBase != NULL) + free((void *)MainBase); + if (HttpBase != NULL) + free((void *)HttpBase); + + // Free memory for all strings + CIterator *i = DefaultResources.CreateIterator(); + for (i->First(); !i->IsDone(); i->Next()) + free((void *)i->CurrentItem()); + delete i; + + Reset(); +} + +// Load configuration +BOOL CConfig::Load() +{ + Default(); + return TRUE; +} + +// Save configuration +BOOL CConfig::Save() +{ + return TRUE; +} + +// Return MainBase +LPWSTR CConfig::GetMainBase() +{ + return MainBase; +} + +// Set MainBase +void CConfig::SetMainBase(LPWSTR lpwsMainBase) +{ + MainBase = lpwsMainBase; +} + +// Return HttpBase +LPSTR CConfig::GetHttpBase() +{ + return HttpBase; +} + +// Set HttpBase +void CConfig::SetHttpBase(LPSTR lpsHttpBase) +{ + HttpBase = lpsHttpBase; +} + +// Return DefaultResources +CList* CConfig::GetDefaultResources() +{ + return &DefaultResources; +} + +// Return bound port +USHORT CConfig::GetPort() +{ + return Port; +} + +// Set port +VOID CConfig::SetPort(USHORT wPort) +{ + Port = wPort; +} diff --git a/rosapps/roshttpd/error.cpp b/rosapps/roshttpd/error.cpp new file mode 100644 index 00000000000..2dfeeec852c --- /dev/null +++ b/rosapps/roshttpd/error.cpp @@ -0,0 +1,16 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: error.cpp + * PURPOSE: Error reporting + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + */ +#include +#include + +void ReportErrorStr(LPTSTR lpsText) +{ + wprintf((wchar_t*)lpsText); +} diff --git a/rosapps/roshttpd/http.cpp b/rosapps/roshttpd/http.cpp new file mode 100644 index 00000000000..9664a090721 --- /dev/null +++ b/rosapps/roshttpd/http.cpp @@ -0,0 +1,377 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: http.cpp + * PURPOSE: HTTP 1.1 parser engine + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + * TODO: - Implement message-body + * - Implement more generel-header entries + * - Implement more request-header entries + * - Implement more entity-header entries + */ +#include +#include +#include +#include + +CHAR MethodTable[NUMMETHODS][8] = {"OPTIONS", "GET", "HEAD", "POST", "PUT", + "DELETE", "TRACE"}; + +CHAR GenerelTable[NUMGENERELS][18] = {"Cache-Control", "Connection", "Date", "Pragma", + "Transfer-Encoding", "Upgrade", "Via"}; + +CHAR RequestTable[NUMREQUESTS][20] = {"Accept", "Accept-Charset", "Accept-Encoding", + "Accept-Language", "Authorization", "From", "Host", "If-Modified-Since", "If-Match", + "If-None-Match", "If-Range", "If-Unmodified-Since", "Max-Forwards", + "Proxy-Authorization", "Range", "Referer", "User-Agent"}; + +CHAR EntityTable[NUMENTITIES][17] = {"Allow", "Content-Base", "Content-Encoding", + "Content-Language", "Content-Length", "Content-Location", "Content-MD5", + "Content-Range", "Content-Type", "ETag", "Expires", "Last-Modified"}; + +// *************************** CHttpParser *************************** + +// Default constructor +CHttpParser::CHttpParser() +{ + nHead = 0; + nTail = 0; +} + +// Default destructor +CHttpParser::~CHttpParser() +{ +} + +// Returns TRUE if a complete HTTP message is in buffer +BOOL CHttpParser::Complete() +{ + UINT nTmp; + + /*DPRINT("--1:-%d---\n", sBuffer[nHead-2]); + DPRINT("--2:-%d---\n", sBuffer[nHead-1]); + + sBuffer[nHead] = '!'; + sBuffer[nHead+1] = 0; + DPRINT("Examining buffer: (Head: %d, Tail: %d)\n", nHead, nTail); + DPRINT("%s\n", (LPSTR)&sBuffer[nTail]);*/ + + nTmp = nTail; + if (!Parse()) { + if (!bUnknownMethod) + nTail = nTmp; + return FALSE; + } else + return TRUE; +} + + +// Read a character from buffer +BOOL CHttpParser::ReadChar(LPSTR lpsStr) +{ + if (nTail <= nHead) { + if (nTail != nHead) { + lpsStr[0] = sBuffer[nTail]; + nTail++; + return TRUE; + } else { + lpsStr[0] = 0; + return FALSE; + } + } else { + if (nTail == sizeof(sBuffer)) + nTail = 0; + if (nTail != nHead) { + lpsStr[0] = sBuffer[nTail]; + nTail++; + return TRUE; + } else { + lpsStr[0] = 0; + return FALSE; + } + } +} + +// Peek at a character in the buffer +BOOL CHttpParser::PeekChar(LPSTR lpsStr) +{ + UINT nFakeTail; + + if (nTail == sizeof(sBuffer)) + nFakeTail = 0; + else + nFakeTail = nTail; + if (nFakeTail != nHead) { + lpsStr[0] = sBuffer[nFakeTail]; + return TRUE; + } else { + lpsStr[0] = 0; + return FALSE; + } +} + +// Read a string from buffer. Only A-Z, a-z, 0-9 and '-' are valid characters +BOOL CHttpParser::ReadString(LPSTR lpsStr, UINT nLength) +{ + UINT i = 0; + CHAR sTmp; + + while (PeekChar(&sTmp)) { + if (((sTmp >= 'A') && (sTmp <= 'Z')) || ((sTmp >= 'a') && (sTmp <= 'z')) || + ((sTmp >= '0') && (sTmp <= '9')) || (sTmp == '-')) { + if (i >= (nLength - 1)) { + lpsStr[0] = 0; + return FALSE; + } + ReadChar(&sTmp); + lpsStr[i] = sTmp; + i++; + } else { + lpsStr[i] = 0; + return TRUE; + } + } + lpsStr[0] = 0; + return FALSE; +} + +// Read a string from buffer. Stop if SP or CR is found or when there are no more +// characters +BOOL CHttpParser::ReadSpecial(LPSTR lpsStr, UINT nLength) +{ + UINT i = 0; + CHAR sTmp; + + while (PeekChar(&sTmp) && (sTmp != ' ') && (sTmp != 13)) { + if (i >= (nLength - 1)) { + lpsStr[nLength - 1] = 0; + return FALSE; + } + ReadChar(&sTmp); + lpsStr[i] = sTmp; + i++; + } + lpsStr[i] = 0; + return TRUE; +} + +// Skip until "sCh" is found +VOID CHttpParser::Skip(CHAR sCh) +{ + CHAR sTmp; + + while (PeekChar(&sTmp) && (sTmp != sCh)) + ReadChar(&sTmp); +} + +// Return TRUE if sCh is the next character +BOOL CHttpParser::Expect(CHAR sCh) +{ + CHAR sTmp; + + if (PeekChar(&sTmp)) { + if (sTmp == sCh) { + ReadChar(&sTmp); + return TRUE; + } + } + return FALSE; +} + +// Return TRUE if CRLF are the next characters +BOOL CHttpParser::ExpectCRLF() +{ + return (Expect(13) && Expect(10)); +} + +// Request = RequestLine | *( GenerelHeader | RequestHeader | EntityHeader ) +// CRLF [ MessageBody ] +BOOL CHttpParser::Parse() +{ + BOOL bStatus; + + if (RequestLine()) { + do { + if (!ReadString(sHeader, sizeof(sHeader))) + break; + bStatus = (GenerelHeader()); + bStatus = (RequestHeader() || bStatus); + bStatus = (EntityHeader() || bStatus); + } while (bStatus); + // CRLF + if (!ExpectCRLF()) + return FALSE; + MessageBody(); + return TRUE; + } + return FALSE; +} + +// RequestLine = Method SP RequestURI SP HTTP-Version CRLF +BOOL CHttpParser::RequestLine() +{ + CHAR sCh; + UINT i; + + bUnknownMethod = FALSE; + + // RFC 2068 states that servers SHOULD ignore any empty nine(s) received where a + // Request-Line is expected + while (PeekChar(&sCh) && ((sCh == 13) || (sCh == 10))); + + if (!ReadString(sMethod, sizeof(sMethod))) + return FALSE; + + for (i = 0; i < NUMMETHODS; i++) { + if (strcmp(MethodTable[i], sMethod) == 0) { + nMethodNo = i; + if (!Expect(' ')) + return FALSE; + // URI (ie. host/directory/resource) + if (!ReadSpecial(sUri, sizeof(sUri))) + return FALSE; + if (!Expect(' ')) + return FALSE; + // HTTP version (eg. HTTP/1.1) + if (!ReadSpecial(sVersion, sizeof(sVersion))) + return FALSE; + // CRLF + if (!ExpectCRLF()) + return FALSE; + + return TRUE; + } + } + bUnknownMethod = TRUE; + return FALSE; +} + +// GenerelHeader = Cache-Control | Connection | Date | Pragma | Transfer-Encoding | +// Upgrade | Via +BOOL CHttpParser::GenerelHeader() +{ + INT i; + + for (i = 0; i < NUMGENERELS; i++) { + if (strcmp(GenerelTable[i], sHeader) == 0) { + switch (i) { + case 1: { + //Connection + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + break; + } + default: { + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + } + } + return TRUE; + } + } + return FALSE; +} + +// RequestHeader = Accept | Accept-Charset | Accept-Encoding | Accept-Language | +// Authorization | From | Host | If-Modified-Since | If-Match | +// If-None-Match | If-Range | If-Unmodified-Since | Max-Forwards | +// Proxy-Authorization | Range | Referer | User-Agent +BOOL CHttpParser::RequestHeader() +{ + INT i; + + for (i = 0; i < NUMREQUESTS; i++) { + if (strcmp(RequestTable[i], sHeader) == 0) { + switch (i) { + case 0: { + //Accept + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + break; + } + case 2: { + //Accept-Encoding + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + break; + } + case 3: { + //Accept-Language + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + break; + } + case 6: { + //Host + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + break; + } + case 16: { + //User-Agent + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + break; + } + default: { + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + return TRUE; + } + } + return TRUE; + } + } + return FALSE; +} + +// EntityHeader = Allow | Content-Base | Content-Encoding | Content-Language | +// Content-Length | Content-Location | Content-MD5 | +// Content-Range | Content-Type | ETag | Expires | +// Last-Modified | extension-header +BOOL CHttpParser::EntityHeader() +{ + INT i; + + for (i = 0; i < NUMENTITIES; i++) { + if (strcmp(EntityTable[i], sHeader) == 0) { + switch (i) { + case 0: + default: { + //cout << ": #" << i << endl; + Expect(':'); + Expect(' '); + Skip(13); + ExpectCRLF(); + return TRUE; + } + } + return FALSE; + } + } + return FALSE; +} + +// MessageBody = *OCTET +BOOL CHttpParser::MessageBody() +{ + return FALSE; +} diff --git a/rosapps/roshttpd/httpd.cpp b/rosapps/roshttpd/httpd.cpp new file mode 100644 index 00000000000..1801a6c4e8c --- /dev/null +++ b/rosapps/roshttpd/httpd.cpp @@ -0,0 +1,492 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: httpd.cpp + * PURPOSE: HTTP daemon + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + */ +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +CHAR HttpMsg400[] = "400 Bad Request\n\r

400 Bad Request

\n\rThe request had bad syntax.
\n\r\n\r\n\r"; +CHAR HttpMsg404[] = "404 Not Found\n\r

404 Not Found

\n\rThe requested URL was not found on this server.
\n\r\n\r\n\r"; +CHAR HttpMsg405[] = "405 Method Not Allowed\n\r

405 Method Not Allowed

\n\rThe requested method is not supported on this server.
\n\r\n\r\n\r"; +CHAR HttpMsg500[] = "500 Internal Server Error\n\r

500 Internal Server Error

\n\rAn internal error occurred.
\n\r\n\r\n\r"; +CHAR HttpMsg501[] = "501 Not Implemented\n\r

501 Not Implemented

\n\rThe feature is not implemented.
\n\r\n\r\n\r"; + + +// *************************** CHttpClient *************************** + +// Default constructor +CHttpClient::CHttpClient() +{ +} + +// Constructor with server socket as starter value +CHttpClient::CHttpClient(CServerSocket *serversocket) +{ + ServerSocket = serversocket; +} + +// Split URIs into its parts (ie. |http://|www.host.com|/resource|?parameters|) +VOID CHttpClient::SplitUri(LPSTR lpsUri, LPSTR lpsHost, LPSTR lpsResource, LPSTR lpsParams) +{ + LPSTR lpsPos; + LPSTR lpsStr; + UINT i; + + strcpy(lpsHost, ""); + strcpy(lpsResource, ""); + strcpy(lpsParams, ""); + + lpsPos = strstr(lpsUri, "://"); + if (lpsPos != NULL) + lpsStr = &lpsPos[3]; + else + lpsStr = lpsUri; + + lpsPos = strstr(lpsStr, "/"); + if (lpsPos != NULL) { + strncat(lpsHost, lpsPos, lpsPos - lpsStr); + lpsStr = &lpsPos[1]; + + lpsPos = strstr(lpsStr, "?"); + if (lpsPos != NULL) { + strncat(lpsResource, lpsStr, lpsPos - lpsStr); + strcpy(lpsParams, &lpsPos[1]); + } else { + strcpy(lpsResource, lpsStr); + strcpy(lpsParams, ""); + } + + // Replace "/" with "\" + for (i = 0; i < strlen(lpsResource); i++) { + if (lpsResource[i] == '/') + lpsResource[i] = '\\'; + } + } +} + +// Split resource into its parts (ie. |/path/|filename|.extension|) +VOID CHttpClient::SplitResource(LPSTR lpsResource, LPSTR lpsPath, LPSTR lpsFilename, LPSTR lpsExtension) +{ + INT i,len,fileptr,extptr; + + strcpy(lpsPath, ""); + strcpy(lpsFilename, ""); + strcpy(lpsExtension, ""); + + len = strlen(lpsResource); + if (len != 0) { + if (lpsResource[len - 1] == '/') { + // There is only a path + strcpy(lpsPath, lpsResource); + } else { + // Find extension + i = len - 1; + while ((i >= 0) && (lpsResource[i] != '.')) i--; + extptr = i; + while ((i >= 0) && (lpsResource[i] != '/')) i--; + if (i > 0) { + // There is at least one directory in the path (besides root directory) + fileptr = i + 1; + strncat(lpsPath, lpsResource, fileptr); + } else + fileptr = 1; + + // Get filename and possibly extension + if (extptr != 0) { + strncat(lpsFilename, &lpsResource[fileptr], extptr - fileptr); + // Get extension + strncat(lpsExtension, &lpsResource[extptr + 1], len - extptr - 1); + } else + strncat(lpsFilename, &lpsResource[fileptr], len - fileptr); + } + } +} + +// Process HTTP request +VOID CHttpClient::ProcessRequest() +{ + CHAR sStr[255]; + CHAR sHost[255]; + CHAR sResource[255]; + CHAR sParams[255]; + + // Which method? + switch (Parser.nMethodNo) { + case hmGET: { + SplitUri(Parser.sUri, sHost, sResource, sParams); + + // Default resource? + if (strlen(sResource) == 0) { + CIterator *i = pConfiguration->GetDefaultResources()->CreateIterator(); + + // FIXME: All default resources should be tried + // Iterate through all strings + //for (i->First(); !i->IsDone(); i->Next()) + i->First(); + if (!i->IsDone()) { + strcat(sResource, i->CurrentItem()); + delete i; + } else { + // File not found + Report("404 Not Found", HttpMsg404); + break; + } + } + strcpy(sStr, pConfiguration->GetHttpBase()); + strcat(sStr, sResource); + SendFile(sStr); + break; + } + default: { + // Method is not implemented + Report("501 Not Implemented", HttpMsg501); + } + } +} + +// Send a file to socket +VOID CHttpClient::SendFile(LPSTR lpsFilename) +{ + CHAR str[255]; + CHAR str2[32]; + union BigNum { + // unsigned __int64 Big; + unsigned long long Big; + struct { + DWORD Low; + DWORD High; + } u; + } nTotalBytes; + DWORD nBytesToRead; + DWORD nBytesRead; + BOOL bStatus; + + // Try to open file + hFile = CreateFileA(lpsFilename, + GENERIC_READ, // Open for reading + FILE_SHARE_READ, // Share for reading + NULL, // No security + OPEN_EXISTING, // Existing file only + FILE_ATTRIBUTE_NORMAL, // Normal file + NULL); // No attr. template + if (hFile == INVALID_HANDLE_VALUE) { + // File not found + Report("404 Not Found", HttpMsg404); + return; + } + // Get file size + nTotalBytes.u.Low = GetFileSize(hFile, &nTotalBytes.u.High); + if ((nTotalBytes.u.Low == 0xFFFFFFFF) && ((GetLastError()) != NO_ERROR)) { + // Internal server error + Report("500 Internal Server Error", HttpMsg500); + // Close file + CloseHandle(hFile); + return; + } + + // Determine buffer size + if (nTotalBytes.Big < 65536) + nBufferSize = 1024; + else + nBufferSize = 32768; + // Allocate memory on heap + lpsBuffer = (PCHAR) malloc(nBufferSize); + + if (lpsBuffer == NULL) { + // Internal server error + Report("500 Internal Server Error", HttpMsg500); + // Close file + CloseHandle(hFile); + return; + } + + SendText("HTTP/1.1 200 OK"); + SendText("Server: ROSHTTPD"); + SendText("MIME-version: 1.0"); + SendText("Content-Type: text/plain"); + SendText("Accept-Ranges: bytes"); + strcpy(str, "Content-Length: "); + _itoa(nTotalBytes.u.Low, str2, 10); + strcat(str, str2); + SendText(str); + SendText(""); + // Read and transmit file + nTotalRead = 0; + nFileSize = nTotalBytes.Big; + bStop = FALSE; + + fd_set wfds; + FD_ZERO(&wfds); + FD_SET(Socket, &wfds); + do { + MessageLoop(); + + if (nTotalRead + nBufferSize < nFileSize) + nBytesToRead = nBufferSize; + else nBytesToRead = nFileSize - nTotalRead; + + bStatus = ReadFile(hFile, lpsBuffer, nBytesToRead, &nBytesRead, NULL); + if (bStatus) { + select(0, NULL, &wfds, NULL, NULL); + bStatus = (Transmit(lpsBuffer, nBytesRead) == (INT)nBytesRead); + nTotalRead += nBytesRead; + } + } while ((!bStop) && (bStatus) && (nTotalRead < nFileSize)); + + if (bStatus) + SendText(""); + else + // We can't send an error message here as we are in the process of sending a file. + // We have to terminate the connection instead + Close(); + + // Free allocated memory + free(lpsBuffer); + + // Close file + CloseHandle(hFile); +} + +// Report something to client +VOID CHttpClient::Report(LPCSTR lpsCode, LPSTR lpsStr) +{ + CHAR sTmp[128]; + CHAR sTmp2[16]; + + strcpy(sTmp, "HTTP/1.1 "); + strcat(sTmp, lpsCode); + SendText(sTmp); + SendText("Server: ROSHTTPD"); + SendText("MIME-version: 1.0"); + SendText("Content-Type: text/html"); + SendText("Accept-Ranges: bytes"); + strcpy(sTmp, "Content-Length: "); + if (lpsStr != NULL) { + _itoa(strlen(lpsStr), sTmp2, 10); + strcat(sTmp, sTmp2); + } else + strcat(sTmp, "0"); + SendText(sTmp); + SendText(""); + if (lpsStr != NULL) + SendText(lpsStr); + SendText(""); +} + +// OnRead event handler +VOID CHttpClient::OnRead() +{ + LONG nCount; + + nCount = Receive((LPSTR) &Parser.sBuffer[Parser.nHead], + sizeof(Parser.sBuffer) - Parser.nHead); + + Parser.nHead += nCount; + if (Parser.nHead >= sizeof(Parser.sBuffer)) + Parser.nHead = 0; + + if (Parser.Complete()) { + ProcessRequest(); + } + + if (Parser.bUnknownMethod) { + // Method Not Allowed + Report("405 Method Not Allowed", HttpMsg405); + // Terminate connection + Close(); + } +} +/* +// OnWrite event handler +VOID CHttpClient::OnWrite() +{ + DWORD nBytesToRead; + DWORD nBytesRead; + + OutputDebugString(TS("Can write\n")); + + if (bSendingFile) { + if (nTotalRead + nBufferSize < nFileSize) + nBytesToRead = nBufferSize; + else nBytesToRead = nFileSize - nTotalRead; + + bError = ReadFile(hFile, Buffer, nBytesToRead, &nBytesRead, NULL); + if (!bError) { + Transmit(Buffer, nBytesRead); + nTotalRead += nBytesRead; + } + } +} +*/ +// OnClose event handler +VOID CHttpClient::OnClose() +{ + // Stop sending file if we are doing that now + bStop = TRUE; +} + + +// ************************ CHttpClientThread ************************ + +// Constructor with client socket as starter value +CHttpClientThread::CHttpClientThread(LPCServerClientSocket lpSocket) +{ + ClientSocket = lpSocket; +} + +// Execute client thread code +VOID CHttpClientThread::Execute() +{ + MSG Msg; + + while (!Terminated()) { + (( CHttpClient *) ClientSocket)->MessageLoop(); + if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE) != 0) { + switch (Msg.message) { + case HTTPD_START: { + // TODO: Start thread + break; + } + case HTTPD_STOP: { + // TODO: Stop thread + break; + } + default: + DispatchMessage(&Msg); + } + + } + } + + if (ClientSocket != NULL) { + delete ClientSocket; + ClientSocket = NULL; + } +} + + +// *************************** CHttpDaemon *************************** + +// Default constructor +CHttpDaemon::CHttpDaemon() +{ + State = hsStopped; + Start(); +} + +// Default destructor +CHttpDaemon::~CHttpDaemon() +{ + if (State==hsRunning) + Stop(); +} + +// Return daemon state +HTTPdState CHttpDaemon::GetState() const +{ + return State; +} + +// Start HTTP daemon +BOOL CHttpDaemon::Start() +{ + assert(State==hsStopped); + + SetPort(pConfiguration->GetPort()); + + Open(); + + State = hsRunning; + + return TRUE; +} + +// Stop HTTP daemon +BOOL CHttpDaemon::Stop() +{ + assert(State==hsRunning); + + Close(); + + State = hsStopped; + + return TRUE; +} + +// OnGetSocket event handler +LPCServerClientSocket CHttpDaemon::OnGetSocket(LPCServerSocket lpServerSocket) +{ + return new CHttpClient(lpServerSocket); +} + +// OnGetThread event handler +LPCServerClientThread CHttpDaemon::OnGetThread(LPCServerClientSocket lpSocket) +{ + return new CHttpClientThread(lpSocket); +} + +// OnAccept event handler +VOID CHttpDaemon::OnAccept(LPCServerClientThread lpThread) +{ +} + + +// ************************ CHttpDaemonThread ************************ + +// Execute daemon thread code +VOID CHttpDaemonThread::Execute() +{ + MSG Msg; + + try { + Daemon = NULL; + Daemon = new CHttpDaemon; + + while (!Terminated()) { + Daemon->MessageLoop(); + if (PeekMessage(&Msg, 0, 0, 0, PM_REMOVE) != 0) { + switch (Msg.message) { + case HTTPD_START: { + if (Daemon->GetState() == hsStopped) + Daemon->Start(); + break; + } + case HTTPD_STOP: { + if (Daemon->GetState() == hsRunning) + Daemon->Stop(); + break; + } + case HTTPD_SUSPEND: { + if (Daemon->GetState() == hsRunning){} + // FIXME: Suspend service + break; + } + case HTTPD_RESUME: { + if (Daemon->GetState() != hsSuspended){} + // FIXME: Resume service + break; + } + default: + DispatchMessage(&Msg); + } + } + } + delete Daemon; + } catch (ESocket e) { + ReportErrorStr(e.what()); + } catch (bad_alloc e) { + ReportErrorStr(TS("Insufficient resources.")); + } +} diff --git a/rosapps/roshttpd/include/config.h b/rosapps/roshttpd/include/config.h new file mode 100644 index 00000000000..e3a702df31b --- /dev/null +++ b/rosapps/roshttpd/include/config.h @@ -0,0 +1,49 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/config.h + */ +#ifndef __CONFIG_H +#define __CONFIG_H + +#include +#include + +// General constants +#define APP_DESCRIPTION _T("ReactOS HTTP Daemon") + +// Default configuration +#define dcfgDescription _T("Default configuration") +#define dcfgMainBase _T("C:\\roshttpd\\") +#define dcfgHttpBase _T("C:\\roshttpd\\HttpBase\\") +#define dcfgDefaultResource _T("index.html") +#define dcfgDefaultPort 80 + +class CConfig { +public: + CConfig(); + ~CConfig(); + VOID Default(); + VOID Clear(); + BOOL Load(); + BOOL Save(); + LPWSTR GetMainBase(); + VOID SetMainBase(LPWSTR lpwsMainBase); + LPSTR GetHttpBase(); + VOID SetHttpBase(LPSTR lpsHttpBase); + CList* GetDefaultResources(); + USHORT GetPort(); + VOID SetPort(USHORT wPort); +private: + VOID Reset(); + LPWSTR MainBase; + LPSTR HttpBase; + CList DefaultResources; + USHORT Port; +}; +typedef CConfig* LPCConfig; + +extern LPCConfig pConfiguration; +extern LPCHttpDaemonThread pDaemonThread; + +#endif /* __CONFIG_H */ diff --git a/rosapps/roshttpd/include/debug.h b/rosapps/roshttpd/include/debug.h new file mode 100644 index 00000000000..5abdc96b18a --- /dev/null +++ b/rosapps/roshttpd/include/debug.h @@ -0,0 +1,17 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/debug.h + */ +#ifndef __DEBUG_H +#define __DEBUG_H + +#include + +#ifdef DBG +#define DPRINT(x, ...) printf(x) +#else +#define DPRINT(x...) +#endif + +#endif /* __DEBUG_H */ diff --git a/rosapps/roshttpd/include/error.h b/rosapps/roshttpd/include/error.h new file mode 100644 index 00000000000..483d9159ddd --- /dev/null +++ b/rosapps/roshttpd/include/error.h @@ -0,0 +1,15 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/error.h + */ +#ifndef __ERROR_H +#define __ERROR_H + +#include + +#define TS(x) (LPTSTR)TEXT(x) + +void ReportErrorStr(LPTSTR lpsText); + +#endif /* __ERROR_H */ diff --git a/rosapps/roshttpd/include/http.h b/rosapps/roshttpd/include/http.h new file mode 100644 index 00000000000..7d97eb5c53a --- /dev/null +++ b/rosapps/roshttpd/include/http.h @@ -0,0 +1,57 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/http.h + */ +#ifndef __HTTP_H +#define __HTTP_H + +#include + +// Generel HTTP related constants +#define NUMMETHODS 7 +#define NUMGENERELS 7 +#define NUMREQUESTS 17 +#define NUMENTITIES 12 + +// HTTP method constants +#define hmOPTIONS 0 +#define hmGET 1 +#define hmHEAD 2 +#define hmPOST 3 +#define hmPUT 4 +#define hmDELETE 5 +#define hmTRACE 6 + +class CHttpParser { +public: + CHAR sBuffer[2048]; + UINT nHead; + UINT nTail; + CHAR sUri[255]; + CHAR sVersion[15]; + CHAR sHeader[63]; + CHAR sMethod[63]; + UINT nMethodNo; + BOOL bUnknownMethod; + BOOL bBadRequest; + CHttpParser(); + ~CHttpParser(); + BOOL Complete(); + BOOL Parse(); +private: + BOOL ReadChar(LPSTR lpsStr); + BOOL PeekChar(LPSTR lpsStr); + BOOL ReadString(LPSTR lpsStr, UINT nLength); + BOOL ReadSpecial(LPSTR lpStr, UINT nLength); + VOID Skip(CHAR sStr); + BOOL Expect(CHAR sStr); + BOOL ExpectCRLF(); + BOOL RequestLine(); + BOOL GenerelHeader(); + BOOL RequestHeader(); + BOOL EntityHeader(); + BOOL MessageBody(); +}; + +#endif /* __HTTP_H */ diff --git a/rosapps/roshttpd/include/httpd.h b/rosapps/roshttpd/include/httpd.h new file mode 100644 index 00000000000..ff85940c837 --- /dev/null +++ b/rosapps/roshttpd/include/httpd.h @@ -0,0 +1,85 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/httpd.h + */ +#ifndef __HTTPD_H +#define __HTTPD_H + +#include +#include +#include + +#define HTTPD_START WM_USER + 1 +#define HTTPD_STOP WM_USER + 2 +#define HTTPD_SUSPEND WM_USER + 3 +#define HTTPD_RESUME WM_USER + 4 + +enum HTTPdState { + hsStopped = 0, + hsRunning, + hsSuspended +}; + +class CHttpDaemon; + +class CHttpClient : public CServerClientSocket { +public: + CHttpClient(); + CHttpClient(LPCServerSocket lpServerSocket); + virtual void OnRead(); + //virtual void OnWrite(); + virtual void OnClose(); + HANDLE ThreadHandle; + DWORD ThreadId; + CHttpParser Parser; + void SplitUri(const LPSTR lpsUri, LPSTR lpsHost, LPSTR lpsResource, LPSTR lpsParams); + void SplitResource(const LPSTR lpsResource, LPSTR lpsPath, LPSTR lpsFilename, LPSTR lpsExtension); + void ProcessRequest(); + void SendFile(const LPSTR lpsFilename); + void Report(LPCSTR lpsCode, const LPSTR lpsStr); +private: + BOOL bStop; + LPSTR lpsBuffer; + LONG nBufferSize; + // unsigned __int64 nTotalRead; + unsigned long long nTotalRead; + // unsigned __int64 nFileSize; + unsigned long long nFileSize; + HANDLE hFile; +}; +typedef CHttpClient* LPCHttpClient; + +class CHttpClientThread : public CServerClientThread { +public: + CHttpClientThread() {}; + CHttpClientThread(LPCServerClientSocket Socket); + virtual void Execute(); +}; +typedef CHttpClientThread* LPCHttpClientThread; + +class CHttpDaemon : public CServerSocket { +public: + CHttpDaemon(); + virtual ~CHttpDaemon(); + HTTPdState GetState() const; + virtual BOOL Start(); + virtual BOOL Stop(); + virtual LPCServerClientSocket OnGetSocket(LPCServerSocket lpServerSocket); + virtual LPCServerClientThread OnGetThread(LPCServerClientSocket Socket); + virtual void OnAccept(const LPCServerClientThread lpThread); +private: + HTTPdState State; +}; +typedef CHttpDaemon* LPCHttpDaemon; + +class CHttpDaemonThread : public CThread { +public: + CHttpDaemonThread() {}; + virtual void Execute(); +private: + CHttpDaemon *Daemon; +}; +typedef CHttpDaemonThread* LPCHttpDaemonThread; + +#endif /* __HTTPD_H */ diff --git a/rosapps/roshttpd/include/iterator.h b/rosapps/roshttpd/include/iterator.h new file mode 100644 index 00000000000..b2eb9bdb978 --- /dev/null +++ b/rosapps/roshttpd/include/iterator.h @@ -0,0 +1,22 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/iterator.h + */ +#ifndef __ITERATOR_H +#define __ITERATOR_H + +#include + +template +class CIterator { +public: + virtual ~CIterator() + {} + virtual VOID First() = 0; + virtual VOID Next() = 0; + virtual BOOL IsDone() const = 0; + virtual Item CurrentItem() const = 0; +}; + +#endif /* __ITERATOR_H */ diff --git a/rosapps/roshttpd/include/list.h b/rosapps/roshttpd/include/list.h new file mode 100644 index 00000000000..914d06ea2cc --- /dev/null +++ b/rosapps/roshttpd/include/list.h @@ -0,0 +1,233 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/list.h + */ +#ifndef __LIST_H +#define __LIST_H + +#include +#include + +class CListNode { +public: + CListNode(); + CListNode(VOID *element, CListNode *next, CListNode *prev); + ~CListNode() {}; + void* operator new(/*size_t s*/ UINT s); + VOID operator delete(void* p); + + VOID SetElement(PVOID element); + VOID SetNext(CListNode *next); + VOID SetPrev(CListNode *prev); + PVOID GetElement(); + CListNode *GetNext(); + CListNode *GetPrev(); +private: + PVOID Element; + CListNode *Next; + CListNode *Prev; + static HANDLE hHeap; + static INT nRef; +}; + +template class CList { +public: + //CList(CList&); + CList(); + ~CList(); + CList& operator=(CList&); + + CIterator *CreateIterator() const; + LONG Count() const; + Item& Get(const LONG index) const; + // Can throw bad_alloc + VOID Insert(Item& element); + VOID Remove(Item& element); + VOID RemoveAll(); + CListNode *GetHeader() const; + CListNode *GetTrailer() const; +private: + CListNode *Search(Item& element) const; + LONG NodeCount; + CListNode *Header; + CListNode *Trailer; +}; + +template class CListIterator : public CIterator { +public: + CListIterator(const CList *list); + virtual VOID First(); + virtual VOID Next(); + virtual BOOL IsDone() const; + virtual Item CurrentItem() const; +private: + const CList *List; + CListNode *Current; +}; + +// ****************************** CList ****************************** + +// Default constructor +template +CList::CList() +{ + // Create dummy nodes + Trailer = new CListNode; + Header = new CListNode; + Header->SetNext(Trailer); + Trailer->SetPrev(Header); +} + +// Default destructor +template +CList::~CList() +{ + RemoveAll(); + delete Trailer; + delete Header; +} + +// Create an iterator for the list +template +CIterator *CList::CreateIterator() const +{ + return new CListIterator((CList *) this); +} + +// Return number of elements in list +template +LONG CList::Count() const +{ + return NodeCount; +} + +// Return element at index +template +Item& CList::Get(const LONG index) const +{ + CListNode *node; + + if ((index < 0) || (index >= NodeCount)) + return NULL; + + node = Header; + for (int i = 0; i <= index; i++) + node = node->GetNext(); + + return (Item *) node->GetElement(); +} + +// Insert an element into the list +template +VOID CList::Insert(Item& element) +{ + CListNode *node; + + node = new CListNode((PVOID)element, Trailer, Trailer->GetPrev()); + Trailer->GetPrev()->SetNext(node); + Trailer->SetPrev(node); + NodeCount++; +} + +// Remove an element from the list +template +VOID CList::Remove(Item& element) +{ + CListNode *node; + + node = Search(element); + if (node != NULL) { + node->GetPrev()->SetNext(node->GetNext()); + node->GetNext()->SetPrev(node->GetPrev()); + NodeCount--; + delete node; + } +} + +// Remove all elements in list +template +VOID CList::RemoveAll() +{ + CListNode *node; + CListNode *tmp; + + node = Header->GetNext(); + while (node != Trailer) { + tmp = node->GetNext(); + delete node; + node = tmp; + } + Header->SetNext(Trailer); + Trailer->SetPrev(Header); + NodeCount = 0; +} + +// Return header node +template +CListNode *CList::GetHeader() const +{ + return Header; +} + +// Return trailer node +template +CListNode *CList::GetTrailer() const +{ + return Trailer; +} + +// Searches for a node that contains the element. Returns NULL if element is not found +template +CListNode *CList::Search(Item& element) const +{ + CListNode *node; + + node = Header; + while (((node = node->GetNext()) != Trailer) && (node->GetElement() != element)); + if (node != Trailer) + return node; + else + return NULL; +} + + +// ************************** CListIterator ************************** + +// Default constructor +template +CListIterator::CListIterator(const CList *list) : List(list) +{ + First(); +} + +// Go to first element in list +template +VOID CListIterator::First() +{ + Current = List->GetHeader()->GetNext(); +} + +// Go to next element in list +template +VOID CListIterator::Next() +{ + if (!IsDone()) + Current = Current->GetNext(); +} + +// Return FALSE when there are more elements in list and TRUE when there are no more +template +BOOL CListIterator::IsDone() const +{ + return (Current == List->GetTrailer()); +} + +// Return current element +template +Item CListIterator::CurrentItem() const +{ + return IsDone()? NULL : (Item) Current->GetElement(); +} + +#endif /* __LIST_H */ diff --git a/rosapps/roshttpd/include/socket.h b/rosapps/roshttpd/include/socket.h new file mode 100644 index 00000000000..db15fe97636 --- /dev/null +++ b/rosapps/roshttpd/include/socket.h @@ -0,0 +1,140 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/socket.h + */ +#ifndef __SOCKET_H +#define __SOCKET_H +#include +#include +#include +#include +#include +#include + +#define MAX_PENDING_CONNECTS 4 // The backlog allowed for listen() + +VOID InitWinsock(); +VOID DeinitWinsock(); + +class CSocket; +class CClientSocket; +class CServerClientSocket; +class CServerClientThread; +class CServerSocket; + +typedef CSocket* LPCSocket; +typedef CClientSocket* LPCClientSocket; +typedef CServerClientSocket* LPCServerClientSocket; +typedef CServerClientThread* LPCServerClientThread; +typedef CServerSocket* LPCServerSocket; + +class ESocket { +public: + ESocket() { Description = NULL; } + ESocket(LPTSTR description) { Description = description; } + LPTSTR what() { return Description; } +protected: + LPTSTR Description; +}; + +class ESocketWinsock : public ESocket { +public: + ESocketWinsock(LPTSTR description) { Description = description; } +}; + +class ESocketDll : public ESocket { +public: + ESocketDll(LPTSTR description) { Description = description; } +}; + +class ESocketOpen : public ESocket { +public: + ESocketOpen(LPTSTR description) { Description = description; } +}; + +class ESocketClose : public ESocket { +public: + ESocketClose(LPTSTR description) { Description = description; } +}; + +class ESocketSend : public ESocket { +public: + ESocketSend(LPTSTR description) { Description = description; } +}; + +class ESocketReceive : public ESocket { +public: + ESocketReceive(LPTSTR description) { Description = description; } +}; + + +class CSocket { +public: + CSocket(); + virtual ~CSocket(); + virtual SOCKET GetSocket(); + virtual VOID SetSocket(SOCKET socket); + virtual SOCKADDR_IN GetSockAddrIn(); + virtual VOID SetSockAddrIn(SOCKADDR_IN sockaddrin); + virtual VOID SetEvents(LONG lEvents); + virtual LONG GetEvents(); + virtual VOID SetPort( UINT nPort) {}; + virtual VOID Open(); + virtual VOID Close(); + virtual INT Transmit( LPCSTR lpsBuffer, UINT nLength) { return 0; }; + virtual INT Receive(LPSTR lpsBuffer, UINT nLength) { return 0; }; + virtual INT SendText( LPCSTR lpsStr) { return 0; }; +protected: + SOCKET Socket; + SOCKADDR_IN SockAddrIn; + WSAEVENT Event; + UINT Port; + BOOL Active; +private: + LONG Events; +}; + +class CServerClientSocket : public CSocket { +public: + CServerClientSocket() {}; + CServerClientSocket(LPCServerSocket lpServerSocket); + CServerSocket *GetServerSocket(); + virtual INT Transmit( LPCSTR lpsBuffer, UINT nLength); + virtual INT Receive(LPSTR lpsBuffer, UINT nLength); + virtual INT SendText( LPCSTR lpsText); + virtual VOID MessageLoop(); + virtual VOID OnRead() {}; + //virtual VOID OnWrite() {}; + virtual VOID OnClose() {}; +protected: + LPCServerSocket ServerSocket; +}; + +class CServerClientThread : public CThread { +public: + CServerClientThread() {}; + CServerClientThread(CServerClientSocket *socket); + virtual ~CServerClientThread(); +protected: + CServerClientSocket *ClientSocket; +}; + +class CServerSocket : public CSocket { +public: + CServerSocket(); + virtual ~CServerSocket(); + virtual VOID SetPort( UINT nPort); + virtual VOID Open(); + virtual VOID Close(); + virtual LPCServerClientSocket OnGetSocket(LPCServerSocket lpServerSocket); + virtual LPCServerClientThread OnGetThread(LPCServerClientSocket lpSocket); + virtual VOID OnAccept( LPCServerClientThread lpThread) {}; + virtual VOID MessageLoop(); + VOID InsertClient(LPCServerClientThread lpClient); + VOID RemoveClient(LPCServerClientThread lpClient); +protected: + CList Connections; +}; + +#endif /* __SOCKET_H */ diff --git a/rosapps/roshttpd/include/thread.h b/rosapps/roshttpd/include/thread.h new file mode 100644 index 00000000000..0b311d4dcdf --- /dev/null +++ b/rosapps/roshttpd/include/thread.h @@ -0,0 +1,34 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: include/thread.h + */ +#ifndef __THREAD_H +#define __THREAD_H + +#include + +class CThread; + +struct ThreadData { + CThread *ClassPtr; + HANDLE hFinished; +}; + +class CThread { +public: + CThread(); + virtual ~CThread(); + BOOL PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam); + virtual void Execute(); + virtual void Terminate(); + BOOL Terminated(); +protected: + BOOL bTerminated; + DWORD dwThreadId; + HANDLE hThread; + ThreadData Data; +}; +typedef CThread *LPCThread; + +#endif /* __THREAD_H */ diff --git a/rosapps/roshttpd/roshttpd.cpp b/rosapps/roshttpd/roshttpd.cpp new file mode 100644 index 00000000000..89af9bf5290 --- /dev/null +++ b/rosapps/roshttpd/roshttpd.cpp @@ -0,0 +1,66 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS HTTP Daemon + * FILE: roshttpd.cpp + * PURPOSE: Main program + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/09/2000 Created + */ +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + + +VOID Run() +{ + InitWinsock(); + + pDaemonThread = NULL; + pConfiguration = NULL; + + try { + // Create configuration object + pConfiguration = new CConfig; + pConfiguration->Default(); + + // Create daemon object + pDaemonThread = new CHttpDaemonThread; + + MSG Msg; + BOOL bQuit = FALSE; + while ((!bQuit) && (!pDaemonThread->Terminated())) { + bQuit = PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE); + if (!bQuit) + DispatchMessage(&Msg); + } + + delete pDaemonThread; + + if (pConfiguration != NULL) + delete pConfiguration; + } catch (bad_alloc e) { + if (pConfiguration != NULL) + delete pConfiguration; + ReportErrorStr(TS("Insufficient resources.")); + } + + DeinitWinsock(); +} + +/* Program entry point */ +int main(int argc, char* argv[]) +{ + printf("ReactOS HTTP Daemon\n"); + printf("Type Control-C to stop.\n"); + + Run(); + + printf("Daemon stopped.\n"); +} diff --git a/rosapps/roshttpd/roshttpd.rbuild b/rosapps/roshttpd/roshttpd.rbuild new file mode 100644 index 00000000000..d293f7cd992 --- /dev/null +++ b/rosapps/roshttpd/roshttpd.rbuild @@ -0,0 +1,23 @@ + + + + include + + + 0x600 + 0x501 + kernel32 + ws2_32 + kernel32 + config.cpp + error.cpp + http.cpp + httpd.cpp + roshttpd.cpp + + list.cpp + roshttpd.rc + socket.cpp + thread.cpp + + diff --git a/rosapps/screenshot/screenshot.c b/rosapps/screenshot/screenshot.c new file mode 100644 index 00000000000..ed83b3d6c95 --- /dev/null +++ b/rosapps/screenshot/screenshot.c @@ -0,0 +1,404 @@ +#include "screenshot.h" + +/* + * Save a screenshot to file until the clipboard + * is ready to accept images. + */ + + +static VOID +GetError(VOID) +{ + LPVOID lpMsgBuf; + + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + MessageBox(NULL, + lpMsgBuf, + _T("Error!"), + MB_OK | MB_ICONERROR); + + LocalFree(lpMsgBuf); +} + + +static BOOL +DoWriteFile(PSCREENSHOT pScrSht, + LPTSTR pstrFileName) +{ + BITMAPFILEHEADER bmfh; + BOOL bSuccess; + DWORD dwBytesWritten; + HANDLE hFile; + //INT PalEntries; + + hFile = CreateFile(pstrFileName, + GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) + return FALSE; + + /* write the BITMAPFILEHEADER to file */ + bmfh.bfType = *(WORD *)"BM"; // 0x4D 0x42 + bmfh.bfReserved1 = 0; + bmfh.bfReserved2 = 0; + bSuccess = WriteFile(hFile, + &bmfh, + sizeof(bmfh), + &dwBytesWritten, + NULL); + if ((!bSuccess) || (dwBytesWritten < sizeof(bmfh))) + goto fail; + + /* write the BITMAPINFOHEADER to file */ + bSuccess = WriteFile(hFile, + &pScrSht->lpbi->bmiHeader, + sizeof(BITMAPINFOHEADER), + &dwBytesWritten, + NULL); + if ((!bSuccess) || (dwBytesWritten < sizeof(BITMAPINFOHEADER))) + goto fail; + + /* calculate the size of the pallete * / + if (pScrSht->lpbi->bmiHeader.biCompression == BI_BITFIELDS) + PalEntries = 3; + else + { + if (pScrSht->lpbi->bmiHeader.biBitCount <= 8) + PalEntries = (INT)(1 << pScrSht->lpbi->bmiHeader.biBitCount); + else + PalEntries = 0; + } + if (pScrSht->lpbi->bmiHeader.biClrUsed) + PalEntries = pScrSht->lpbi->bmiHeader.biClrUsed; + + / * write pallete to file * / + if (PalEntries != 0) + { + bSuccess = WriteFile(hFile, + &pScrSht->lpbi->bmiColors, + PalEntries * sizeof(RGBQUAD), + &dwBytesWritten, + NULL); + if ((!bSuccess) || (dwBytesWritten < PalEntries * sizeof(RGBQUAD))) + goto fail; + } +*/ + /* save the current file position at the bginning of the bitmap bits */ + bmfh.bfOffBits = SetFilePointer(hFile, 0, 0, FILE_CURRENT); + + /* write the bitmap bits to file */ + bSuccess = WriteFile(hFile, + pScrSht->lpvBits, + pScrSht->lpbi->bmiHeader.biSizeImage, + &dwBytesWritten, + NULL); + if ((!bSuccess) || (dwBytesWritten < pScrSht->lpbi->bmiHeader.biSizeImage)) + goto fail; + + /* save the current file position at the final file size */ + bmfh.bfSize = SetFilePointer(hFile, 0, 0, FILE_CURRENT); + + /* rewrite the updated file headers */ + SetFilePointer(hFile, 0, 0, FILE_BEGIN); + bSuccess = WriteFile(hFile, + &bmfh, + sizeof(bmfh), + &dwBytesWritten, + NULL); + if ((!bSuccess) || (dwBytesWritten < sizeof(bmfh))) + goto fail; + + return TRUE; + +fail: + GetError(); + if (hFile) CloseHandle(hFile); + DeleteFile(pstrFileName); + return FALSE; + +} + + +static BOOL +DoSaveFile(HWND hwnd, LPTSTR szFileName) +{ + OPENFILENAME ofn; + + static TCHAR Filter[] = _T("24 bit Bitmap (*.bmp,*.dib)\0*.bmp\0"); + + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrDefExt = _T("bmp"); + ofn.lpstrFilter = Filter; + ofn.lpstrFile = szFileName; + ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + + if (GetSaveFileName(&ofn)) + return TRUE; + + if (CommDlgExtendedError() != CDERR_GENERALCODES) + MessageBox(NULL, _T("Save to file failed"), NULL, 0); + + return FALSE; +} + + +static BOOL +CaptureScreen(PSCREENSHOT pScrSht) +{ + HDC ScreenDC; + RECT rect; + + /* get window resolution */ + //pScrSht->Width = GetSystemMetrics(SM_CXSCREEN); + //pScrSht->Height = GetSystemMetrics(SM_CYSCREEN); + + GetWindowRect(pScrSht->hSelf, &rect); + pScrSht->Width = rect.right - rect.left; + pScrSht->Height = rect.bottom - rect.top; + + /* get a DC for the screen */ + if (!(ScreenDC = GetDC(pScrSht->hSelf))) + return FALSE; + + /* get a bitmap handle for the screen + * needed to convert to a DIB */ + pScrSht->hBitmap = CreateCompatibleBitmap(ScreenDC, + pScrSht->Width, + pScrSht->Height); + if (pScrSht->hBitmap == NULL) + { + GetError(); + ReleaseDC(pScrSht->hSelf, ScreenDC); + return FALSE; + } + + /* get a DC compatable with the screen DC */ + if (!(pScrSht->hDC = CreateCompatibleDC(ScreenDC))) + { + GetError(); + ReleaseDC(pScrSht->hSelf, ScreenDC); + return FALSE; + } + + /* select the bitmap into the DC */ + SelectObject(pScrSht->hDC, + pScrSht->hBitmap); + + /* copy the screen DC to the bitmap */ + BitBlt(pScrSht->hDC, + 0, + 0, + pScrSht->Width, + pScrSht->Height, + ScreenDC, + 0, + 0, + SRCCOPY); + + /* we're finished with the screen DC */ + ReleaseDC(pScrSht->hSelf, ScreenDC); + + return TRUE; +} + + +static BOOL +ConvertDDBtoDIB(PSCREENSHOT pScrSht) +{ + INT Ret; + BITMAP bitmap; + WORD cClrBits; + + +/* + / * can't call GetDIBits with hBitmap selected * / + //SelectObject(hDC, hOldBitmap); + + / * let GetDIBits fill the lpbi structure by passing NULL pointer * / + Ret = GetDIBits(hDC, + hBitmap, + 0, + Height, + NULL, + lpbi, + DIB_RGB_COLORS); + if (Ret == 0) + { + GetError(); + ReleaseDC(hwnd, hDC); + HeapFree(GetProcessHeap(), 0, lpbi); + return -1; + } +*/ + +//////////////////////////////////////////////////// + + if (!GetObjectW(pScrSht->hBitmap, + sizeof(BITMAP), + (LPTSTR)&bitmap)) + { + GetError(); + return FALSE; + } + + cClrBits = (WORD)(bitmap.bmPlanes * bitmap.bmBitsPixel); + if (cClrBits == 1) + cClrBits = 1; + else if (cClrBits <= 4) + cClrBits = 4; + else if (cClrBits <= 8) + cClrBits = 8; + else if (cClrBits <= 16) + cClrBits = 16; + else if (cClrBits <= 24) + cClrBits = 24; + else cClrBits = 32; + + if (cClrBits != 24) + pScrSht->lpbi = (PBITMAPINFO) HeapAlloc(GetProcessHeap(), + 0, + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << cClrBits)); + else + pScrSht->lpbi = (PBITMAPINFO) HeapAlloc(GetProcessHeap(), + 0, + sizeof(BITMAPINFOHEADER)); + + if (!pScrSht->lpbi) + { + GetError(); + return FALSE; + } + + pScrSht->lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pScrSht->lpbi->bmiHeader.biWidth = bitmap.bmWidth; + pScrSht->lpbi->bmiHeader.biHeight = bitmap.bmHeight; + pScrSht->lpbi->bmiHeader.biPlanes = bitmap.bmPlanes; + pScrSht->lpbi->bmiHeader.biBitCount = bitmap.bmBitsPixel; + + if (cClrBits < 24) + pScrSht->lpbi->bmiHeader.biClrUsed = (1 << cClrBits); + + pScrSht->lpbi->bmiHeader.biCompression = BI_RGB; + pScrSht->lpbi->bmiHeader.biSizeImage = ((pScrSht->lpbi->bmiHeader.biWidth * cClrBits +31) & ~31) /8 + * pScrSht->lpbi->bmiHeader.biHeight; + + pScrSht->lpbi->bmiHeader.biClrImportant = 0; + +////////////////////////////////////////////////////// + + /* reserve memory to hold the screen bitmap */ + pScrSht->lpvBits = HeapAlloc(GetProcessHeap(), + 0, + pScrSht->lpbi->bmiHeader.biSizeImage); + if (pScrSht->lpvBits == NULL) + { + GetError(); + return FALSE; + } + + /* convert the DDB to a DIB */ + Ret = GetDIBits(pScrSht->hDC, + pScrSht->hBitmap, + 0, + pScrSht->Height, + pScrSht->lpvBits, + pScrSht->lpbi, + DIB_RGB_COLORS); + if (Ret == 0) + { + GetError(); + return FALSE; + } + + return TRUE; + +} + + +// INT WINAPI GetScreenshot(BOOL bFullScreen) +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + PSTR szCmdLine, + int iCmdShow) +{ + PSCREENSHOT pScrSht; + TCHAR szFileName[MAX_PATH] = _T(""); + + BOOL bFullScreen = TRUE; + + pScrSht = HeapAlloc(GetProcessHeap(), + 0, + sizeof(SCREENSHOT)); + if (pScrSht == NULL) + return -1; + + if (bFullScreen) + { + pScrSht->hSelf = GetDesktopWindow(); + } + else + { + pScrSht->hSelf = GetForegroundWindow(); + } + + if (pScrSht->hSelf == NULL) + { + HeapFree(GetProcessHeap(), + 0, + pScrSht); + + return -1; + } + + if (CaptureScreen(pScrSht)) + { + /* convert the DDB image to DIB */ + if(ConvertDDBtoDIB(pScrSht)) + { + /* Get filename from user */ + if(DoSaveFile(pScrSht->hSelf, szFileName)) + { + /* build the headers and write to file */ + DoWriteFile(pScrSht, szFileName); + } + } + } + + /* cleanup */ + if (pScrSht->hSelf != NULL) + ReleaseDC(pScrSht->hSelf, pScrSht->hDC); + if (pScrSht->hBitmap != NULL) + DeleteObject(pScrSht->hBitmap); + if (pScrSht->lpbi != NULL) + HeapFree(GetProcessHeap(), + 0, + pScrSht->lpbi); + if (pScrSht->lpvBits != NULL) + HeapFree(GetProcessHeap(), + 0, + pScrSht->lpvBits); + if (pScrSht != NULL) + HeapFree(GetProcessHeap(), + 0, + pScrSht); + + return 0; +} diff --git a/rosapps/screenshot/screenshot.h b/rosapps/screenshot/screenshot.h new file mode 100644 index 00000000000..096987e9edc --- /dev/null +++ b/rosapps/screenshot/screenshot.h @@ -0,0 +1,15 @@ +#include +#include + +typedef struct _SCREENSHOT +{ + HWND hSelf; + HDC hDC; + HBITMAP hBitmap; + LPBITMAPINFO lpbi; + LPVOID lpvBits; + INT Width; + INT Height; +} SCREENSHOT, *PSCREENSHOT; + +//INT WINAPI GetScreenshot(VOID); diff --git a/rosapps/screenshot/screenshot.rbuild b/rosapps/screenshot/screenshot.rbuild new file mode 100644 index 00000000000..1d2ed1f6d23 --- /dev/null +++ b/rosapps/screenshot/screenshot.rbuild @@ -0,0 +1,14 @@ + + . + + + + 0x501 + 0x0501 + kernel32 + user32 + gdi32 + comdlg32 + screenshot.c + screenshot.rc + diff --git a/rosapps/screenshot/screenshot.rc b/rosapps/screenshot/screenshot.rc new file mode 100644 index 00000000000..8a73d5c613e --- /dev/null +++ b/rosapps/screenshot/screenshot.rc @@ -0,0 +1,10 @@ +#include + +#define REACTOS_STR_FILE_DESCRIPTION "desktop screenshot app\0" +#define REACTOS_STR_INTERNAL_NAME "screenshot\0" +#define REACTOS_STR_ORIGINAL_FILENAME "screenshot.exe\0" +#include + +#define IDI_ICON 1 + +IDI_ICON ICON "snap.ico" diff --git a/rosapps/screenshot/snap.ico b/rosapps/screenshot/snap.ico new file mode 100644 index 0000000000000000000000000000000000000000..2d0a1a67b3bd9a8115d4830f0b4934fe45fe8ec7 GIT binary patch literal 29926 zcmeHw2Vhjkng0NS#Tbx`Wr-$KK)tP`U9Gh04fVnb_1>kGkX91Xsv^-OQ3cqd7b8<* zz{WNhcL$u9IOoLajuYn`|1XJCE_dfNo4aH*_xom7LIPpqgmW(U_rUDDH*aR%H}j@^ z5x0a~XSU8Ra+Kzk%}GS5bb`eeG<C&>t z^ETkgMl$O(2Q)X6rSoquHO{M>#0Bec!-$(ep7&7T*CLWt5>h$ zfsp^15Of8Pe-uSOf0HvBLF#Qzfi@{CohI7KV9;6Lmcw8uE31esLqkcYFc@U1ia9fC zj5)?RGff#33WZU@=-RMe$(&uAqvB1;jYj8IJYj~}ju@a~qsptIzHw!yQDs<^;cVPnF3PBN);k{^%j={kWW4yYfqr=!?9Bgfu=^0ZvsEkI$wd0?3%_zp~j7B_D zX>8kD;}r_Sc&rR(cC=)-+vc=Rjm0Ac3K^uPxz){fRw)e_@3%Vo0J5)5ePD`mm>Nk* zZSY0arMJg-3=Itp-bM~%h`up2P5iJB!#DbGD~BOo+_*iO4c)jQhNg+1ix*5&%rq(g z_9&1BC+DK^@WVdSeZRd7$CyHfe_^u_-ca0NGZ4N%12sZ;m3?RqL5n5b!{Gz`ZwcQw z(*r6cU1Jp5gXF&;?4x?$n5ds6>LbJ$Glvnwru&E!=J@gUFolBM8b-);f|?lz-SIr%#3o3H?}D;Gh(sOWf(B>G29KtX2x3EX;Pl8z#MB( zv@pebHD+3sQZY0bQ&!Q2c`2qvXRWeO47D;tb~{tFtfyJlQPCP16K#w9Z5oAQRyBjRNbJF2_}q$rz@$!C5giAbXW2 z8@WKfQ8CnvNjb+@X2hCcY%y-RVQk51t!Xy4&^$SaEHtqp0DTl=b}iHrCTCOy1~yOJ z$wY0FZ{<`po*1EGE}Khn6Amw!oSqF2O`Sn7cl1vr#>HPdHK6mEo$TU$@At5X{>985 zg)87^eHMQe=`nm17(;y+E*LUB@Ifel#w~vQokCDQ2g@dTs_}mA0A6o;*N;w(C+OTV zz%MTU%6^WHi=w1cfGwgMBbFY6(Wbcul~A?DU|lXV&Oo1tDJzSPR2U8I=nrc2ca>t$ z$c%MgP9WfBAECk{DY8tg-)lN+md0x zy@Sz!Z=%!Xuo()pH27HhMi~CaK(!K0jZZ+$J=f^kM&ANSF#O4lH}qdLJGN@2J#%t$VlJy3!Ol7}H&-X-?&i$A zJY1NEhX?cW^kAM|p3KMFoq79sGo_C^^HusXe?M=g^7mqaDj(b{nV-Ku^HT*djate4 z)hebARI{K!Kc)@}WZEEq78>Now83f?s#UXyP&Eq-4q`#tU=|!2!otIXm^Lhwg~CUM z2eYuqa26e@WzkV#EH*lft&R<2;n9&SGAfcq#YVH$agi)0E|$f`#j%9d(JVe8o+Tv2 zu+*ezmY5LBQj%A*wA6UEIw^rACMDuJktL<2u+-F4mXVgkGSX97mM)3u)}*rh>=c%! zTf^3@S;N+5X0VL4I+mT4!E{+`+1jiumY1EuvU3sUWwXNk9G0D*%km5IS$<(2D=x}s zc}0b+sHljQ6=$*1l6?3=R#;lhD$9#lZB+r&R~NBjtZ`*!WvsHIjFncFv+Bw+R$g7n zs;a73ZFMQDt*K-cwbiV$uA0@>ma%pEGFDex$*SvWSxtkU)z#IphWa{Ii|cjp`o;#f zZrwU&XeeWbrY2TzXk-oW#+GUy@74$Y+#Ko2G+E`nHiel*SE0s@Gb4@SzB8h zSpIg_+R@J1;5T$Nv#yTytf#AuwRd$eV^0_B?1D$w3*WV&hxPXMu%7-6Y-|5|wqvlD z?cUbQ_U`Cq8#ZAaZrsQ=ZrRK>4Qypw2L{;Yp#io9e*4f?Hn4q&4es2|wr}6Yh7fMs zy_49e+Y$y0tQ` zTCXpR^RiAi#iMk`xVXjEj!OUZ9WwKzYAdz7c6I8@^D^_A3LTY{K~1GQ&a-mzk4uP) z>(qlLTK3G&@fgx(rlrMdHL>MNYd9o#Tx_v$v431znAY)2ulQozf4SJK3&JNbf`hh{(&68MM1HQGRA@Y`DLdmzR^5zoVU<^}?BR ztbz`lyZFMn>V%+97qnGV(=KaM`hA%wKQk>B=s(E^zIklefOP{13^xU)0OyWO)ngc_`K`9IE7dk3y@~#`iTVb6%KE02?0#Au-CL@4v2%3M7IteL^{PCiKWU;r zZ5L{rmzNhGtTEL$xUJ{N*VefuHul0bCc0?51GNMCiS+3Q^G;v?Hry+9o@gI$Z{M!m z%}2iRTD!{5#l_Agu~+XAIDq1tMos0XKXv_;^P^|Zj9$Ke2I-x>gJXAQ9y)sA#h0HL z*|B3sqt+v^{b8BjM1SE|M^BHAj&^0{?Yy?Z$tk$HP9LA1x%trM{+@LusgZ%I#P)Og zrt0$X@(Zs~`mOO@i=9TVIyeQt{mwh(2jk-ln=30zQd3fL_4;EwnyS+?tIwI}QC+N~M>T#nNe0OpTm3Z`2&&IB!z3OieWD&e_^L z`>~~WQ#{jawAyg`uhEdQ@>AWVrZ>JL-8V-HKQ%EW`0hJDG`V-4x~ufxf7k5Z`Tkv{ z|IYhn_x4>SXJ7x(KTG$MuissI_MJE0c;oB%f0xPsQIeT72qZI+li?ToN!bo#e+T`f zSx%iigG`cB=ggVI=0d%7-+lM7`Sa(q2Oor-Ixee9IduuMTVcmmI;~)ij*e{As#VOz z4Kk^_GxPRxWo~Y6Qa1JS_F@5$L&s%N|6Alx*k2%rDp`<5#Z-_*!$UPp1KCrn)v}OK ztx4_-4`Y#Gfj4E(sBjh+8_ps~-i(f7u`$t*HKSNG$(*ZKL*|TPt08kHLgq|LjAJQD zt09A$WX;5sWR{wea8uq)PiDG|M97z^Y^^SxWv)$!%$ds4Gj(hYC6|nqb$eG1Otf;hzRhQ+k($WG}RZ+mo%ZeaZ7BhWq z2`ectWhIa=N!BczkTK1&CFIMd`ZA`kt6>fLYRHk0FZE{mQm>b?W#c-NY}wEV*|KS! zlquJ@tTW4zEv&hvg&Eo)L$mfsu?AY65WbNIZ42B)Zi`}eS%8I>gV_y&J?(bzi z8~fPSO`U9bdk^HpEo=btA<2eA+XmUdj%{q)Hpqp$cChV`3wJ^;+&jFD?bx$h%7>3Y zKHR-;58JzMAKMGr@L|Y>Bl}0#$iV~bz|q6(;6ccR#}2W>$B(k3Cyuc*r;f1`kDX*E zPoI>s;Much*|X0+%U*cl1@`Kzud>%(dyTz*{dM;BuYa9=^PAt4GTje;@B{XO=XNBaB((>n z&{jt!LH1Rf2h=PMSkaI~?R%e2Q%?i-GA!SnnE zdakXGi$eaDcneIo>&M_Kw3xhe0H0N!X{J zTE4HFjpYn&Thjb_b8VN~*l+9}FF!$z@@-eRqE>)Vuo)KfZP5_b4O*E$f!^=BVg;UO zhJ{(rn?29cMrjieR;Z`^YW)QLu9-dc+RQMeGAv&i5|E#7&aWRnFw!54{Eq2a+xKTG z1GH`dnaZTX!Um#GyKiJm|AsAx5^Nn@ebY;Nw-2_~l|(wPZpCwYzjoi2{;q@-NqcQw zj~vZUNG>kUhzt$O@2*Hn)YJ3o9S62-$W}M(9ZEQTCciH#At}4Cu&}wKu)3m|p0k0d zmf-`3_6`l@5ARDF9yxUA@PWho_f}L?v~B!*(yC_u1b5YIEx9;k|o@ zhqI^4E8|W+M(*expO2n7edf%W6L)-mROX-1h}<#Vy?P+oGxC^9H3l}bw`gGEzFM}MiV#RXsCiapq@o--SUc{BTyF*9r4IR1fxNh8+DgBg8 z1O9__;wnv`0pLG0QWvfX4rbc$P!>i!NH}!fks&O~toM$Oi-68M3Oer?@E_5V z|A<{3$6^z}gTSXk&z+c<2)%Y9OHNH;DbR1PNr#?0Bb}|u0N(+gV~tKH_1bH)GFjGI zlU_SJI~zLfY?hyw#fl1`+b%3%g~fTS5PIw)=&no43RqcrA@~XCtKrMQQ;@#8vZ|8R z)Rwa<=&AL!6|7!g10JGI>ZtYg^=ut<)cS^cR!92j#zwZTxrwcB)rf`@=!8hYnm;wO5ccZSZnx4(~V>hEIPwsf#w(lu}1#5Qi- z%rY=@p1yaef&_wC*y`G}p+Gw<009%2M~<^7Ma{rgQidG_R!PeLF39D{Tub-twU{qc`~%pi?P{$Qeid~xxAz6I`@Ps#T6NVvT< ziY+Y{FSfKCS3akxJ=C#CRcN``6<5nGO^ODOq%e(-+A&u9kmbVrmZ@W77hB3%UaMC7 zxGZz@@UUDsYhiXviifYIhKdT4@ef)ru~f`%=Zu;^@A?Hi|?DsX3ep(vX9M{@hE4h zm9?WTIC%NIh0DB``^08Zd{})$vCD(jOB0&PgMHQBYS-8pdT+6@zA|gQ(-I$Tc!j<& zKG-24DJ;L8vHaG$FqfD*pG{pE>TsxH67pjr^AOKcDuF0#N$RPqYH4X}ZEMR&g2-cX z4V9I}*;SR=u$YXPjL6vWX!Fz9?EK2gN*D9p%^+n7u4AokMvPxAg+QXoAHTa9c0(W6 zd-HbUYUAe3m|1Rj8~XbCHryV4S25IwK0o`pnf;)(Yurs*#}+J@FXihcOO`MfXD7(f zF4D$Ja&&;d4+{tgU}}|;1xUNCk_E$N8w`7GU{DYX)&{XqtWVM&8xt;NVw3GPiX}t# zO-YVtDJdpw7@?^3w+W#W;1{OB3X$brxo6eEwHj)VK<*5 zyzQ4-TU*VYwIafKku{#UtXOJw{{oBq(-N&0Ey2A9-7lJB6>mLf!3tmVy`9aR8ME%6 z4-5(O)v6!3e_5#iG8>2G-ndVS_KmQNa0}JA+NoV|9}yi9ACwvt5fu}yHc8A_8WN&b zdMo`SZkmMSed6OSCpWTxazfDLd+@eX%o%GkGA2KsxR$zLlyqX+@-; zug5pl0p4OdAE@#c8nv%L{eH4&k!1lWr|E#a0)DcDjN8x8&A)%1h07|3!$dRMT%gT4 zT?Z&VxIaAZ5$9ow!!t?~gnHncJPRsUz&{9&-9c;){Qrcb?>rlxm@rcJP@B>F9)P!j ze&Dt7_9ohiWt7{N2eM75Ou6%Xn%9Zb}baMK)l};;vi|cn`PkF)C)^-cF>X1f^=pk6&_9XD81>tyqog zn)+IyR;h%mo136^1#VP$dwZe}nC2PkHzC>}qFvm7|NX+j!9n==_=wQZP!S&=FMvrA z1qB5nCnrZ-x^ziUeL6ZiMN(oceS?X)%FoYNC{c#Dw~tu4YSp{2^)0=%5@?sw@Q85H zyK#d^U6am1JBMwJ=$F^Y=r?gm2|PM3MgV8Z1A{d@JSu|M)awQ04PK+KBdMkPy+@x?Tha`pL0O-!Ks4puDD90IQ1j?W6Gn>+)0w`pY7tA|(CjJD=MA zpr88(syNXO{4iGsX*jUJm^XYU`mV2+JEwLBW=cR0%M%h3IQ0|AWBlcpU*?eI#K_19 zhdodL+(hGmQ~ipHig|2Qn0bAmG33S9wHO3!q`arUkKcj*@~G%&(YL9e`u+s{kYlIq zKcIi?R{BFDB7`>Be}aC<+MMV{O9{}$o12?C07BvyzxW0J^{;=;pMU;&`VO4hA5e52 z6&1zNw*_Qo9upNhK|hV>vuD2~+B!RU_r|`lRhR>&wmwbRE|t+SF`$3r6#DPf|EFtz zj0*uA_C)`8cU#3REiEPe`T6<0rly7;IB-Dx>Q}$wz`^qO-g{4UcXxAm8q*xO8;*HU zWMyab&|tM(kLCP}aRlA5ICbh2hi#bOf&OY>yCwa1+yBx2vhSn+2sOTYNLYwSNsgPC zJHYb@E2{^nt>j$u@WT&_BS(&iix)3a9R$!hat)*T2rwo&hf&{vo*e5j%|Bjp41|UR zii|9sIDh`UpmFRxegChGTOCJZ{I6{PARZhVEDG|oh)0lfM__`6_et(sD{00Z{Agxx^*H&=i&uHF&=RRI;T%njt@1ymWmzS3d;M!^J;@GDk zV4mgRM+C0<^5x5U48|bk8(+V`2XWXN__^~J1av?gSaUvI`-A6cNJvbOsb&7{!Jt&#qfbGeOwz9fI4{aJn$UE z--9RS^XAQyYZ-U}4qk&3-N4{*Kv{*i7x+`jZxBySbEc=vmzSN%bBpph&Hcp73~U>k zcK!tY&9FuNZS;e$NJ>rQ)fG8>|H#9_*UN<$&0moHn2 zwshpaK5pQ7+&FA#9JVj|cHpVqd2LOV2oDS7m31`}^bc;|Ha-1ruC1wQX}9$s%>Qyd zCjKWbF@DPWOY_g<{-eT`qB38#nNZuHH z9opGL_LJC{a8XfSDzG71td5J2eXns{gNO(V6uJ31a@|GSQ~L|-rI>d8#k|{|o{=u; zC;o>#@eI^|vJ3J!)gyX!EDs3}722>6j8)V6JGuV^f#(j12;+4Pb-YPmEVgg$=3o8F zD;&C7;py(g(^8W#7VE&H89DYtaqQie*YyqcA_LESy&(C{*(9z>ivu5v20wVUW?VA4c~1$@Fg@-aRe-n4i0#mlDJK z_KGVnJSRrao)*A1iM}nHME};!V$=@5#QAe)#bK1O1?x~pN4wb2+b8<^dPRL* zl}KD2E&|ctqN74FS2hah!R4GoW0!mx`p>RC!*}XGy_t}=uDtlX*f_9-gJzEXJVZC& zif;kiu1H8u;u)DbvA)a5pLqHrUuS6KK7LACgE{tS$@K_$432$KoYs=mH5r_~Wmm^K zv2Al3-_TLd*Ef}mruq`DuP)?e#cM^5E|Dk4hl`j<4UY&_aoySs&{@r~Pl$tGlkJav zRGefI`VQDL#8<7HmjCQ2DJ>J{p1goHdLt*gw`>~}@UlO|p-pkv0C#qE5gwi%^7%#7 z!Ex0};pOYYwIQMW-5>v0&>9O|7|+ek#ah_U;}R2i66S^Myln9KWxP>eCiK+>yu47y z^RkjeW=1?;laYjRnoWHieZ5L-+PaCibs9O1*ZiVFJYT~z(KlcR;lq#Y1N|#$4VmJw zO(Pf>0`dGyFN)KTpA~3x(LZ47H`Iq<|CgTVC)teZcIMod#Q7)A3*hoZkS0iAKav2J zO(HDt9ncqt1+ac15%V%|hhj~3mdMJ>6S>7jqPU`5lwv(1zMeeMU0PKk>ekhZgGUdE zVpH1-Lu-ow-zTant3*Be0QPE$RnE85PnCg8-RpRJ#w1#~c!Gd3^M^z`i(+y2$pYK2x(!&#UU|1j^x$9Nf>L54o-V z$3F&i3o2(9m*+`VO@KVwvc6RuJakYz_u>oU)oWMzWz^~MC(d*1JL3nB9_D+nPVLw` z%(3=yl4l{yQs3b*;KhkwIraEy{^T=HiVII&;1`}ck8yKBoWFRUlSiC5|Kz#JA*?mm% zd2C#q0G?E|qR$L~7XcnZJbwP1xbpmS=ueNMZWqK^gxhxQ5Y*QCrUp?^QY1<$$^`6l z0&A(LK_7t~PONKbn&KN<4T9DgnqzkD*(F1wyUo}Rc|U>V&p&$m_;lTg=1+@Psnv@E zRH`7z;CX7bx)tMP2m0J;$P+I?rv8S~SNR_9e-jrQC(fS#k~nhW7zdr4`ai9Mnc#(T z3i3sMNfFI0v@TJfm;HpoGWfp!KKb3ji+<=}@9+Wm>z{+Sc^dm%b5((=&qWssSuqLx zyc|bQU4BN8&LAZN`k3rYjNe?5TU0=6AjWVR$+Xf}qkjV{D@gyeZ0WLZ0Dm;uBK&Dh zd(WRkm*i{pfYpbQ(NSYZjvW(6j~^R5dgA!lu}4pc6Qd``9(`d^m5bRo^JDJ}ekPfGWBK6CeUpXu%E^JjSB>Fxb&Z}~4Vvkr^eyu8@fN0ZUh6(j8b9q_5z&#~4~vX|ZZ24WR`_5MsMVOg zISzblXhi53(u$DqFrQB=^YeTTe(%x3vSM-Nx#z_7*RPAOUjM52>Q~Jk*T74NtI%n+ z!v+9(#P#>S_dNlgPgK@aU%Q(!KhHGS z9~k_tZ+%OUzRm1!yM{hdeE<937Y7d?+W2|Wb~o<=0C^tvVVGIFI|tZnFP?bv$tiaI zyD9(kNCTMkuYdZ}pGyAvPk;K8xYd97;fGQ;2;KCm&x4-N`i>`_ctUyn`0>}^{~7+L zll*&hjs2}}pF4N1^0SuvMfxvV;ENW3LRh*f;Z@Ulcn~w`KOH33hY$gaV00RuJYVjr zIqaVt0&yYl{}+W5@O>2po2YUKI~H2@IBZM+vmK>q0q{5 z0pTnDM;&zT_j!A|92vK5P)Hs&Dxm?^W7SIg3o~cTKyP5Qt<2(YB!+M`gxMjy#eIr7 zvt3}z_+Z?oLV9!9DMbXl89O6&>cAcRZq6KwVB{fO3wrGI4z|)*$k%5exBW!v>-#6j z%D;z<|0CFNPUG~CWaL@~Pir}KEnhz$_n%37IxsNlX~`llH&0|h9w+QVEA(RpxmgnX zBI)z@{5Rww91TXu?d^bfZi|kI7EQ2eKu1WrDrp<4tgRBor6nQ=b|~0fN02uaUblSN z;Wu-Cp?E2?An21*|KF~>C&YV&q0_O zoMRl_Sa9q-UQ>U*H4bWQx>N@59LBYX)BwH-C{jK#MfB!h1BRVEh zsL-DD{jFdt#o2D6zP?_(^wLY>x4-?Z00u(f96S*L+yUv1fxDMBC9-Q&RF;ZI4jvHL zM>ggC!CLJ{q|^Ph_f!2-(buUhsZT9kVkViP8HZlZ$$N z6>LNh|-R=9y7F1hR zC~(M)oOg0_){^Z?*xFc&2du2nCm(`cca?l+;_4VV{!>%pMS6O&wD&Z%wW1BDzMsZ5 zy`O9dun|t+x`2fuyP)j<)tmBN7ks}{M?L*o1ciPOpkE<#^d zCva{8Ff3`XK}A8QD(yC+xqZEei(fsZ{?V9cpcj{RiGxQDK~MX*I0akT4%o_K*3?Hu22U=R{FKwup?-N-QGLK-USFcWSGvVMEf2{K8zceZ91M zwY0YhvO`U7|ES0)ar#TA10>YMwRD3V&-4u-t6{4}O zL{yf*)}TuiX(_QHV@-_3M^Jl2|VmxncB`|cgEe8jpd_F$c9u>RVnq) zr2F5nxnJ6l2uD`~9HOxYSUzAAC$~Rz_cO89?p?ilHSg-_7DtX96&Ei(1DnW`;yAv^ zBL_#sZs@TKVWZf)XOFIdk|p;?BX&bW(nE*h|P}BD!Ed z1y)4(DV4vP{Qk+;u-V3fmOkJYp8(G9yQ!&Zzb`8*7cH%=u;FbMINwmR(@Rgfc&ZO@grXXCkByD_*xk+TVgCSs!UTUN2iuKxfPa9S zI#8wY^7d{lC@6$}{4tS=HG2)l9@#L8fEOTp9eM1n74^Uiz`kN{R=)3!lvqDx{X^Ij2=|-d z?%@vaA-$`cYwRNHMIYJN+Pr`vaU;gqJG43hi>b0vs=kl^mlTQ`@^7b zcmn=?$in{*Jm{qd9#}~7=?wV4#wJed1nrx_{vP|oBwvzDAF5S}kYM0Rf#)O4qVviX zPaw^-vOMr^TCCsCLcaM|@Ob|f9ue{D74~+QfoUZ9on&|SWlL=jkn9BfF0lE@;KdRo zuBRHjVnnD$;u}}kEjfg=Q`TtM{B0A#>om1Ai(;&^*tbFa*BH*`5_r$pL)O+8AF{D| z26Cyylll58IgY#`SxDmlNiK$*#sl$gs>hNgi%&pq-stJ+N$th3Z^eW5wWMWcj1ew@ zFj6t`abud0U=GD$}eC7wGyJ%wYoqKvXa|?^vW7x;Qan8>e?DK>t=ANEjV>tf}?c>VZjqAsNTSfUM z`qBPM>?xX_e&`?k)oS3^qOoTvUG_-_`{fb?kE#=H7V?*^PzCr9&KWXC2y_i)g!cl5 z)?3n#^8M?uuY~pykerp6nk*t?qhiFoaB+6zIOk3f z9yBXU$0NgnAonFo44e@>m$#RfseK$A)V1I-KZfANU6N$@bU4ri?RN z#L)vg#nvqw_*&rVGBY!H)>`O&AlGMS>v$sSNP4Hzs!9$_)kOKAKd2WvBH(Anw(i)5 zy(=3z&U6`j?Cfd6Sn>e1dJJc;17nH(Ou(xTZ|ff0zju)L^%}<->MD70K^AD&jMdiH z0((`@F^0xEA?JXX9d94E{!N<%uv1h%a9%|uYe|eB;U`1GLpjdX7FchE9+zK<-Q!QorfmzI|N33y-e=;>1eXM~G`$Bu|$ z;I(Ma&y{DN9fKYLIKa)or#&+E$e|HFa^%1muy4S19pZ@Y5aT%28+fK57(mY#m4q^$JYI0NSwb$b1uwqq|9VbiD&=cA6m+wm&k@hai< z>*~kKfQ5&??IX-zUxN-MZ*sYJbB#Rt*heOCUXJJnAKp(gC2*!VS5L~_n3HHv+~4G^ z9$a(=dKS$293V3F0o{Y?d%Gvn_BwD<-n$DniQ3DBte0@SJ=Uw`Gh zYE9rh!J%a4W`#d<>5{-%#)53jWJ@Q06&R}edqKakt7AUx$@uu=kH>(&9HWr-mK-^L z%=ccDPi4S<{u1c^Bk2DFh0y!`;K_>@|C)98UXk=aS`Jtx{LK(cDA^ROU#jtG+5B|h zk2LS&Z;*(q_NKo<@_xk4kp314l?zXNm=(N(ER}v?JNhdnS0|?xzStw`Cky!uKQ=ZG zMuMOEcdSt&2zyoieLa4^VE#NEikP6peue!q;Q6j)=+^uv_?H{_`x~#}c`WwBWoW=x zgaI#3x?k+K!dkUP>OL(jX3@T0>7ajTt;QZr!er9k1zK}fCnR96sA-=d>qz<3zAZ;4Z+tNDK*ldvbq0??7 z%qgv*;E&|{mDn?zot+`#<04^ma-ei#KK7R43>)xTzF12N1kN&(`GEyB(!QIHt`4d5 z#9Sl!A8L!C&E28}`n#mW)z~u@51URFbZM&v&CgiRWq#}l>lrEgYWK2gw>egIm} zV$HjZGjp#^m+nq+c=v+;`1k)1fB60H#m66gEY4pzzv)hC?-UQ+=pfE)I{|+ZyaEmD fd+Njq{9PWhM3Vo6>E|k*(ckYG_wsM};0yjYX(wPZ literal 0 HcmV?d00001 diff --git a/rosapps/sysutils/utils/binpatch/binpatch.rbuild b/rosapps/sysutils/utils/binpatch/binpatch.rbuild new file mode 100644 index 00000000000..935e47e7913 --- /dev/null +++ b/rosapps/sysutils/utils/binpatch/binpatch.rbuild @@ -0,0 +1,7 @@ + + + msvcrt + kernel32 + ntdll + patch.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/binpatch/patch.c b/rosapps/sysutils/utils/binpatch/patch.c new file mode 100644 index 00000000000..1e4e18eadea --- /dev/null +++ b/rosapps/sysutils/utils/binpatch/patch.c @@ -0,0 +1,616 @@ +#include +#include +#include +#include +#include +#include +#include + +/** DEFINES *******************************************************************/ + +#define PATCH_BUFFER_SIZE 4096 /* Maximum size of a patch */ +#define PATCH_BUFFER_MAGIC "\xde\xad\xbe\xef MaGiC MaRk " +#define SIZEOF_PATCH_BUFFER_MAGIC (sizeof (PATCH_BUFFER_MAGIC) - 1) + +/** TYPES *********************************************************************/ + +typedef struct _PatchedByte +{ + int offset; /*!< File offset of the patched byte. */ + unsigned char expected; /*!< Expected (original) value of the byte. */ + unsigned char patched; /*!< Patched (new) value for the byte. */ +} PatchedByte; + +typedef struct _PatchedFile +{ + const char *name; /*!< Name of the file to be patched. */ + int fileSize; /*!< Size of the file in bytes. */ + int patchCount; /*!< Number of patches for the file. */ + PatchedByte *patches; /*!< Patches for the file. */ +} PatchedFile; + +typedef struct _Patch +{ + const char *name; /*!< Name of the patch. */ + int fileCount; /*!< Number of files in the patch. */ + PatchedFile *files; /*!< Files for the patch. */ +} Patch; + +/** FUNCTION PROTOTYPES *******************************************************/ + +static void printUsage(); + +/** GLOBALS *******************************************************************/ + +static Patch m_patch = { NULL, 0, NULL }; +static int m_argc = 0; +static char **m_argv = NULL; + +/* patch buffer where we put the patch info into */ +static char m_patchBuffer[SIZEOF_PATCH_BUFFER_MAGIC + PATCH_BUFFER_SIZE] = + PATCH_BUFFER_MAGIC; + +/** HELPER FUNCTIONS **********************************************************/ + +static void * +loadFile(const char *fileName, int *fileSize_) +{ + FILE *f; + struct stat sb; + int fileSize; + void *p; + + /* Open the file */ + f = fopen(fileName, "rb"); + if (f == NULL) + { + printf("Couldn't open file %s for reading!\n", fileName); + return NULL; + } + + /* Get file size */ + if (fstat(fileno(f), &sb) < 0) + { + fclose(f); + printf("Couldn't get size of file %s!\n", fileName); + return NULL; + } + fileSize = sb.st_size; + + /* Load file */ + p = malloc(fileSize); + if (p == NULL) + { + fclose(f); + printf("Couldn't allocate %d bytes for file %s!\n", fileSize, fileName); + return NULL; + } + + if (fread(p, fileSize, 1, f) != 1) + { + fclose(f); + free(p); + printf("Couldn't read file %s into memory!\n", fileName); + return NULL; + } + + /* Close file */ + fclose(f); + + *fileSize_ = fileSize; + return p; +} + + +static int +saveFile(const char *fileName, void *file, int fileSize) +{ + FILE *f; + + /* Open the file */ + f = fopen(fileName, "wb"); + if (f == NULL) + { + printf("Couldn't open file %s for writing!\n", fileName); + return -1; + } + + /* Write file */ + if (fwrite(file, fileSize, 1, f) != 1) + { + fclose(f); + printf("Couldn't write file %s!\n", fileName); + return -1; + } + + /* Close file */ + fclose(f); + return 0; +} + + +static int +compareFiles( + PatchedFile *patchedFile, + const char *originalFileName) +{ + const char *patchedFileName = patchedFile->name; + unsigned char *origChunk, *patchedChunk; + int origSize, patchedSize, i, patchCount; + PatchedByte *patches = NULL; + int patchesArrayCount = 0; + + /* Load both files */ + origChunk = loadFile(originalFileName, &origSize); + if (origChunk == NULL) + return -1; + patchedChunk = loadFile(patchedFileName, &patchedSize); + if (patchedChunk == NULL) + { + free(origChunk); + return -1; + } + if (origSize != patchedSize) + { + free(origChunk); + free(patchedChunk); + printf("File size of %s and %s differs (%d != %d)\n", + originalFileName, patchedFileName, + origSize, patchedSize); + return -1; + } + + /* Compare the files and record any differences */ + printf("Comparing %s to %s", originalFileName, patchedFileName); + for (i = 0, patchCount = 0; i < origSize; i++) + { + if (origChunk[i] != patchedChunk[i]) + { + patchCount++; + + /* Resize patches array if needed */ + if (patchesArrayCount < patchCount) + { + PatchedByte *newPatches; + newPatches = realloc(patches, patchCount * sizeof (PatchedByte)); + if (newPatches == NULL) + { + if (patches != NULL) + free(patches); + free(origChunk); + free(patchedChunk); + printf("\nOut of memory (tried to allocated %d bytes)\n", + patchCount * sizeof (PatchedByte)); + return -1; + } + patches = newPatches; + } + + /* Fill in patch info */ + patches[patchCount - 1].offset = i; + patches[patchCount - 1].expected = origChunk[i]; + patches[patchCount - 1].patched = patchedChunk[i]; + } + if ((i % (origSize / 40)) == 0) + printf("."); + } + printf(" %d changed bytes found.\n", patchCount); + + /* Unload the files */ + free(origChunk); + free(patchedChunk); + + /* Save patch info */ + patchedFile->fileSize = patchedSize; + patchedFile->patchCount = patchCount; + patchedFile->patches = patches; + + return 0; +} + + +static int +outputPatch(const char *outputFileName) +{ + char *patchExe, *patchBuffer = NULL; + int i, size, patchExeSize, patchSize, stringSize, stringOffset, patchOffset; + Patch *patch; + PatchedFile *files; + + printf("Putting patch into %s...\n", outputFileName); + + /* Calculate size of the patch */ + patchSize = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount; + stringSize = strlen(m_patch.name) + 1; + for (i = 0; i < m_patch.fileCount; i++) + { + stringSize += strlen(m_patch.files[i].name) + 1; + patchSize += sizeof (PatchedByte) * m_patch.files[i].patchCount; + } + if ((stringSize + patchSize) > PATCH_BUFFER_SIZE) + { + printf("Patch is too big - %d bytes maximum, %d bytes needed\n", + PATCH_BUFFER_SIZE, stringSize + patchSize); + return -1; + } + + /* Load patch.exe file into memory... */ + patchExe = loadFile(m_argv[0], &patchExeSize); + if (patchExe == NULL) + { + return -1; + } + + /* Try to find the magic mark for the patch buffer */ + for (i = 0; i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC); i++) + { + if (memcmp(patchExe + i, m_patchBuffer, SIZEOF_PATCH_BUFFER_MAGIC) == 0) + { + patchBuffer = patchExe + i + SIZEOF_PATCH_BUFFER_MAGIC; + + break; + } + } + if (!(i < (patchExeSize - SIZEOF_PATCH_BUFFER_MAGIC))) + { + free(patchExe); + printf("Couldn't find patch buffer magic in file %s - this shouldn't happen!!!\n", m_argv[0]); + return -1; + } + + /* Pack patch together and replace string pointers by offsets */ + patch = (Patch *)patchBuffer; + files = (PatchedFile *)(patchBuffer + sizeof (Patch)); + patchOffset = sizeof (Patch) + sizeof (PatchedFile) * m_patch.fileCount; + stringOffset = patchSize; + + patch->fileCount = m_patch.fileCount; + patch->files = (PatchedFile *)sizeof (Patch); + + patch->name = (const char *)stringOffset; + strcpy(patchBuffer + stringOffset, m_patch.name); + stringOffset += strlen(m_patch.name) + 1; + + for (i = 0; i < m_patch.fileCount; i++) + { + files[i].fileSize = m_patch.files[i].fileSize; + files[i].patchCount = m_patch.files[i].patchCount; + + files[i].name = (const char *)stringOffset; + strcpy(patchBuffer + stringOffset, m_patch.files[i].name); + stringOffset += strlen(m_patch.files[i].name) + 1; + + size = files[i].patchCount * sizeof (PatchedByte); + files[i].patches = (PatchedByte *)patchOffset; + memcpy(patchBuffer + patchOffset, m_patch.files[i].patches, size); + patchOffset += size; + } + size = patchSize + stringSize; + memset(patchBuffer + size, 0, PATCH_BUFFER_SIZE - size); + + /* Save file */ + if (saveFile(outputFileName, patchExe, patchExeSize) < 0) + { + free(patchExe); + return -1; + } + free(patchExe); + + printf("Patch saved!\n"); + return 0; +} + + +static int +loadPatch() +{ + char *p; + Patch *patch; + int i; + + p = m_patchBuffer + SIZEOF_PATCH_BUFFER_MAGIC; + patch = (Patch *)p; + + if (patch->name == NULL) + { + return -1; + } + + m_patch.name = p + (int)patch->name; + m_patch.fileCount = patch->fileCount; + m_patch.files = (PatchedFile *)(p + (int)patch->files); + + for (i = 0; i < m_patch.fileCount; i++) + { + m_patch.files[i].name = p + (int)m_patch.files[i].name; + m_patch.files[i].patches = (PatchedByte *)(p + (int)m_patch.files[i].patches); + } + + printf("Patch %s loaded...\n", m_patch.name); + return 0; +} + + +/** MAIN FUNCTIONS ************************************************************/ + +static int +createPatch() +{ + int i, status; + const char *outputFileName; + + /* Check argument count */ + if (m_argc < 6 || (m_argc % 2) != 0) + { + printUsage(); + return -1; + } + + outputFileName = m_argv[3]; + m_patch.name = m_argv[2]; + + /* Allocate PatchedFiles array */ + m_patch.fileCount = (m_argc - 4) / 2; + m_patch.files = malloc(m_patch.fileCount * sizeof (PatchedFile)); + if (m_patch.files == NULL) + { + printf("Out of memory!\n"); + return -1; + } + memset(m_patch.files, 0, m_patch.fileCount * sizeof (PatchedFile)); + + /* Compare original to patched files and fill m_patch.files array */ + for (i = 0; i < m_patch.fileCount; i++) + { + m_patch.files[i].name = m_argv[4 + (i * 2) + 1]; + status = compareFiles(m_patch.files + i, m_argv[4 + (i * 2) + 0]); + if (status < 0) + { + for (i = 0; i < m_patch.fileCount; i++) + { + if (m_patch.files[i].patches != NULL) + free(m_patch.files[i].patches); + } + free(m_patch.files); + m_patch.files = NULL; + m_patch.fileCount = 0; + return status; + } + } + + /* Output patch */ + return outputPatch(outputFileName); +} + + +static int +applyPatch() +{ + int c, i, j, fileSize, makeBackup; + unsigned char *file; + char *p; + const char *fileName; + char buffer[MAX_PATH]; + + + if (m_argc > 1 && strcmp(m_argv[1], "-d") != 0) + { + printUsage(); + return -1; + } + + /* Load patch */ + if (loadPatch() < 0) + { + printf("This executable doesn't contain a patch, use -c to create one.\n"); + return -1; + } + + if (m_argc > 1) + { + /* Dump patch */ + printf("Patch name: %s\n", m_patch.name); + printf("File count: %d\n", m_patch.fileCount); + for (i = 0; i < m_patch.fileCount; i++) + { + printf("----------------------\n" + "File name: %s\n" + "File size: %d bytes\n", + m_patch.files[i].name, m_patch.files[i].fileSize); + printf("Patch count: %d\n", m_patch.files[i].patchCount); + for (j = 0; j < m_patch.files[i].patchCount; j++) + { + printf(" Offset 0x%x 0x%02x -> 0x%02x\n", + m_patch.files[i].patches[j].offset, + m_patch.files[i].patches[j].expected, + m_patch.files[i].patches[j].patched); + } + } + } + else + { + /* Apply patch */ + printf("Applying patch...\n"); + for (i = 0; i < m_patch.fileCount; i++) + { + /* Load original file */ + fileName = m_patch.files[i].name; +applyPatch_retry_file: + file = loadFile(fileName, &fileSize); + if (file == NULL) + { + printf("File %s not found! ", fileName); +applyPatch_file_open_error: + printf("(S)kip, (R)etry, (A)bort, (M)anually enter filename"); + do + { + c = getch(); + } + while (c != 's' && c != 'r' && c != 'a' && c != 'm'); + printf("\n"); + if (c == 's') + { + continue; + } + else if (c == 'r') + { + goto applyPatch_retry_file; + } + else if (c == 'a') + { + return 0; + } + else if (c == 'm') + { + if (fgets(buffer, sizeof (buffer), stdin) == NULL) + { + printf("fgets() failed!\n"); + return -1; + } + p = strchr(buffer, '\r'); + if (p != NULL) + *p = '\0'; + p = strchr(buffer, '\n'); + if (p != NULL) + *p = '\0'; + + fileName = buffer; + goto applyPatch_retry_file; + } + } + + /* Check file size */ + if (fileSize != m_patch.files[i].fileSize) + { + free(file); + printf("File %s has unexpected filesize of %d bytes (%d bytes expected)\n", + fileName, fileSize, m_patch.files[i].fileSize); + if (fileName != m_patch.files[i].name) /* manually entered filename */ + { + goto applyPatch_file_open_error; + } + return -1; + } + + /* Ask for backup */ + printf("Do you want to make a backup of %s? (Y)es, (N)o, (A)bort", fileName); + do + { + c = getch(); + } + while (c != 'y' && c != 'n' && c != 'a'); + printf("\n"); + if (c == 'y') + { + char buffer[MAX_PATH]; + _snprintf(buffer, MAX_PATH, "%s.bak", fileName); + buffer[MAX_PATH-1] = '\0'; + makeBackup = 1; + if (access(buffer, 0) >= 0) /* file exists */ + { + printf("File %s already exists, overwrite? (Y)es, (N)o, (A)bort", buffer); + do + { + c = getch(); + } + while (c != 'y' && c != 'n' && c != 'a'); + printf("\n"); + if (c == 'n') + makeBackup = 0; + else if (c == 'a') + { + free(file); + return 0; + } + } + if (makeBackup && saveFile(buffer, file, fileSize) < 0) + { + free(file); + return -1; + } + } + else if (c == 'a') + { + free(file); + return 0; + } + + /* Patch file */ + for (j = 0; j < m_patch.files[i].patchCount; j++) + { + int offset = m_patch.files[i].patches[j].offset; + if (file[offset] != m_patch.files[i].patches[j].expected) + { + printf("Unexpected value in file %s at offset 0x%x: expected = 0x%02x, found = 0x%02x\n", + fileName, offset, m_patch.files[i].patches[j].expected, file[offset]); + free(file); + return -1; + } + file[offset] = m_patch.files[i].patches[j].patched; + } + + /* Save file */ + if (saveFile(fileName, file, fileSize) < 0) + { + free(file); + return -1; + } + free(file); + } + + printf("Patch applied sucessfully!\n"); + } + + return 0; +} + + +static void +printUsage() +{ + printf("Usage:\n" + "%s -c - Create patch\n" + "%s -d - Dump patch\n" + "%s - Apply patch\n" + "\n" + "A patch can be created like this:\n" + "%s -c \"patch name\" output.exe file1.orig file1.patched[ file2.orig file2.patched[ ...]]\n", + m_argv[0], m_argv[0], m_argv[0], m_argv[0]); +} + + +int +main( + int argc, + char *argv[]) +{ + m_argc = argc; + m_argv = argv; + + if (argc >= 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)) + { + printUsage(); + return 0; + } + else if (argc >= 2 && argv[1][0] == '-') + { + if (strcmp(argv[1], "-c") == 0) + { + return createPatch(); + } + else if (strcmp(argv[1], "-d") == 0) + { + return applyPatch(); + } + else + { + printf("Unknown option: %s\n" + "Use -h for help.\n", + argv[1]); + return -1; + } + } + + return applyPatch(); +} + diff --git a/rosapps/sysutils/utils/cat/cat.c b/rosapps/sysutils/utils/cat/cat.c new file mode 100644 index 00000000000..97fbf38387b --- /dev/null +++ b/rosapps/sysutils/utils/cat/cat.c @@ -0,0 +1,26 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + int i; + FILE* in; + char ch; + + for (i=1; i + + msvcrt + kernel32 + ntdll + cat.c +
\ No newline at end of file diff --git a/rosapps/sysutils/utils/driver/driver.rbuild b/rosapps/sysutils/utils/driver/driver.rbuild new file mode 100644 index 00000000000..357808e87df --- /dev/null +++ b/rosapps/sysutils/utils/driver/driver.rbuild @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/rosapps/sysutils/utils/driver/load/load.c b/rosapps/sysutils/utils/driver/load/load.c new file mode 100644 index 00000000000..3ec87d32f46 --- /dev/null +++ b/rosapps/sysutils/utils/driver/load/load.c @@ -0,0 +1,33 @@ +/* + * Load a device driver + */ +#define WIN32_NO_STATUS +#include +#include +#include + +int wmain(int argc, WCHAR * argv[]) +{ + NTSTATUS Status; + UNICODE_STRING ServiceName; + + if (argc != 2) + { + wprintf(L"Usage: load \n"); + return 0; + } + ServiceName.Length = (wcslen(argv[1]) + 52) * sizeof(WCHAR); + ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL)); + wsprintf(ServiceName.Buffer, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S", + argv[1]); + wprintf(L"%s %u %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer)); + Status = NtLoadDriver(&ServiceName); + free(ServiceName.Buffer); + if (!NT_SUCCESS(Status)) + { + wprintf(L"Failed: %x\n", Status); + return 1; + } + return 0; +} diff --git a/rosapps/sysutils/utils/driver/load/load.rbuild b/rosapps/sysutils/utils/driver/load/load.rbuild new file mode 100644 index 00000000000..851850ba532 --- /dev/null +++ b/rosapps/sysutils/utils/driver/load/load.rbuild @@ -0,0 +1,8 @@ + + + msvcrt + kernel32 + ntdll + user32 + load.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/driver/unload/unload.c b/rosapps/sysutils/utils/driver/unload/unload.c new file mode 100644 index 00000000000..8f6e655b251 --- /dev/null +++ b/rosapps/sysutils/utils/driver/unload/unload.c @@ -0,0 +1,33 @@ +/* + * Unload a device driver + */ +#define WIN32_NO_STATUS +#include +#include +#include + +int wmain(int argc, WCHAR * argv[]) +{ + NTSTATUS Status; + UNICODE_STRING ServiceName; + + if (argc != 2) + { + wprintf(L"Usage: unload \n"); + return 0; + } + ServiceName.Length = (wcslen(argv[1]) + 52) * sizeof(WCHAR); + ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL)); + wsprintf(ServiceName.Buffer, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S", + argv[1]); + wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer)); + Status = NtUnloadDriver(&ServiceName); + free(ServiceName.Buffer); + if (!NT_SUCCESS(Status)) + { + wprintf(L"Failed: %X\n", Status); + return 1; + } + return 0; +} diff --git a/rosapps/sysutils/utils/driver/unload/unload.rbuild b/rosapps/sysutils/utils/driver/unload/unload.rbuild new file mode 100644 index 00000000000..e8f7da0e6ee --- /dev/null +++ b/rosapps/sysutils/utils/driver/unload/unload.rbuild @@ -0,0 +1,8 @@ + + + msvcrt + kernel32 + ntdll + user32 + unload.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/infinst/infinst.c b/rosapps/sysutils/utils/infinst/infinst.c new file mode 100644 index 00000000000..4b321b1f3b1 --- /dev/null +++ b/rosapps/sysutils/utils/infinst/infinst.c @@ -0,0 +1,84 @@ +/* + * ReactOS INF Helper + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * PROJECT: INF Helper + * FILE: infinst.c + * PURPOSE: Pass INF files to setupapi.dll for execution + * PROGRAMMER: Michael Biggins + * UPDATE HISTORY: + * Created 19/09/2004 + */ +#include +#include +#include + +#ifdef UNICODE +VOID WINAPI InstallHinfSectionW(HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show); +#define InstallHinfSection InstallHinfSectionW +#else +VOID WINAPI InstallHinfSectionA(HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show); +#define InstallHinfSection InstallHinfSectionA +#endif + +#define FILEOPEN_FILTER TEXT("Inf Files (*.inf)\0*.inf\0All Files (*.*)\0*.*\0\0") +#define FILEOPEN_TITLE TEXT("INF file to process") +#define FILEOPEN_DEFEXT TEXT(".inf") +#define INF_COMMAND TEXT("DefaultInstall 128 %s") + +int +_tmain(int argc, TCHAR *argv[]) +{ + TCHAR infCommand[MAX_PATH + 32]; + + if (argc <= 1) + { + TCHAR FileName[MAX_PATH + 1]; + OPENFILENAME ofc; + int rv; + + ZeroMemory(&ofc, sizeof(ofc)); + ZeroMemory(FileName, MAX_PATH + 1); + ofc.lStructSize = sizeof(ofc); + ofc.lpstrFilter = FILEOPEN_FILTER; + ofc.nFilterIndex = 1; + ofc.lpstrTitle = FILEOPEN_TITLE; + ofc.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_PATHMUSTEXIST; + ofc.lpstrDefExt = FILEOPEN_DEFEXT; + ofc.lpstrFile = FileName; + ofc.nMaxFile = sizeof(FileName) / sizeof(TCHAR); + + rv = GetOpenFileName(&ofc); + + if (rv == 0) + return 1; + + _stprintf(infCommand, INF_COMMAND, FileName); + } + else + { + if (_tcslen(argv[1]) > MAX_PATH) + { + MessageBox(NULL, TEXT("Command line too long to be a valid file name"), NULL, MB_OK | MB_ICONERROR); + return 2; /* User error */ + } + _stprintf(infCommand, INF_COMMAND, argv[1]); + } + + InstallHinfSection(NULL, NULL, infCommand, 0); + + return 0; +} diff --git a/rosapps/sysutils/utils/infinst/infinst.rbuild b/rosapps/sysutils/utils/infinst/infinst.rbuild new file mode 100644 index 00000000000..d30aa7b21b4 --- /dev/null +++ b/rosapps/sysutils/utils/infinst/infinst.rbuild @@ -0,0 +1,10 @@ + + + msvcrt + kernel32 + ntdll + user32 + setupapi + comdlg32 + infinst.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/nts2w32err/nts2w32err.c b/rosapps/sysutils/utils/nts2w32err/nts2w32err.c new file mode 100644 index 00000000000..54ac4c258bc --- /dev/null +++ b/rosapps/sysutils/utils/nts2w32err/nts2w32err.c @@ -0,0 +1,56 @@ +/* $Id$ + * + * Convert NTSTATUS codes to Win32 error codes: run it + * on a NT box AND on a ROS box, then diff the results. + * + * This utility should help keeping correct how Ros + * translates executive's errors codes into Win32 error + * codes. + * + * Usage: nts2w32err [MaxStatusCode] > log.txt + * + * 2004-01-10 Emanuele Aliberti + * + */ +#define WIN32_NO_STATUS +#include +#include +#include +#include + +int main (int argc, char * argv []) +{ + NTSTATUS Severity = 0; + NTSTATUS StatusCode = STATUS_SUCCESS; + NTSTATUS Status = STATUS_SUCCESS; + DWORD LastError = ERROR_SUCCESS; + DWORD Maximum = 0x40000; + + if (2 == argc) + { + sscanf (argv[1], "%lx", & Maximum); + } + + printf ("NT error codes 0x0-0x%lx that get translated *not* to ERROR_MR_MID_NOT_FOUND (317)\n\n", Maximum); + + for ( Severity = 0; + Severity < 4; + Severity ++) + { + printf ("--- Severity %ld ---\n", Severity); + + for ( StatusCode = STATUS_SUCCESS; + StatusCode <= Maximum ; + StatusCode ++) + { + Status = ((Severity << 30) | StatusCode); + LastError = RtlNtStatusToDosError (Status); + if (ERROR_MR_MID_NOT_FOUND != LastError) + { + printf ("0x%08lx => %ldL\n", Status, LastError); + } + } + } + return EXIT_SUCCESS; +} +/* EOF */ diff --git a/rosapps/sysutils/utils/nts2w32err/nts2w32err.rbuild b/rosapps/sysutils/utils/nts2w32err/nts2w32err.rbuild new file mode 100644 index 00000000000..5318fa4864b --- /dev/null +++ b/rosapps/sysutils/utils/nts2w32err/nts2w32err.rbuild @@ -0,0 +1,7 @@ + + + msvcrt + kernel32 + ntdll + nts2w32err.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/objdir/objdir.c b/rosapps/sysutils/utils/objdir/objdir.c new file mode 100644 index 00000000000..016060a774c --- /dev/null +++ b/rosapps/sysutils/utils/objdir/objdir.c @@ -0,0 +1,380 @@ +/* $Id$ + * + * DESCRIPTION: Object Manager Simple Explorer + * PROGRAMMER: David Welch + * REVISIONS + * 2000-04-30 (ea) + * Added directory enumeration. + * (tested under nt4sp4/x86) + * 2000-08-11 (ea) + * Added symbolic link expansion. + * (tested under nt4sp4/x86) + * 2001-05-01 (ea) + * Fixed entries counter. Added more + * error codes check. Removed wprintf, + * because it does not work in .17. + * 2001-05-02 (ea) + * Added -r option. + */ + +#define WIN32_NO_STATUS +#include +#include +#include +#include + +#define MAX_DIR_ENTRY 256 + + +static +PCHAR +STDCALL +RawUszAsz ( + PWCHAR szU, + PCHAR szA + ) +{ + register PCHAR a = szA; + + while (*szU) {*szA++ = (CHAR) (0x00ff & * szU++);} + *szA = '\0'; + return a; +} + + +static +PWCHAR +STDCALL +RawAszUsz ( + PCHAR szA, + PWCHAR szW + ) +{ + register PWCHAR w = szW; + + while (*szA) {*szW++ = (WCHAR) *szA++;} + *szW = L'\0'; + return w; +} + + +static +const char * +STDCALL +StatusToName (NTSTATUS Status) +{ + static char RawValue [16]; + + switch (Status) + { + case STATUS_BUFFER_TOO_SMALL: + return "STATUS_BUFFER_TOO_SMALL"; + case STATUS_INVALID_PARAMETER: + return "STATUS_INVALID_PARAMETER"; + case STATUS_OBJECT_NAME_INVALID: + return "STATUS_OBJECT_NAME_INVALID"; + case STATUS_OBJECT_NAME_NOT_FOUND: + return "STATUS_OBJECT_NAME_NOT_FOUND"; + case STATUS_OBJECT_PATH_SYNTAX_BAD: + return "STATUS_PATH_SYNTAX_BAD"; + case STATUS_NO_MORE_ENTRIES: + return "STATUS_NO_MORE_ENTRIES"; + case STATUS_MORE_ENTRIES: + return "STATUS_MORE_ENTRIES"; + case STATUS_ACCESS_DENIED: + return "STATUS_ACCESS_DENIED"; + case STATUS_UNSUCCESSFUL: + return "STATUS_UNSUCCESSFUL"; + case STATUS_INVALID_HANDLE: + return "STATUS_INVALID_HANDLE"; + } + sprintf (RawValue, "0x%08lx", Status); + return (const char *) RawValue; +} + + +BOOL +STDCALL +ExpandSymbolicLink ( + IN PUNICODE_STRING DirectoryName, + IN PUNICODE_STRING SymbolicLinkName, + IN OUT PUNICODE_STRING TargetObjectName + ) +{ + NTSTATUS Status; + HANDLE hSymbolicLink; + OBJECT_ATTRIBUTES oa; + UNICODE_STRING Path; + WCHAR PathBuffer [MAX_PATH]; + ULONG DataWritten = 0; + + + Path.Buffer = PathBuffer; + Path.Length = 0; + Path.MaximumLength = sizeof PathBuffer; + + RtlCopyUnicodeString (& Path, DirectoryName); + if (L'\\' != Path.Buffer [(Path.Length / sizeof Path.Buffer[0]) - 1]) + { + RtlAppendUnicodeToString (& Path, L"\\"); + } + RtlAppendUnicodeStringToString (& Path, SymbolicLinkName); + + oa.Length = sizeof (OBJECT_ATTRIBUTES); + oa.ObjectName = & Path; + oa.Attributes = 0; /* OBJ_CASE_INSENSITIVE; */ + oa.RootDirectory = NULL; + oa.SecurityDescriptor = NULL; + oa.SecurityQualityOfService = NULL; + + Status = NtOpenSymbolicLinkObject( + & hSymbolicLink, + SYMBOLIC_LINK_QUERY, /* 0x20001 */ + & oa + ); + + if (!NT_SUCCESS(Status)) + { + printf ( + "Failed to open SymbolicLink object (Status: %s)\n", + StatusToName (Status) + ); + return FALSE; + } + TargetObjectName->Length = TargetObjectName->MaximumLength; + memset ( + TargetObjectName->Buffer, + 0, + TargetObjectName->MaximumLength + ); + Status = NtQuerySymbolicLinkObject( + hSymbolicLink, + TargetObjectName, + & DataWritten + ); + if (!NT_SUCCESS(Status)) + { + printf ( + "Failed to query SymbolicLink object (Status: %s)\n", + StatusToName (Status) + ); + NtClose (hSymbolicLink); + return FALSE; + } + NtClose (hSymbolicLink); + return TRUE; +} + + +BOOL +STDCALL +ListDirectory ( + IN PUNICODE_STRING DirectoryNameW, + IN BOOL Recurse + ) +{ + CHAR DirectoryNameA [MAX_PATH]; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + HANDLE DirectoryHandle; + BYTE DirectoryEntry [512]; + POBJECT_DIRECTORY_INFORMATION pDirectoryEntry = (POBJECT_DIRECTORY_INFORMATION) DirectoryEntry; + POBJECT_DIRECTORY_INFORMATION pDirectoryEntries = (POBJECT_DIRECTORY_INFORMATION) DirectoryEntry; + ULONG Context = 0; + ULONG ReturnLength = 0; + ULONG EntryCount = 0; + + /* For expanding symbolic links */ + WCHAR TargetName [2 * MAX_PATH]; + UNICODE_STRING TargetObjectName = { + sizeof TargetName, + sizeof TargetName, + TargetName + }; + + /* Convert to ANSI the directory's name */ + RawUszAsz (DirectoryNameW->Buffer, DirectoryNameA); + /* + * Prepare parameters for next call. + */ + InitializeObjectAttributes ( + & ObjectAttributes, + DirectoryNameW, + 0, + NULL, + NULL + ); + /* + * Try opening the directory. + */ + Status = NtOpenDirectoryObject ( + & DirectoryHandle, + DIRECTORY_QUERY, + & ObjectAttributes + ); + if (!NT_SUCCESS(Status)) + { + printf ( + "Failed to open directory object \"%s\" (Status: %s)\n", + DirectoryNameA, + StatusToName (Status) + ); + return (FALSE); + } + printf ("\n Directory of %s\n\n", DirectoryNameA); + + for(;;) + { + /* + * Enumerate each item in the directory. + */ + Status = NtQueryDirectoryObject ( + DirectoryHandle, + pDirectoryEntries, + sizeof DirectoryEntry, + FALSE,/* ReturnSingleEntry */ + FALSE, /* RestartScan */ + & Context, + & ReturnLength + ); + if (!NT_SUCCESS(Status) && Status != STATUS_NO_MORE_ENTRIES) + { + printf ( + "Failed to query directory object (Status: %s)\n", + StatusToName (Status) + ); + NtClose (DirectoryHandle); + return (FALSE); + } + if (Status == STATUS_NO_MORE_ENTRIES) + { + break; + } + pDirectoryEntry = pDirectoryEntries; + while (EntryCount < Context) + { + CHAR ObjectNameA [MAX_PATH]; + CHAR TypeNameA [MAX_PATH]; + CHAR TargetNameA [MAX_PATH]; + + if (0 == wcscmp (L"SymbolicLink", pDirectoryEntry->TypeName.Buffer)) + { + if (TRUE == ExpandSymbolicLink ( + DirectoryNameW, + & pDirectoryEntry->Name, + & TargetObjectName + ) + ) + { + + printf ( + "%-16s %s -> %s\n", + RawUszAsz (pDirectoryEntry->TypeName.Buffer, TypeNameA), + RawUszAsz (pDirectoryEntry->Name.Buffer, ObjectNameA), + RawUszAsz (TargetObjectName.Buffer, TargetNameA) + ); + } + else + { + printf ( + "%-16s %s -> (error!)\n", + RawUszAsz (pDirectoryEntry->TypeName.Buffer, TypeNameA), + RawUszAsz (pDirectoryEntry->Name.Buffer, ObjectNameA) + ); + } + } + else + { + printf ( + "%-16s %s\n", + RawUszAsz (pDirectoryEntry->TypeName.Buffer, TypeNameA), + RawUszAsz (pDirectoryEntry->Name.Buffer, ObjectNameA) + ); + } + ++ pDirectoryEntry; + ++ EntryCount; + } + }; + printf ("\n\t%lu object(s)\n", EntryCount); + /* + * Free any resource. + */ + NtClose (DirectoryHandle); + /* + * Recurse into, if required so. + */ + if (FALSE != Recurse) + { + pDirectoryEntry = (POBJECT_DIRECTORY_INFORMATION) DirectoryEntry; + while (0 != pDirectoryEntry->TypeName.Length) + { + if (0 == wcscmp (L"Directory", pDirectoryEntry->TypeName.Buffer)) + { + WCHAR CurrentName [MAX_PATH]; + UNICODE_STRING CurrentDirectory; + + CurrentName [0] = L'\0'; + wcscpy (CurrentName, DirectoryNameW->Buffer); + if (wcslen (CurrentName) > 1) + { + wcscat (CurrentName, L"\\"); + } + wcscat (CurrentName, pDirectoryEntry->Name.Buffer); + RtlInitUnicodeString (& CurrentDirectory, CurrentName); + ListDirectory (& CurrentDirectory, Recurse); + } + ++ pDirectoryEntry; + } + } + return (TRUE); +} + + +int main(int argc, char* argv[]) +{ + WCHAR DirectoryNameW [MAX_PATH]; + UNICODE_STRING DirectoryName; + BOOL Recurse = FALSE; + + /* + * Check user arguments. + */ + switch (argc) + { + case 2: + RawAszUsz (argv[1], DirectoryNameW); + break; + case 3: + if (strcmp (argv[1], "-r")) + { + fprintf ( + stderr, + "%s: unknown option '%s'.\n", + argv [0], argv[1] + ); + return EXIT_FAILURE; + } + RawAszUsz (argv[2], DirectoryNameW); + Recurse = TRUE; + break; + default: + fprintf ( + stderr, + "\nUsage: %s [-r] directory\n\n" + " -r recurse\n" + " directory a directory name in the system namespace\n\n", + argv [0] + ); + return EXIT_FAILURE; + } + /* + * List the directory. + */ + RtlInitUnicodeString (& DirectoryName, DirectoryNameW); + return (FALSE == ListDirectory (& DirectoryName, Recurse)) + ? EXIT_FAILURE + : EXIT_SUCCESS; +} + + +/* EOF */ diff --git a/rosapps/sysutils/utils/objdir/objdir.rbuild b/rosapps/sysutils/utils/objdir/objdir.rbuild new file mode 100644 index 00000000000..23894a34821 --- /dev/null +++ b/rosapps/sysutils/utils/objdir/objdir.rbuild @@ -0,0 +1,9 @@ + + + + + msvcrt + kernel32 + ntdll + objdir.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/partinfo/partinfo.c b/rosapps/sysutils/utils/partinfo/partinfo.c new file mode 100644 index 00000000000..92205e44f22 --- /dev/null +++ b/rosapps/sysutils/utils/partinfo/partinfo.c @@ -0,0 +1,212 @@ +/* + * partinfo - partition info program + */ + +#define WIN32_NO_STATUS +#include +#include +#include +#include + +//#define DUMP_DATA +#define DUMP_SIZE_INFO +#define UNICODE + +#ifdef DUMP_DATA +void HexDump(char *buffer, ULONG size) +{ + ULONG offset = 0; + unsigned char *ptr; + + while (offset < (size & ~15)) + { + ptr = (unsigned char*)((ULONG)buffer + offset); + printf("%08lx %02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx-%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx\n", + offset, + ptr[0], + ptr[1], + ptr[2], + ptr[3], + ptr[4], + ptr[5], + ptr[6], + ptr[7], + ptr[8], + ptr[9], + ptr[10], + ptr[11], + ptr[12], + ptr[13], + ptr[14], + ptr[15]); + offset += 16; + } + + ptr = (unsigned char*)((ULONG)buffer + offset); + printf("%08lx ", offset); + while (offset < size) + { + printf(" %02hx", *ptr); + offset++; + ptr++; + } + + printf("\n\n\n"); +} +#endif + + +void Usage(void) +{ + puts("Usage: partinfo "); +} + + +int main (int argc, char *argv[]) +{ + HANDLE hDisk; + DWORD dwRead; + DWORD i; + char *Buffer; + DRIVE_LAYOUT_INFORMATION *LayoutBuffer; + DISK_GEOMETRY DiskGeometry; + ULONG ulDrive; + CHAR DriveName[40]; + SYSTEM_DEVICE_INFORMATION DeviceInfo; + NTSTATUS Status; + + if (argc != 2) + { + Usage(); + return(0); + } + + ulDrive = strtoul(argv[1], NULL, 10); + if (errno != 0) + { + printf("Error: Malformed drive number\n"); + return(0); + } + + /* Check drive number */ + Status = NtQuerySystemInformation(SystemDeviceInformation, + &DeviceInfo, + sizeof(SYSTEM_DEVICE_INFORMATION), + &i); + if (!NT_SUCCESS(Status)) + { + printf("NtQuerySystemInformation() failed (Status %lx)\n", Status); + return(0); + } + + if (DeviceInfo.NumberOfDisks == 0) + { + printf("No disk drive installed!\n"); + return(0); + } + + if (ulDrive >= DeviceInfo.NumberOfDisks) + { + printf("Invalid disk drive number! Valid drive numbers [0-%lu]\n", + DeviceInfo.NumberOfDisks-1); + return(0); + } + + /* Build full drive name */ + sprintf(DriveName, "\\\\.\\PHYSICALDRIVE%lu", ulDrive); + + /* Open drive */ + hDisk = CreateFile(DriveName, + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL); + if (hDisk == INVALID_HANDLE_VALUE) + { + printf("Invalid disk handle!"); + return 0; + } + + /* Get drive geometry */ + if (!DeviceIoControl(hDisk, + IOCTL_DISK_GET_DRIVE_GEOMETRY, + NULL, + 0, + &DiskGeometry, + sizeof(DISK_GEOMETRY), + &dwRead, + NULL)) + { + CloseHandle(hDisk); + printf("DeviceIoControl failed! Error: %lu\n", + GetLastError()); + return 0; + } + +#ifdef DUMP_DATA + HexDump((char*)&DiskGeometry, dwRead); +#endif + printf("Drive number: %lu\n", ulDrive); + printf("Cylinders: %I64u\nMediaType: %x\nTracksPerCylinder: %lu\n" + "SectorsPerTrack: %lu\nBytesPerSector: %lu\n\n", + DiskGeometry.Cylinders.QuadPart, + DiskGeometry.MediaType, + DiskGeometry.TracksPerCylinder, + DiskGeometry.SectorsPerTrack, + DiskGeometry.BytesPerSector); + + + Buffer = (char*)malloc(8192); + if (Buffer == NULL) + { + CloseHandle(hDisk); + printf("Out of memory!"); + return 0; + } + memset(Buffer, 0, 8192); + + if (!DeviceIoControl(hDisk, + IOCTL_DISK_GET_DRIVE_LAYOUT, + NULL, + 0, + Buffer, + 8192, + &dwRead, + NULL)) + { + CloseHandle(hDisk); + printf("DeviceIoControl(IOCTL_DISK_GET_DRIVE_LAYOUT) failed! Error: %lu\n", + GetLastError()); + free(Buffer); + return 0; + } + + CloseHandle(hDisk); + +#ifdef DUMP_DATA + HexDump(Buffer, dwRead); +#endif + + LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)Buffer; + + printf("Partitions %lu Signature %lx\n", + LayoutBuffer->PartitionCount, + LayoutBuffer->Signature); + + for (i = 0; i < LayoutBuffer->PartitionCount; i++) + { + printf(" %ld: nr: %ld boot: %1x type: %x start: 0x%I64x count: 0x%I64x\n", + i, + LayoutBuffer->PartitionEntry[i].PartitionNumber, + LayoutBuffer->PartitionEntry[i].BootIndicator, + LayoutBuffer->PartitionEntry[i].PartitionType, + LayoutBuffer->PartitionEntry[i].StartingOffset.QuadPart, + LayoutBuffer->PartitionEntry[i].PartitionLength.QuadPart); + } + + free(Buffer); + + return 0; +} diff --git a/rosapps/sysutils/utils/partinfo/partinfo.rbuild b/rosapps/sysutils/utils/partinfo/partinfo.rbuild new file mode 100644 index 00000000000..a655bcbf2d9 --- /dev/null +++ b/rosapps/sysutils/utils/partinfo/partinfo.rbuild @@ -0,0 +1,7 @@ + + + msvcrt + kernel32 + ntdll + partinfo.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/pice/loader/main.c b/rosapps/sysutils/utils/pice/loader/main.c new file mode 100644 index 00000000000..309ee03f38a --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/main.c @@ -0,0 +1,1001 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + main.c + +Abstract: + + loader/translator for pIce LINUX + +Environment: + + User mode only + +Author: + + Klaus P. Gerlicher + Reactos Port by Eugene Ingerman + +Revision History: + + 04-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +/////////////////////////////////////////////////////////////////////////////////// +// includes +#include "stdinc.h" +#include + +/////////////////////////////////////////////////////////////////////////////////// +// constant defines + + +/////////////////////////////////////////////////////////////////////////////////// +// global variables +char SrcFileNames[2048][2048]; +ULONG ulCurrentSrcFile = 0; + +HANDLE debugger_file; + +ULONG ulGlobalVerbose = 0; + + +/////////////////////////////////////////////////////////////////////////////////// +// process_stabs() +// +/////////////////////////////////////////////////////////////////////////////////// +void process_stabs( + char* pExeName, // name of exe + HANDLE fileout, // symbol file handle + PIMAGE_SECTION_HEADER section, //Elf32_Shdr* pSHdr, + int sectionHeadersSize, //int nSHdrSize, + void* p, // ptr to memory where whole exe was read + PSTAB_ENTRY pStab, // ptr to stabs + int nStabLen, // size of stabs + char* pStr, // ptr to stabs strings + int nStrLen, // sizeof stabs strings + char* pGlobals, // ptr to global symbols + int nGlobalLen, // sizeof of globals + char* pGlobalsStr, // ptr to global strings + int nGlobalStrLen) // size of global strings +{ + unsigned i,strLen; + int nOffset=0,nNextOffset=0; + PSTAB_ENTRY pStabCopy = pStab; + char* pName,szCurrentPath[2048]; + PICE_SYMBOLFILE_HEADER SymbolFileHeader; + LPSTR pSlash,pDot; + char temp[2048]; + char* pCopyExeName = temp; + WCHAR tempstr[64]; + DWORD wrote; + + //printf("LOADER: enter process_stabs()\n"); + + //get the name of the executable file + memset((void*)&SymbolFileHeader,0,sizeof(SymbolFileHeader)); + SymbolFileHeader.magic = PICE_MAGIC; + strcpy(temp,pExeName); + pSlash = strrchr(temp,'\\'); + pDot = strchr(temp,'.'); + if(pDot) + { + *pDot = 0; + } + if(pSlash) + { + pCopyExeName = pSlash+1; + } + strLen = MultiByteToWideChar(CP_ACP, NULL, pCopyExeName, -1, tempstr, 64 ); + if( !strLen ) + printf("Cannot convert string to multibyte: %s\n", pCopyExeName ); + wcscpy(SymbolFileHeader.name,tempstr); + + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + pName = &pStr[pStabCopy->n_strx + nOffset]; + +#if 0 + //printf("LOADER: \n%.8x %.2x %.2x %.4x %.8x %s\n", + pStabCopy->n_strx, + pStabCopy->n_type, + pStabCopy->n_other, + pStabCopy->n_desc, + pStabCopy->n_value, + pName + ); +#endif + switch(pStabCopy->n_type) + { + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStabCopy->n_value; + //printf("LOADER: changing string offset %x %x\n",nOffset,nNextOffset); + break; + case N_SO: + if((strLen = strlen(pName))) + { + if(pName[strLen-1]!='/') + { + if(strlen(szCurrentPath)) + { + //printf("LOADER: ###########################################################################\n"); + strcat(szCurrentPath,pName); + //printf("LOADER: changing source file %s\n",szCurrentPath); + strcpy(SrcFileNames[ulCurrentSrcFile++],szCurrentPath); + szCurrentPath[0]=0; + } + else + { + //printf("LOADER: ###########################################################################\n"); + //printf("LOADER: changing source file %s\n",pName); + strcpy(SrcFileNames[ulCurrentSrcFile++],pName); + } + } + else + strcpy(szCurrentPath,pName); + } + else + { + //printf("LOADER: END source file\n"); + //printf("LOADER: ###########################################################################\n"); + } + break; +/* case N_SLINE: + //printf("LOADER: code source line number #%u for addr. %x\n",pStabCopy->n_desc,pStabCopy->n_value); + break; + case N_DSLINE: + //printf("LOADER: data source line number #%u for addr. %x\n",pStabCopy->n_desc,pStabCopy->n_value); + break; + case N_BSLINE: + //printf("LOADER: BSS source line number #%u for addr. %x\n",pStabCopy->n_desc,pStabCopy->n_value); + break; + case N_GSYM: + //printf("LOADER: global symbol %s @ addr. %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_BINCL: + //printf("LOADER: include file %s\n",pName); + break; + case N_EINCL: + break; + case N_FUN: + if(strlen(pName)) + //printf("LOADER: function %s @ addr. %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + else + //printf("LOADER: text segment %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_PSYM: + //printf("LOADER: parameter %s @ [EBP%+d] (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_RSYM: + //printf("LOADER: register variable %s @ reg. %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_LBRAC: + //printf("LOADER: lexical block %s @ reg. %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_RBRAC: + //printf("LOADER: END of lexical block %s @ reg. %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_STSYM: + //printf("LOADER: static variable %s @ %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_LCSYM: + //printf("LOADER: BSS variable %s @ %x (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + break; + case N_LSYM: + if(pStabCopy->n_value) + { + //printf("LOADER: stack variable %s @ [EBP%+d] (%x)\n",pName,pStabCopy->n_value,pStabCopy->n_desc); + } + else + { + //printf("LOADER: global variable %s \n",pName); + } + break; +*/ + } + + pStabCopy++; + } + + //printf("LOADER: SymbolFileHeader.ulSizeOfHeader= %x (%x)\n",nSHdrSize,(LPSTR)pSHdr-(LPSTR)p); + //printf("LOADER: SymbolFileHeader.ulSizeOfGlobals = %x (%x)\n",nGlobalLen,(LPSTR)pGlobals-(LPSTR)p); + //printf("LOADER: SymbolFileHeader.ulSizeOfGlobalsStrings = %x (%x)\n",nGlobalStrLen,(LPSTR)pGlobalsStr-(LPSTR)p); + //printf("LOADER: SymbolFileHeader.ulSizeOfStabs = %x (%x)\n",nStabLen,(LPSTR)pStab-(LPSTR)p); + //printf("LOADER: SymbolFileHeader.ulSizeOfStabsStrings = %x (%x)\n",nStrLen,(LPSTR)pStr-(LPSTR)p); + + SymbolFileHeader.ulOffsetToHeaders = sizeof(PICE_SYMBOLFILE_HEADER); + SymbolFileHeader.ulSizeOfHeader = sectionHeadersSize; + SymbolFileHeader.ulOffsetToGlobals = sizeof(PICE_SYMBOLFILE_HEADER)+sectionHeadersSize; + SymbolFileHeader.ulSizeOfGlobals = nGlobalLen; + SymbolFileHeader.ulOffsetToGlobalsStrings = sizeof(PICE_SYMBOLFILE_HEADER)+sectionHeadersSize+nGlobalLen; + SymbolFileHeader.ulSizeOfGlobalsStrings = nGlobalStrLen; + SymbolFileHeader.ulOffsetToStabs = sizeof(PICE_SYMBOLFILE_HEADER)+sectionHeadersSize+nGlobalLen+nGlobalStrLen; + SymbolFileHeader.ulSizeOfStabs = nStabLen; + SymbolFileHeader.ulOffsetToStabsStrings = sizeof(PICE_SYMBOLFILE_HEADER)+sectionHeadersSize+nGlobalLen+nGlobalStrLen+nStabLen; + SymbolFileHeader.ulSizeOfStabsStrings = nStrLen; + SymbolFileHeader.ulOffsetToSrcFiles = sizeof(PICE_SYMBOLFILE_HEADER)+sectionHeadersSize+nGlobalLen+nGlobalStrLen+nStabLen+nStrLen; + SymbolFileHeader.ulNumberOfSrcFiles = ulCurrentSrcFile; + + printf("sectionHeaderSize: %ld, nGlobalLen: %ld, nGlobalStrLen: %ld, nStabLen: %ld, " + "nStrLen: %ld, ulCurrentSrcFile: %ld, ulOffsetToStabs: %ld\n", + sectionHeadersSize, nGlobalLen, nGlobalStrLen, + nStabLen, nStrLen, ulCurrentSrcFile, SymbolFileHeader.ulOffsetToStabs); + + WriteFile(fileout,&SymbolFileHeader,sizeof(PICE_SYMBOLFILE_HEADER),&wrote, NULL); + WriteFile(fileout,section,sectionHeadersSize,&wrote, NULL); + WriteFile(fileout,pGlobals,nGlobalLen,&wrote, NULL); + WriteFile(fileout,pGlobalsStr,nGlobalStrLen,&wrote, NULL); + WriteFile(fileout,pStab,nStabLen,&wrote, NULL); + WriteFile(fileout,pStr,nStrLen,&wrote, NULL); + + for(i=0;iName,".stab") == 0) + { + *ppStab = (PSTAB_ENTRY)((int)p + section->PointerToRawData); + *pLen = section->SizeOfRawData; + printf("LOADER: .stab @ %x (offset %x) len = %x\n",*ppStab,section->PointerToRawData,section->SizeOfRawData); + } + else if(strncmp(section->Name,".stabstr",strlen(".stabstr")) == 0) + { + *ppStr = (char*)((int)p + section->PointerToRawData); + *pnStabStrLen = section->SizeOfRawData; + printf("LOADER: .stabstr @ %x (offset %x) len = %x\n",*ppStab,section->PointerToRawData,section->SizeOfRawData); + } + } + + //printf("LOADER: leave find_stab_sections()\n"); +} + +/////////////////////////////////////////////////////////////////////////////////// +// process_pe() +// +/////////////////////////////////////////////////////////////////////////////////// +int process_pe(char* filename,int file,void* p,int len) +{ + + PIMAGE_DOS_HEADER pDosHeader; + PIMAGE_NT_HEADERS pNTHeaders; + + char* pStr; + PSTAB_ENTRY pStab; + DWORD nStabLen,nSym; + char* pStrTab; + char* pSymTab; + + char szSymName[2048]; + HANDLE fileout; + int nSymStrLen,nStabStrLen; + int iRetVal = 0; + + pDosHeader = (PIMAGE_DOS_HEADER)p; + pNTHeaders = (PIMAGE_NT_HEADERS)((DWORD)p + pDosHeader->e_lfanew); + + if ((pDosHeader->e_magic == IMAGE_DOS_SIGNATURE) + && (pDosHeader->e_lfanew != 0L) + && (pNTHeaders->Signature == IMAGE_NT_SIGNATURE)) + { + if( pNTHeaders->FileHeader.PointerToSymbolTable ){ + + pSymTab = (char*)((DWORD)p + pNTHeaders->FileHeader.PointerToSymbolTable); + nSym = pNTHeaders->FileHeader.NumberOfSymbols; + //string table follows immediately after symbol table. first 4 bytes give the length of the table + //references to string table include the first 4 bytes. + pStrTab = (char*)((PIMAGE_SYMBOL)pSymTab + nSym); + nSymStrLen = *((DWORD*)pStrTab); + find_stab_sections(p,IMAGE_FIRST_SECTION(pNTHeaders),pNTHeaders->FileHeader.NumberOfSections, + &pStab,&nStabLen,&pStr,&nStabStrLen); + + if(pStab && nStabLen && pStr && nStabStrLen) + { + LPSTR pDot; + + strcpy(szSymName,filename); + //printf("LOADER: file name = %s\n",szSymName); + if((pDot = strchr(szSymName,'.'))) + { + *pDot = 0; + strcat(pDot,".dbg"); + } + else + { + strcat(szSymName,".dbg"); + } + //printf("LOADER: symbol file name = %s\n",szSymName); + printf("LOADER: creating symbol file %s for %s\n",szSymName,filename); + + fileout = CreateFile(szSymName, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + 0, + 0); + + if(fileout != INVALID_HANDLE_VALUE) + { + printf("NumberOfSections: %d, size: %d\n", pNTHeaders->FileHeader.NumberOfSections,sizeof(IMAGE_SECTION_HEADER)); + process_stabs(szSymName, + fileout, + IMAGE_FIRST_SECTION(pNTHeaders), + pNTHeaders->FileHeader.NumberOfSections*sizeof(IMAGE_SECTION_HEADER), + p, + pStab, + nStabLen, + pStr, + nStabStrLen, + (char*)pSymTab, + nSym*sizeof(IMAGE_SYMBOL), + pStrTab, + nSymStrLen); + + CloseHandle(fileout); + } + else + { + printf("LOADER: creation of symbol file %s failed\n",szSymName); + iRetVal = 2; + } + + } + else + { + printf("LOADER: file %s has no data inside symbol tables\n",filename); + if( ulGlobalVerbose ) + { + if( !pStab || !nStabLen ) + printf("LOADER: - symbol table is empty or not present\n"); + if( !pStr || !nStabStrLen ) + printf("LOADER: - string table is empty or not present\n"); + } + iRetVal = 2; + } + } + else{ + printf("LOADER: file %s does not have a symbol table\n",filename); + iRetVal = 2; + } + } + else + { + printf("LOADER: file %s is not an ELF binary\n",filename); + iRetVal = 1; + } + + //printf("LOADER: leave process_pe()\n"); + return iRetVal; +} + +/////////////////////////////////////////////////////////////////////////////////// +// process_file() +// +/////////////////////////////////////////////////////////////////////////////////// +int process_file(char* filename) +{ + int file; + void* p; + off_t len; + int iRetVal=0; + + //printf("LOADER: enter process_file()\n"); + file = _open(filename,O_RDONLY|_O_BINARY); + if(file>0) + { + //printf("LOADER: opened %s as FD %x\n",filename,file); + + len = _lseek(file,0,SEEK_END); + printf("LOADER: file %s is %u bytes\n",filename,(int)len); + + _lseek(file,0,SEEK_SET); + + p = malloc(len+16); + if(p) + { + long count; + //printf("LOADER: malloc'd @ %x\n",p); + memset(p,0,len+16); + if(len == (count = _read(file,p,len))) + { + //printf("LOADER: trying ELF format\n"); + iRetVal = process_pe(filename,file,p,len); + } + } + _close(file); + } + else + { + printf("LOADER: file %s could not be opened\n",filename); + iRetVal = 1; + } + + //printf("LOADER: leave process_file()\n"); + return iRetVal; +} + +/////////////////////////////////////////////////////////////////////////////////// +// open_debugger() +// +/////////////////////////////////////////////////////////////////////////////////// +HANDLE open_debugger(void) +{ + debugger_file = CreateFile("\\Device\\Pice",GENERIC_READ,0,NULL,OPEN_EXISTING,NULL,NULL); + if(debugger_file == INVALID_HANDLE_VALUE) + { + printf("LOADER: debugger is not loaded. Last Error: %ld\n", GetLastError()); + } + + return debugger_file; +} + +/////////////////////////////////////////////////////////////////////////////////// +// close_debugger() +// +/////////////////////////////////////////////////////////////////////////////////// +void close_debugger(void) +{ + if( !CloseHandle(debugger_file) ){ + printf("Error closing debugger handle: %ld\n", GetLastError()); + } +} + +int ioctl( HANDLE device, DWORD ioctrlcode, PDEBUGGER_STATUS_BLOCK psb) +{ + DEBUGGER_STATUS_BLOCK tsb; + DWORD bytesreturned; + if( !DeviceIoControl( device, ioctrlcode, psb, sizeof(DEBUGGER_STATUS_BLOCK), + &tsb, sizeof(DEBUGGER_STATUS_BLOCK),&bytesreturned, NULL) ){ + printf("Error in DeviceIoControl: %ld\n", GetLastError()); + return -EINVAL; + } + else{ + memcpy( psb, &tsb, sizeof(DEBUGGER_STATUS_BLOCK) ); + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////////// +// banner() +// +/////////////////////////////////////////////////////////////////////////////////// +void banner(void) +{ + printf("#########################################################\n"); + printf("#### Symbols LOADER/TRANSLATOR for PICE ####\n"); + printf("#########################################################\n"); +} + +#define ACTION_NONE 0 +#define ACTION_LOAD 1 +#define ACTION_UNLOAD 2 +#define ACTION_TRANS 3 +#define ACTION_RELOAD 4 +#define ACTION_INSTALL 5 +#define ACTION_UNINSTALL 6 +#define ACTION_STATUS 7 +#define ACTION_BREAK 8 +#define ACTION_TERMINAL 9 + +/////////////////////////////////////////////////////////////////////////////////// +// change_symbols() +// +/////////////////////////////////////////////////////////////////////////////////// +void change_symbols(int action,char* pfilename) +{ + int iRetVal = 0; + DEBUGGER_STATUS_BLOCK sb; + + strcpy(sb.filename, pfilename); + + switch(action) + { + case ACTION_LOAD: + printf("LOADER: loading symbols from %s\n",pfilename); + if(open_debugger() != INVALID_HANDLE_VALUE) + { + iRetVal = ioctl(debugger_file,PICE_IOCTL_LOAD,&sb); + close_debugger(); + } + break; + case ACTION_UNLOAD: + printf("LOADER: unloading symbols from %s\n",pfilename); + if(open_debugger() != INVALID_HANDLE_VALUE) + { + iRetVal = ioctl(debugger_file,PICE_IOCTL_UNLOAD,&sb); + close_debugger(); + } + break; + case ACTION_RELOAD: + printf("LOADER: reloading all symbols\n"); + if(open_debugger() != INVALID_HANDLE_VALUE) + { + ioctl(debugger_file,PICE_IOCTL_RELOAD,NULL); + close_debugger(); + printf("LOADER: reloading DONE!\n"); + } + break; + default : + printf("LOADER: an internal error has occurred at change_symbols\n"); + } + + switch( iRetVal ) + { + case -EINVAL : + printf("LOADER: debugger return value = -EINVAL, operation has failed\n"); + break; + case 0 : + // success - silently proceed + break; + default : + printf("LOADER: debugger return value = %i, operation possibly failed\n",iRetVal); + } +} + +// Dynamic install to be added later +#if 0 +/////////////////////////////////////////////////////////////////////////////////// +// tryinstall() +// +/////////////////////////////////////////////////////////////////////////////////// +int tryinstall(void) +{ + char *argv[]={"/sbin/insmod","pice.o",NULL}; + int err = 0; + int pid,status; + + banner(); + printf("LOADER: trying to install debugger...\n"); + + if( open_debugger() != INVALID_HANDLE_VALUE ) + { + printf("LOADER: debugger already installed...\n"); + close_debugger(); + return 0; + } + + // create a separate thread + pid = fork(); + switch(pid) + { + case -1: + // error when forking, i.e. out E_NOMEM + err = errno; + printf("LOADER: fork failed for execution of '%s' (errno = %u).\n",argv[0],err); + break; + case 0: + // child process handler + execve(argv[0],argv,NULL); + // returns only on error, with return value -1, errno is set + printf("LOADER: couldn't execute '%s' (errno = %u)\n",argv[0],errno); + exit(255); + break; + default: + // parent process handler + printf("LOADER: waiting for debugger to load...\n"); + pid = waitpid(pid, &status, 0); // suspend until child is done + if( (pid>0) && WIFEXITED(status) && (WEXITSTATUS(status) == 0) ) + printf("LOADER: debugger loaded!\n"); + else if( pid<=0 ) + { + printf("LOADER: Error on loading debugger! (waitpid() = %i)\n",pid); + err = -1; + } + else if( !WIFEXITED(status) ) + { + printf("LOADER: Error on loading debugger! (ifexited = %i)\n",WIFEXITED(status)); + err = -1; + } + else + { + printf("LOADER: Error on loading debugger! (exitstatus = %u)\n",WEXITSTATUS(status)); + err = WEXITSTATUS(status); + } + break; + } + + return err; +} + +/////////////////////////////////////////////////////////////////////////////////// +// tryuninstall() +// +/////////////////////////////////////////////////////////////////////////////////// +int tryuninstall(void) +{ + char *argv[]={"/sbin/rmmod","pice",NULL}; + int err = 0; + int pid,status; + + banner(); + printf("LOADER: trying to remove debugger...\n"); + + // check for loaded debugger + if(open_debugger() == INVALID_HANDLE_VALUE) + { + return -1; + } + // don't to close, else we'll have a reference count != 0 + close_debugger(); + + // create a separate thread + pid = fork(); + switch(pid) + { + case -1: + // error when forking, i.e. out E_NOMEM + err = errno; + printf("LOADER: fork failed for execution of '%s' (errno=%u).\n",argv[0],err); + break; + case 0: + // child process handler + execve(argv[0],argv,NULL); + // returns only on error, with return value -1, errno is set + printf("LOADER: couldn't execute '%s' (errno = %u)\n",argv[0],errno); + exit(255); + break; + default: + // parent process handler + printf("LOADER: waiting for debugger to unload...\n"); + pid = waitpid(pid, &status, 0); // suspend until child is done + + if( (pid>0) && WIFEXITED(status) && (WEXITSTATUS(status) == 0) ) + printf("LOADER: debugger removed!\n"); + else if( pid<=0 ) + { + printf("LOADER: Error on removing debugger! (waitpid() = %i)\n",pid); + err = -1; + } + else if( !WIFEXITED(status) ) + { + printf("LOADER: Error on removing debugger! (ifexited = %i)\n",WIFEXITED(status)); + err = -1; + } + else + { + printf("LOADER: Error on removing debugger! (exitstatus = %u)\n",WEXITSTATUS(status)); + err = WEXITSTATUS(status); + } + break; + } + return err; +} +#endif + +/////////////////////////////////////////////////////////////////////////////////// +// showstatus() +// +/////////////////////////////////////////////////////////////////////////////////// +void showstatus(void) +{ + DEBUGGER_STATUS_BLOCK sb; + int iRetVal; + + if(open_debugger() != INVALID_HANDLE_VALUE) + { + iRetVal = ioctl(debugger_file,PICE_IOCTL_STATUS,&sb); + + //printf("LOADER: Test = %X\n",sb.Test); + close_debugger(); + } +} + +/////////////////////////////////////////////////////////////////////////////////// +// dobreak() +// +/////////////////////////////////////////////////////////////////////////////////// +void dobreak(void) +{ + int iRetVal; + + if(open_debugger() != INVALID_HANDLE_VALUE) + { + iRetVal = ioctl(debugger_file,PICE_IOCTL_BREAK,NULL); + close_debugger(); + } +} + +/////////////////////////////////////////////////////////////////////////////////// +// doterminal() +// +/////////////////////////////////////////////////////////////////////////////////// +#if 0 +void doterminal(void) +{ + if(SetupSerial(2,B115200)) + { + DebuggerShell(); + CloseSerial(); + } +} +#endif + +/////////////////////////////////////////////////////////////////////////////////// +// process_switches() +// +// returns !=0 in case of a commandline error +// +/////////////////////////////////////////////////////////////////////////////////// +int process_switches(int argc,char* argv[]) +{ + int i; + char* parg,*pfilename = NULL; + int action = ACTION_NONE; + int error = 0; + + // parse commandline arguments + for(i=1;i ulGlobalVerbose ) + ulGlobalVerbose++; + } + else if(strcmp(parg,"install")==0 || strcmp(parg,"i")==0) + { + new_action = ACTION_INSTALL; + } + else if(strcmp(parg,"uninstall")==0 || strcmp(parg,"x")==0) + { + new_action = ACTION_UNINSTALL; + } + else if(strcmp(parg,"status")==0 || strcmp(parg,"s")==0) + { + new_action = ACTION_STATUS; + } + else if(strcmp(parg,"break")==0 || strcmp(parg,"b")==0) + { + new_action = ACTION_BREAK; + } + else if(strcmp(parg,"serial")==0 || strcmp(parg,"ser")==0) + { + new_action = ACTION_TERMINAL; + } + else + { + printf("LOADER: error: unknown switch %s", argv[i]); + error = 1; + } + + if( new_action != ACTION_NONE ) + { + if( action == ACTION_NONE ) + action = new_action; + else + if( action == new_action ) + { + // identical, just ignore + } + else + { + printf("LOADER: error: conflicting switch %s", argv[i]); + error = 1; + } + } + } + else + { + if( pfilename ) + { + printf("LOADER: error: additional filename %s", parg); + error = 1; + } + pfilename = parg; + } + } + + // check number of required parameters + switch( action ) + { + case ACTION_TRANS : + case ACTION_LOAD : + case ACTION_UNLOAD : + if( !pfilename ) + { + printf("LOADER: error: missing filename\n"); + error = 1; + } + break; + case ACTION_RELOAD : + /* filename parameter is optional */ + break; +#if 0 + case ACTION_UNINSTALL: + close_debugger(); + tryuninstall(); + break; + case ACTION_INSTALL: + tryinstall(); + break; +#endif + case ACTION_STATUS: + showstatus(); + break; + case ACTION_BREAK: + dobreak(); + break; +#if 0 + case ACTION_TERMINAL: + doterminal(); + break; +#endif + case ACTION_NONE : + printf("LOADER: no action specified specifed on commandline\n"); + error = 1; + + break; + default : + printf("LOADER: an internal error has occurred at commandline parsing\n"); + error = 1; + } + + if( !error ) // commandline was fine, now start processing + { + switch( action ) + { + case ACTION_TRANS : + printf("LOADER: trying to translate file %s...\n",pfilename); + if( process_file(pfilename)==0 ) + printf("LOADER: file %s has been translated\n",pfilename); + else + printf("LOADER: error while translating file %s\n",pfilename); + break; + case ACTION_LOAD : + case ACTION_UNLOAD : + case ACTION_RELOAD : + change_symbols(action,pfilename); + break; + } + } + + return error; +} + + +/////////////////////////////////////////////////////////////////////////////////// +// showhelp() +// +/////////////////////////////////////////////////////////////////////////////////// +void showhelp(void) +{ + banner(); + printf("LOADER: Syntax:\n"); + printf("LOADER: loader [switches] [executable/object file path]\n"); + printf("LOADER: Switches:\n"); + printf("LOADER: -trans (-t): translate from exe to sym\n"); + printf("LOADER: -load (-l): load symbols\n"); + printf("LOADER: -unload (-u): unload symbols\n"); + printf("LOADER: -reload (-r): reload some/all symbols\n"); + printf("LOADER: -verbose (-v): be a bit more verbose\n"); + printf("LOADER: -install (-i): install pICE debugger\n"); + printf("LOADER: -uninstall (-x): uninstall pICE debugger\n"); + printf("LOADER: -break (-b): break into debugger\n"); + printf("LOADER: -serial (-ser): start serial line terminal\n"); +} + +/////////////////////////////////////////////////////////////////////////////////// +// showpermission() +// +/////////////////////////////////////////////////////////////////////////////////// +void showpermission(void) +{ + banner(); + printf("LOADER: You must be superuser!\n"); +} + +/////////////////////////////////////////////////////////////////////////////////// +// main() +// +/////////////////////////////////////////////////////////////////////////////////// +int main(int argc,char* argv[]) +{ + if(argc==1 || argc>3) + { + showhelp(); + + return 1; + } + + return process_switches(argc,argv); +} diff --git a/rosapps/sysutils/utils/pice/loader/retypes.h b/rosapps/sysutils/utils/pice/loader/retypes.h new file mode 100644 index 00000000000..7dceba3ffb7 --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/retypes.h @@ -0,0 +1,15 @@ +typedef unsigned int ULONG,*PULONG; +typedef unsigned short USHORT,*PUSHORT; +typedef unsigned char UCHAR,*PUCHAR; + +typedef signed int LONG,*PLONG; +typedef signed short SHORT,*PSHORT; +typedef signed char CHAR,*PCHAR,*LPSTR,*PSTR; + +typedef void VOID,*PVOID; + +typedef char BOOLEAN,*PBOOLEAN; + +#define FALSE (0==1) +#define TRUE (1==1) + diff --git a/rosapps/sysutils/utils/pice/loader/stab.def b/rosapps/sysutils/utils/pice/loader/stab.def new file mode 100644 index 00000000000..b927edd7d37 --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/stab.def @@ -0,0 +1,264 @@ +/* Table of DBX symbol codes for the GNU system. + Copyright (C) 1988, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files + overlaps the N_UNDF used for ordinary symbols. In ELF files, the + debug information is in a different file section, so there is no conflict. + This symbol's n_value gives the size of the string section associated + with this file. The symbol's n_strx (relative to the just-updated + string section start address) gives the name of the source file, + e.g. "foo.c", without any path information. The symbol's n_desc gives + the count of upcoming symbols associated with this file (not including + this one). */ +__define_stab (N_UNDF, 0x00, "UNDF") + +/* Global variable. Only the name is significant. + To find the address, look in the corresponding external symbol. */ +__define_stab (N_GSYM, 0x20, "GSYM") + +/* Function name for BSD Fortran. Only the name is significant. + To find the address, look in the corresponding external symbol. */ +__define_stab (N_FNAME, 0x22, "FNAME") + +/* Function name or text-segment variable for C. Value is its address. + Desc is supposedly starting line number, but GCC doesn't set it + and DBX seems not to miss it. */ +__define_stab (N_FUN, 0x24, "FUN") + +/* Data-segment variable with internal linkage. Value is its address. + "Static Sym". */ +__define_stab (N_STSYM, 0x26, "STSYM") + +/* BSS-segment variable with internal linkage. Value is its address. */ +__define_stab (N_LCSYM, 0x28, "LCSYM") + +/* Name of main routine. Only the name is significant. */ +__define_stab (N_MAIN, 0x2a, "MAIN") + +/* Solaris2: Read-only data symbols. */ +__define_stab (N_ROSYM, 0x2c, "ROSYM") + +/* Global symbol in Pascal. + Supposedly the value is its line number; I'm skeptical. */ +__define_stab (N_PC, 0x30, "PC") + +/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */ +__define_stab (N_NSYMS, 0x32, "NSYMS") + +/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */ +__define_stab (N_NOMAP, 0x34, "NOMAP") + +/* New stab from Solaris 2. Like N_SO, but for the object file. Two in + a row provide the build directory and the relative path of the .o from it. + Solaris2 uses this to avoid putting the stabs info into the linked + executable; this stab goes into the ".stab.index" section, and the debugger + reads the real stabs directly from the .o files instead. */ +__define_stab (N_OBJ, 0x38, "OBJ") + +/* New stab from Solaris 2. Options for the debugger, related to the + source language for this module. E.g. whether to use ANSI + integral promotions or traditional integral promotions. */ +__define_stab (N_OPT, 0x3c, "OPT") + +/* Register variable. Value is number of register. */ +__define_stab (N_RSYM, 0x40, "RSYM") + +/* Modula-2 compilation unit. Can someone say what info it contains? */ +__define_stab (N_M2C, 0x42, "M2C") + +/* Line number in text segment. Desc is the line number; + value is corresponding address. On Solaris2, the line number is + relative to the start of the current function. */ +__define_stab (N_SLINE, 0x44, "SLINE") + +/* Similar, for data segment. */ +__define_stab (N_DSLINE, 0x46, "DSLINE") + +/* Similar, for bss segment. */ +__define_stab (N_BSLINE, 0x48, "BSLINE") + +/* Sun's source-code browser stabs. ?? Don't know what the fields are. + Supposedly the field is "path to associated .cb file". THIS VALUE + OVERLAPS WITH N_BSLINE! */ +__define_stab_duplicate (N_BROWS, 0x48, "BROWS") + +/* GNU Modula-2 definition module dependency. Value is the modification time + of the definition file. Other is non-zero if it is imported with the + GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there + are enough empty fields? */ +__define_stab(N_DEFD, 0x4a, "DEFD") + +/* New in Solaris2. Function start/body/end line numbers. */ +__define_stab(N_FLINE, 0x4C, "FLINE") + +/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2 + and one is for C++. Still,... */ +/* GNU C++ exception variable. Name is variable name. */ +__define_stab (N_EHDECL, 0x50, "EHDECL") +/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */ +__define_stab_duplicate (N_MOD2, 0x50, "MOD2") + +/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if + this entry is immediately followed by a CAUGHT stab saying what exception + was caught. Multiple CAUGHT stabs means that multiple exceptions + can be caught here. If Desc is 0, it means all exceptions are caught + here. */ +__define_stab (N_CATCH, 0x54, "CATCH") + +/* Structure or union element. Value is offset in the structure. */ +__define_stab (N_SSYM, 0x60, "SSYM") + +/* Solaris2: Last stab emitted for module. */ +__define_stab (N_ENDM, 0x62, "ENDM") + +/* Name of main source file. + Value is starting text address of the compilation. + If multiple N_SO's appear, the first to contain a trailing / is the + compilation directory. The first to not contain a trailing / is the + source file name, relative to the compilation directory. Others (perhaps + resulting from cfront) are ignored. + On Solaris2, value is undefined, but desc is a source-language code. */ + +__define_stab (N_SO, 0x64, "SO") + +/* Automatic variable in the stack. Value is offset from frame pointer. + Also used for type descriptions. */ +__define_stab (N_LSYM, 0x80, "LSYM") + +/* Beginning of an include file. Only Sun uses this. + In an object file, only the name is significant. + The Sun linker puts data into some of the other fields. */ +__define_stab (N_BINCL, 0x82, "BINCL") + +/* Name of sub-source file (#include file). + Value is starting text address of the compilation. */ +__define_stab (N_SOL, 0x84, "SOL") + +/* Parameter variable. Value is offset from argument pointer. + (On most machines the argument pointer is the same as the frame pointer. */ +__define_stab (N_PSYM, 0xa0, "PSYM") + +/* End of an include file. No name. + This and N_BINCL act as brackets around the file's output. + In an object file, there is no significant data in this entry. + The Sun linker puts data into some of the fields. */ +__define_stab (N_EINCL, 0xa2, "EINCL") + +/* Alternate entry point. Value is its address. */ +__define_stab (N_ENTRY, 0xa4, "ENTRY") + +/* Beginning of lexical block. + The desc is the nesting level in lexical blocks. + The value is the address of the start of the text for the block. + The variables declared inside the block *precede* the N_LBRAC symbol. + On Solaris2, the value is relative to the start of the current function. */ +__define_stab (N_LBRAC, 0xc0, "LBRAC") + +/* Place holder for deleted include file. Replaces a N_BINCL and everything + up to the corresponding N_EINCL. The Sun linker generates these when + it finds multiple identical copies of the symbols from an include file. + This appears only in output from the Sun linker. */ +__define_stab (N_EXCL, 0xc2, "EXCL") + +/* Modula-2 scope information. Can someone say what info it contains? */ +__define_stab (N_SCOPE, 0xc4, "SCOPE") + +/* End of a lexical block. Desc matches the N_LBRAC's desc. + The value is the address of the end of the text for the block. + On Solaris2, the value is relative to the start of the current function. */ +__define_stab (N_RBRAC, 0xe0, "RBRAC") + +/* Begin named common block. Only the name is significant. */ +__define_stab (N_BCOMM, 0xe2, "BCOMM") + +/* End named common block. Only the name is significant + (and it should match the N_BCOMM). */ +__define_stab (N_ECOMM, 0xe4, "ECOMM") + +/* Member of a common block; value is offset within the common block. + This should occur within a BCOMM/ECOMM pair. */ +__define_stab (N_ECOML, 0xe8, "ECOML") + +/* Solaris2: Pascal "with" statement: type,,0,0,offset */ +__define_stab (N_WITH, 0xea, "WITH") + +/* These STAB's are used on Gould systems for Non-Base register symbols + or something like that. FIXME. I have assigned the values at random + since I don't have a Gould here. Fixups from Gould folk welcome... */ +__define_stab (N_NBTEXT, 0xF0, "NBTEXT") +__define_stab (N_NBDATA, 0xF2, "NBDATA") +__define_stab (N_NBBSS, 0xF4, "NBBSS") +__define_stab (N_NBSTS, 0xF6, "NBSTS") +__define_stab (N_NBLCS, 0xF8, "NBLCS") + +/* Second symbol entry containing a length-value for the preceding entry. + The value is the length. */ +__define_stab (N_LENG, 0xfe, "LENG") + +/* The above information, in matrix format. + + STAB MATRIX + _________________________________________________ + | 00 - 1F are not dbx stab symbols | + | In most cases, the low bit is the EXTernal bit| + + | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA | + | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT | + + | 08 BSS | 0A INDR | 0C FN_SEQ | 0E WEAKA | + | 09 |EXT | 0B | 0D WEAKU | 0F WEAKT | + + | 10 WEAKD | 12 COMM | 14 SETA | 16 SETT | + | 11 WEAKB | 13 | 15 | 17 | + + | 18 SETD | 1A SETB | 1C SETV | 1E WARNING| + | 19 | 1B | 1D | 1F FN | + + |_______________________________________________| + | Debug entries with bit 01 set are unused. | + | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | + | 28 LCSYM | 2A MAIN | 2C ROSYM | 2E | + | 30 PC | 32 NSYMS | 34 NOMAP | 36 | + | 38 OBJ | 3A | 3C OPT | 3E | + | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE | + | 48 BSLINE*| 4A DEFD | 4C FLINE | 4E | + | 50 EHDECL*| 52 | 54 CATCH | 56 | + | 58 | 5A | 5C | 5E | + | 60 SSYM | 62 ENDM | 64 SO | 66 | + | 68 | 6A | 6C | 6E | + | 70 | 72 | 74 | 76 | + | 78 | 7A | 7C | 7E | + | 80 LSYM | 82 BINCL | 84 SOL | 86 | + | 88 | 8A | 8C | 8E | + | 90 | 92 | 94 | 96 | + | 98 | 9A | 9C | 9E | + | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | + | A8 | AA | AC | AE | + | B0 | B2 | B4 | B6 | + | B8 | BA | BC | BE | + | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | + | C8 | CA | CC | CE | + | D0 | D2 | D4 | D6 | + | D8 | DA | DC | DE | + | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | + | E8 ECOML | EA WITH | EC | EE | + | F0 | F2 | F4 | F6 | + | F8 | FA | FC | FE LENG | + +-----------------------------------------------+ + * 50 EHDECL is also MOD2. + * 48 BSLINE is also BROWS. + */ diff --git a/rosapps/sysutils/utils/pice/loader/stab_gnu.h b/rosapps/sysutils/utils/pice/loader/stab_gnu.h new file mode 100644 index 00000000000..e73eb990dd0 --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/stab_gnu.h @@ -0,0 +1,37 @@ +#ifndef __GNU_STAB__ + +/* Indicate the GNU stab.h is in use. */ + +#define __GNU_STAB__ + +#define __define_stab(NAME, CODE, STRING) NAME=CODE, +#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE, + +enum __stab_debug_code +{ +#include "stab.def" +LAST_UNUSED_STAB_CODE +}; + +#undef __define_stab + +/* Definitions of "desc" field for N_SO stabs in Solaris2. */ + +#define N_SO_AS 1 +#define N_SO_C 2 +#define N_SO_ANSI_C 3 +#define N_SO_CC 4 /* C++ */ +#define N_SO_FORTRAN 5 +#define N_SO_PASCAL 6 + +/* Solaris2: Floating point type values in basic types. */ + +#define NF_NONE 0 +#define NF_SINGLE 1 /* IEEE 32-bit */ +#define NF_DOUBLE 2 /* IEEE 64-bit */ +#define NF_COMPLEX 3 /* Fortran complex */ +#define NF_COMPLEX16 4 /* Fortran double complex */ +#define NF_COMPLEX32 5 /* Fortran complex*16 */ +#define NF_LDOUBLE 6 /* Long double (whatever that is) */ + +#endif /* __GNU_STAB_ */ diff --git a/rosapps/sysutils/utils/pice/loader/stdinc.h b/rosapps/sysutils/utils/pice/loader/stdinc.h new file mode 100644 index 00000000000..06cdefe760f --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/stdinc.h @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +//#include +#include +#include + +//#include +#include +//#include +//#include +//#include +#include +#include +#include +//#include +//#include + +#include "../../../../include/pe.h" +#include "stab_gnu.h" +//#include "retypes.h" +//#include "terminal.h" +//#include +#include "../shared/shared.h" + + diff --git a/rosapps/sysutils/utils/pice/loader/terminal.c b/rosapps/sysutils/utils/pice/loader/terminal.c new file mode 100644 index 00000000000..2776451bf16 --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/terminal.c @@ -0,0 +1,430 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + termnal.c + +Abstract: + + serial terminal for pICE headless mode + +Environment: + + User mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 23-Jan-2001: created + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#if 0 //ei not ready +#include "stdinc.h" +#include + + +#define CONSOLE_WIDTH (80) +#define CONSOLE_HEIGHT (25) + +USHORT major_version=0xFFFF,minor_version=0xFFFF,build_number=0xFFFF; + +USHORT g_attr = 0; + +USHORT usCurX,usCurY,xSize,ySize; + +USHORT foreground_color_map[]= +{ +}; + +USHORT background_color_map[]= +{ +}; + + +int fd_comm; +struct termios oldtio; + +//************************************************************************ +// CheckSum() +// +//************************************************************************ +UCHAR CheckSum(LPSTR p,ULONG Len) +{ + UCHAR ucCheckSum = 0; + ULONG i; + for(i=0;i 0); +} + +///************************************************************************ +// SendByte() +// +///************************************************************************ +BOOLEAN SendByte(UCHAR c) +{ + return (write(fd_comm,&c,1) > 0); +} + + +///************************************************************************ +// ReadPacket() +// +///************************************************************************ +PSERIAL_PACKET ReadPacket(void) +{ + ULONG i; + PSERIAL_PACKET p; + SERIAL_PACKET_HEADER header; + PUCHAR pHeaderRaw,pData; + char temp[256]; + ULONG ulCheckSum; + + // read a packet header + pHeaderRaw = (PUCHAR)&header; + for(i=0;iheader.packet_size; + + switch(pData->type) + { + case PACKET_TYPE_CONNECT: + { + PSERIAL_DATA_PACKET_CONNECT pDataConnect = (PSERIAL_DATA_PACKET_CONNECT)pData; + UCHAR i; + + for(i=0;ixsize,pDataConnect->ysize); + xSize = pDataConnect->xsize; + ySize = pDataConnect->ysize; + } + break; + case PACKET_TYPE_CLRLINE: + { + PSERIAL_DATA_PACKET_CLRLINE pDataClrLine = (PSERIAL_DATA_PACKET_CLRLINE)pData; + + ClrLine(pDataClrLine->line); + } + break; + case PACKET_TYPE_INVERTLINE: + { + PSERIAL_DATA_PACKET_INVERTLINE pDataInvertLine = (PSERIAL_DATA_PACKET_INVERTLINE)pData; + + InvertLine(pDataInvertLine->line); + } + break; + case PACKET_TYPE_PRINT: + { + PSERIAL_DATA_PACKET_PRINT pDataPrint = (PSERIAL_DATA_PACKET_PRINT)pData; + + Print(pDataPrint->string,pDataPrint->x,pDataPrint->y); + } + break; + case PACKET_TYPE_CURSOR: + { + PSERIAL_DATA_PACKET_CURSOR pDataCursor = (PSERIAL_DATA_PACKET_CURSOR)pData; + + SetCursorPosition(pDataCursor->x,pDataCursor->y); + SetCursorState(pDataCursor->state); + } + break; + case PACKET_TYPE_POLL: + { + PSERIAL_DATA_PACKET_POLL pDataPoll= (PSERIAL_DATA_PACKET_POLL)pData; + + if( (major_version != pDataPoll->major_version) || + (minor_version != pDataPoll->minor_version) || + (build_number != pDataPoll->build_number) ) + { + major_version = pDataPoll->major_version; + minor_version = pDataPoll->minor_version; + build_number = pDataPoll->build_number; + +// SetAppTitle(); + } + + } + break; + default: + //printf("UNHANDLED\n"); + break; + } +} + +//************************************************************************ +// DebuggerShell() +// +//************************************************************************ +void DebuggerShell(void) +{ + PSERIAL_PACKET p; + + //printf("DebuggerShell()\n"); + for(;;) + { + p = ReadPacket(); + if(p) + { + ProcessPacket(p); + DeletePacket(p); + } + else + { + usleep(100*1000); + } + } +} +#endif diff --git a/rosapps/sysutils/utils/pice/loader/terminal.h b/rosapps/sysutils/utils/pice/loader/terminal.h new file mode 100644 index 00000000000..b34991560e1 --- /dev/null +++ b/rosapps/sysutils/utils/pice/loader/terminal.h @@ -0,0 +1,34 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + termnal.h + +Abstract: + + HEADER for terminal.c + +Environment: + + User mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 23-Jan-2001: created + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +BOOLEAN SetupSerial(ULONG port,ULONG baudrate); +void CloseSerial(void); + + +void DebuggerShell(void); diff --git a/rosapps/sysutils/utils/pice/module/animation.h b/rosapps/sysutils/utils/pice/module/animation.h new file mode 100644 index 00000000000..6b5212fa5fc --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/animation.h @@ -0,0 +1,2116 @@ +// this file is dynamically generated: DON'T TOUCH + +UCHAR cAnimation[192*11]={ +0x00, // 1 +0x00, // 2 +0x00, // 3 +0x00, // 4 +0x00, // 5 +0x00, // 6 +0x00, // 7 +0x00, // 8 +0x00, // 9 +0x00, // 10 +0x00, // 11 +0x00, // 12 +0x00, // 13 +0x00, // 14 +0x00, // 15 +0x00, // 16 +0x00, // 17 +0x00, // 18 +0x00, // 19 +0x00, // 20 +0x00, // 21 +0x00, // 22 +0x00, // 23 +0x00, // 24 +0x00, // 25 +0x00, // 26 +0x00, // 27 +0x00, // 28 +0x00, // 29 +0x00, // 30 +0x00, // 31 +0x00, // 32 +0x00, // 33 +0x00, // 34 +0x00, // 35 +0x00, // 36 +0x00, // 37 +0x00, // 38 +0x00, // 39 +0x00, // 40 +0x00, // 41 +0x00, // 42 +0x00, // 43 +0x00, // 44 +0x00, // 45 +0x00, // 46 +0x00, // 47 +0x00, // 48 +0x00, // 49 +0x00, // 50 +0x00, // 51 +0x00, // 52 +0x00, // 53 +0x00, // 54 +0x00, // 55 +0x00, // 56 +0x00, // 57 +0x00, // 58 +0x00, // 59 +0x00, // 60 +0x00, // 61 +0x00, // 62 +0x00, // 63 +0x00, // 64 +0x00, // 65 +0x00, // 66 +0x00, // 67 +0x80, // 68 +0x00, // 69 +0x00, // 70 +0x00, // 71 +0x00, // 72 +0x00, // 73 +0x00, // 74 +0x00, // 75 +0xc0, // 76 +0x00, // 77 +0x00, // 78 +0x00, // 79 +0x00, // 80 +0x00, // 81 +0x00, // 82 +0x03, // 83 +0x60, // 84 +0x00, // 85 +0x00, // 86 +0x00, // 87 +0x00, // 88 +0x00, // 89 +0x00, // 90 +0x01, // 91 +0xb8, // 92 +0x00, // 93 +0x00, // 94 +0x00, // 95 +0x00, // 96 +0x00, // 97 +0x00, // 98 +0x00, // 99 +0xfe, // 100 +0x00, // 101 +0x00, // 102 +0x00, // 103 +0x00, // 104 +0x00, // 105 +0x00, // 106 +0x00, // 107 +0x42, // 108 +0x00, // 109 +0x00, // 110 +0x00, // 111 +0x00, // 112 +0x00, // 113 +0x00, // 114 +0x00, // 115 +0x43, // 116 +0x80, // 117 +0x00, // 118 +0x00, // 119 +0x00, // 120 +0x00, // 121 +0x00, // 122 +0x00, // 123 +0x76, // 124 +0xc0, // 125 +0x00, // 126 +0x00, // 127 +0x00, // 128 +0x00, // 129 +0x00, // 130 +0x02, // 131 +0x3c, // 132 +0x60, // 133 +0x00, // 134 +0x00, // 135 +0x00, // 136 +0x00, // 137 +0x00, // 138 +0x03, // 139 +0xf0, // 140 +0x20, // 141 +0x00, // 142 +0x00, // 143 +0x00, // 144 +0x00, // 145 +0x00, // 146 +0x00, // 147 +0x10, // 148 +0x20, // 149 +0x00, // 150 +0x00, // 151 +0x00, // 152 +0x00, // 153 +0x00, // 154 +0x00, // 155 +0xf8, // 156 +0x20, // 157 +0x00, // 158 +0x00, // 159 +0x00, // 160 +0x00, // 161 +0x00, // 162 +0x00, // 163 +0x1c, // 164 +0x20, // 165 +0x00, // 166 +0x00, // 167 +0x00, // 168 +0x00, // 169 +0x00, // 170 +0x00, // 171 +0x07, // 172 +0xe0, // 173 +0x00, // 174 +0x00, // 175 +0x00, // 176 +0x00, // 177 +0x00, // 178 +0x00, // 179 +0x01, // 180 +0x80, // 181 +0x00, // 182 +0x00, // 183 +0x00, // 184 +0x00, // 185 +0x00, // 186 +0x00, // 187 +0x07, // 188 +0x80, // 189 +0x00, // 190 +0x00, // 191 +0x00, // 192 +0x00, // 2 +0x00, // 4 +0x00, // 6 +0x00, // 8 +0x00, // 10 +0x00, // 12 +0x00, // 14 +0x00, // 16 +0x00, // 18 +0x00, // 20 +0x00, // 22 +0x00, // 24 +0x00, // 26 +0x00, // 28 +0x00, // 30 +0x00, // 32 +0x00, // 34 +0x00, // 36 +0x00, // 38 +0x00, // 40 +0x00, // 42 +0x00, // 44 +0x00, // 46 +0x00, // 48 +0x00, // 50 +0x00, // 52 +0x00, // 54 +0x00, // 56 +0x00, // 58 +0x00, // 60 +0x00, // 62 +0x00, // 64 +0x00, // 66 +0x00, // 68 +0x00, // 70 +0x00, // 72 +0x00, // 74 +0x00, // 76 +0x00, // 78 +0x00, // 80 +0x00, // 82 +0x00, // 84 +0x00, // 86 +0x00, // 88 +0x00, // 90 +0x00, // 92 +0x00, // 94 +0x00, // 96 +0x00, // 98 +0x00, // 100 +0x00, // 102 +0x00, // 104 +0x00, // 106 +0x00, // 108 +0x00, // 110 +0x00, // 112 +0x00, // 114 +0x00, // 116 +0x00, // 118 +0x00, // 120 +0x00, // 122 +0x00, // 124 +0x00, // 126 +0x00, // 128 +0x00, // 130 +0x00, // 132 +0x01, // 134 +0x10, // 136 +0x00, // 138 +0x00, // 140 +0x00, // 142 +0x00, // 144 +0x00, // 146 +0x00, // 148 +0x01, // 150 +0x90, // 152 +0x00, // 154 +0x00, // 156 +0x00, // 158 +0x00, // 160 +0x00, // 162 +0x00, // 164 +0x00, // 166 +0x90, // 168 +0x00, // 170 +0x00, // 172 +0x00, // 174 +0x00, // 176 +0x00, // 178 +0x00, // 180 +0x00, // 182 +0x90, // 184 +0x00, // 186 +0x00, // 188 +0x00, // 190 +0x00, // 192 +0x00, // 194 +0x00, // 196 +0x00, // 198 +0xfe, // 200 +0x00, // 202 +0x00, // 204 +0x00, // 206 +0x00, // 208 +0x00, // 210 +0x00, // 212 +0x00, // 214 +0x42, // 216 +0x40, // 218 +0x00, // 220 +0x00, // 222 +0x00, // 224 +0x00, // 226 +0x00, // 228 +0x00, // 230 +0x43, // 232 +0xc0, // 234 +0x00, // 236 +0x00, // 238 +0x00, // 240 +0x00, // 242 +0x00, // 244 +0x00, // 246 +0x76, // 248 +0xc8, // 250 +0x00, // 252 +0x00, // 254 +0x00, // 256 +0x00, // 258 +0x00, // 260 +0x00, // 262 +0x3c, // 264 +0x78, // 266 +0x00, // 268 +0x00, // 270 +0x00, // 272 +0x00, // 274 +0x00, // 276 +0x01, // 278 +0xf0, // 280 +0x20, // 282 +0x00, // 284 +0x00, // 286 +0x00, // 288 +0x00, // 290 +0x00, // 292 +0x00, // 294 +0x10, // 296 +0x20, // 298 +0x00, // 300 +0x00, // 302 +0x00, // 304 +0x00, // 306 +0x00, // 308 +0x01, // 310 +0xf8, // 312 +0x20, // 314 +0x00, // 316 +0x00, // 318 +0x00, // 320 +0x00, // 322 +0x00, // 324 +0x03, // 326 +0x1c, // 328 +0x20, // 330 +0x00, // 332 +0x00, // 334 +0x00, // 336 +0x00, // 338 +0x00, // 340 +0x00, // 342 +0x07, // 344 +0xe0, // 346 +0x00, // 348 +0x00, // 350 +0x00, // 352 +0x00, // 354 +0x00, // 356 +0x00, // 358 +0x01, // 360 +0x80, // 362 +0x00, // 364 +0x00, // 366 +0x00, // 368 +0x00, // 370 +0x00, // 372 +0x00, // 374 +0x07, // 376 +0x80, // 378 +0x00, // 380 +0x00, // 382 +0x00, // 384 +0x00, // 3 +0x00, // 6 +0x00, // 9 +0x00, // 12 +0x00, // 15 +0x00, // 18 +0x00, // 21 +0x00, // 24 +0x00, // 27 +0x00, // 30 +0x00, // 33 +0x00, // 36 +0x00, // 39 +0x00, // 42 +0x00, // 45 +0x00, // 48 +0x00, // 51 +0x00, // 54 +0x00, // 57 +0x00, // 60 +0x00, // 63 +0x00, // 66 +0x00, // 69 +0x00, // 72 +0x00, // 75 +0x00, // 78 +0x00, // 81 +0x00, // 84 +0x00, // 87 +0x00, // 90 +0x00, // 93 +0x00, // 96 +0x00, // 99 +0x00, // 102 +0x00, // 105 +0x00, // 108 +0x00, // 111 +0x00, // 114 +0x00, // 117 +0x00, // 120 +0x00, // 123 +0x00, // 126 +0x00, // 129 +0x00, // 132 +0x00, // 135 +0x00, // 138 +0x00, // 141 +0x00, // 144 +0x00, // 147 +0x00, // 150 +0x00, // 153 +0x00, // 156 +0x00, // 159 +0x00, // 162 +0x00, // 165 +0x00, // 168 +0x00, // 171 +0x00, // 174 +0x00, // 177 +0x08, // 180 +0x00, // 183 +0x00, // 186 +0x00, // 189 +0x00, // 192 +0x00, // 195 +0x00, // 198 +0x00, // 201 +0x08, // 204 +0x00, // 207 +0x00, // 210 +0x00, // 213 +0x00, // 216 +0x00, // 219 +0x00, // 222 +0x00, // 225 +0x88, // 228 +0x00, // 231 +0x00, // 234 +0x00, // 237 +0x00, // 240 +0x00, // 243 +0x00, // 246 +0x00, // 249 +0x88, // 252 +0x00, // 255 +0x00, // 258 +0x00, // 261 +0x00, // 264 +0x00, // 267 +0x00, // 270 +0x00, // 273 +0x8e, // 276 +0x00, // 279 +0x00, // 282 +0x00, // 285 +0x00, // 288 +0x00, // 291 +0x00, // 294 +0x00, // 297 +0xdb, // 300 +0x00, // 303 +0x00, // 306 +0x00, // 309 +0x00, // 312 +0x00, // 315 +0x00, // 318 +0x00, // 321 +0x71, // 324 +0x10, // 327 +0x00, // 330 +0x00, // 333 +0x00, // 336 +0x00, // 339 +0x00, // 342 +0x00, // 345 +0x23, // 348 +0xb0, // 351 +0x00, // 354 +0x00, // 357 +0x00, // 360 +0x00, // 363 +0x00, // 366 +0x00, // 369 +0x36, // 372 +0xc0, // 375 +0x00, // 378 +0x00, // 381 +0x00, // 384 +0x00, // 387 +0x00, // 390 +0x00, // 393 +0x3c, // 396 +0x6c, // 399 +0x00, // 402 +0x00, // 405 +0x00, // 408 +0x00, // 411 +0x00, // 414 +0x01, // 417 +0xf0, // 420 +0x38, // 423 +0x00, // 426 +0x00, // 429 +0x00, // 432 +0x00, // 435 +0x00, // 438 +0x03, // 441 +0x10, // 444 +0x30, // 447 +0x00, // 450 +0x00, // 453 +0x00, // 456 +0x00, // 459 +0x00, // 462 +0x06, // 465 +0x38, // 468 +0x10, // 471 +0x00, // 474 +0x00, // 477 +0x00, // 480 +0x00, // 483 +0x00, // 486 +0x04, // 489 +0x7c, // 492 +0x30, // 495 +0x00, // 498 +0x00, // 501 +0x00, // 504 +0x00, // 507 +0x00, // 510 +0x00, // 513 +0x46, // 516 +0x20, // 519 +0x00, // 522 +0x00, // 525 +0x00, // 528 +0x00, // 531 +0x00, // 534 +0x00, // 537 +0x01, // 540 +0xe0, // 543 +0x00, // 546 +0x00, // 549 +0x00, // 552 +0x00, // 555 +0x00, // 558 +0x00, // 561 +0x07, // 564 +0x80, // 567 +0x00, // 570 +0x00, // 573 +0x00, // 576 +0x00, // 4 +0x00, // 8 +0x00, // 12 +0x00, // 16 +0x00, // 20 +0x00, // 24 +0x00, // 28 +0x00, // 32 +0x00, // 36 +0x00, // 40 +0x00, // 44 +0x00, // 48 +0x00, // 52 +0x00, // 56 +0x00, // 60 +0x00, // 64 +0x00, // 68 +0x00, // 72 +0x00, // 76 +0x00, // 80 +0x00, // 84 +0x00, // 88 +0x00, // 92 +0x00, // 96 +0x00, // 100 +0x00, // 104 +0x00, // 108 +0x00, // 112 +0x00, // 116 +0x00, // 120 +0x00, // 124 +0x00, // 128 +0x00, // 132 +0x00, // 136 +0x00, // 140 +0x00, // 144 +0x00, // 148 +0x00, // 152 +0x00, // 156 +0x00, // 160 +0x00, // 164 +0x00, // 168 +0x00, // 172 +0x00, // 176 +0x00, // 180 +0x00, // 184 +0x00, // 188 +0x00, // 192 +0x00, // 196 +0x00, // 200 +0x00, // 204 +0x00, // 208 +0x00, // 212 +0x00, // 216 +0x00, // 220 +0x00, // 224 +0x00, // 228 +0x00, // 232 +0x00, // 236 +0x00, // 240 +0x00, // 244 +0x00, // 248 +0x00, // 252 +0x00, // 256 +0x00, // 260 +0x00, // 264 +0x01, // 268 +0x10, // 272 +0x00, // 276 +0x00, // 280 +0x00, // 284 +0x00, // 288 +0x00, // 292 +0x00, // 296 +0x01, // 300 +0x90, // 304 +0x00, // 308 +0x00, // 312 +0x00, // 316 +0x00, // 320 +0x00, // 324 +0x00, // 328 +0x00, // 332 +0x90, // 336 +0x00, // 340 +0x00, // 344 +0x00, // 348 +0x00, // 352 +0x00, // 356 +0x00, // 360 +0x00, // 364 +0x90, // 368 +0x00, // 372 +0x00, // 376 +0x00, // 380 +0x00, // 384 +0x00, // 388 +0x00, // 392 +0x00, // 396 +0xfe, // 400 +0x00, // 404 +0x00, // 408 +0x00, // 412 +0x00, // 416 +0x00, // 420 +0x00, // 424 +0x00, // 428 +0x42, // 432 +0x40, // 436 +0x00, // 440 +0x00, // 444 +0x00, // 448 +0x00, // 452 +0x00, // 456 +0x00, // 460 +0x43, // 464 +0xc0, // 468 +0x00, // 472 +0x00, // 476 +0x00, // 480 +0x00, // 484 +0x00, // 488 +0x00, // 492 +0x76, // 496 +0xc8, // 500 +0x00, // 504 +0x00, // 508 +0x00, // 512 +0x00, // 516 +0x00, // 520 +0x00, // 524 +0x3c, // 528 +0x78, // 532 +0x00, // 536 +0x00, // 540 +0x00, // 544 +0x00, // 548 +0x00, // 552 +0x01, // 556 +0xf0, // 560 +0x20, // 564 +0x00, // 568 +0x00, // 572 +0x00, // 576 +0x00, // 580 +0x00, // 584 +0x00, // 588 +0x10, // 592 +0x20, // 596 +0x00, // 600 +0x00, // 604 +0x00, // 608 +0x00, // 612 +0x00, // 616 +0x01, // 620 +0xf8, // 624 +0x20, // 628 +0x00, // 632 +0x00, // 636 +0x00, // 640 +0x00, // 644 +0x00, // 648 +0x03, // 652 +0x1c, // 656 +0x20, // 660 +0x00, // 664 +0x00, // 668 +0x00, // 672 +0x00, // 676 +0x00, // 680 +0x00, // 684 +0x07, // 688 +0xe0, // 692 +0x00, // 696 +0x00, // 700 +0x00, // 704 +0x00, // 708 +0x00, // 712 +0x00, // 716 +0x01, // 720 +0x80, // 724 +0x00, // 728 +0x00, // 732 +0x00, // 736 +0x00, // 740 +0x00, // 744 +0x00, // 748 +0x07, // 752 +0x80, // 756 +0x00, // 760 +0x00, // 764 +0x00, // 768 +0x00, // 5 +0x00, // 10 +0x00, // 15 +0x00, // 20 +0x00, // 25 +0x00, // 30 +0x00, // 35 +0x00, // 40 +0x00, // 45 +0x00, // 50 +0x00, // 55 +0x00, // 60 +0x00, // 65 +0x00, // 70 +0x00, // 75 +0x00, // 80 +0x00, // 85 +0x00, // 90 +0x00, // 95 +0x00, // 100 +0x00, // 105 +0x00, // 110 +0x00, // 115 +0x00, // 120 +0x00, // 125 +0x00, // 130 +0x00, // 135 +0x00, // 140 +0x00, // 145 +0x00, // 150 +0x00, // 155 +0x00, // 160 +0x00, // 165 +0x00, // 170 +0x00, // 175 +0x00, // 180 +0x00, // 185 +0x00, // 190 +0x00, // 195 +0x00, // 200 +0x00, // 205 +0x00, // 210 +0x00, // 215 +0x00, // 220 +0x00, // 225 +0x00, // 230 +0x00, // 235 +0x00, // 240 +0x00, // 245 +0x00, // 250 +0x00, // 255 +0x00, // 260 +0x00, // 265 +0x00, // 270 +0x00, // 275 +0x00, // 280 +0x00, // 285 +0x00, // 290 +0x00, // 295 +0x00, // 300 +0x00, // 305 +0x00, // 310 +0x00, // 315 +0x00, // 320 +0x00, // 325 +0x00, // 330 +0x00, // 335 +0x80, // 340 +0x00, // 345 +0x00, // 350 +0x00, // 355 +0x00, // 360 +0x00, // 365 +0x00, // 370 +0x00, // 375 +0xc0, // 380 +0x00, // 385 +0x00, // 390 +0x00, // 395 +0x00, // 400 +0x00, // 405 +0x00, // 410 +0x03, // 415 +0x60, // 420 +0x00, // 425 +0x00, // 430 +0x00, // 435 +0x00, // 440 +0x00, // 445 +0x00, // 450 +0x01, // 455 +0xb8, // 460 +0x00, // 465 +0x00, // 470 +0x00, // 475 +0x00, // 480 +0x00, // 485 +0x00, // 490 +0x00, // 495 +0xfe, // 500 +0x00, // 505 +0x00, // 510 +0x00, // 515 +0x00, // 520 +0x00, // 525 +0x00, // 530 +0x00, // 535 +0x42, // 540 +0x00, // 545 +0x00, // 550 +0x00, // 555 +0x00, // 560 +0x00, // 565 +0x00, // 570 +0x00, // 575 +0x43, // 580 +0x80, // 585 +0x00, // 590 +0x00, // 595 +0x00, // 600 +0x00, // 605 +0x00, // 610 +0x00, // 615 +0x76, // 620 +0xc0, // 625 +0x00, // 630 +0x00, // 635 +0x00, // 640 +0x00, // 645 +0x00, // 650 +0x02, // 655 +0x3c, // 660 +0x60, // 665 +0x00, // 670 +0x00, // 675 +0x00, // 680 +0x00, // 685 +0x00, // 690 +0x03, // 695 +0xf0, // 700 +0x20, // 705 +0x00, // 710 +0x00, // 715 +0x00, // 720 +0x00, // 725 +0x00, // 730 +0x00, // 735 +0x10, // 740 +0x20, // 745 +0x00, // 750 +0x00, // 755 +0x00, // 760 +0x00, // 765 +0x00, // 770 +0x00, // 775 +0xf8, // 780 +0x20, // 785 +0x00, // 790 +0x00, // 795 +0x00, // 800 +0x00, // 805 +0x00, // 810 +0x00, // 815 +0x1c, // 820 +0x20, // 825 +0x00, // 830 +0x00, // 835 +0x00, // 840 +0x00, // 845 +0x00, // 850 +0x00, // 855 +0x07, // 860 +0xe0, // 865 +0x00, // 870 +0x00, // 875 +0x00, // 880 +0x00, // 885 +0x00, // 890 +0x00, // 895 +0x01, // 900 +0x80, // 905 +0x00, // 910 +0x00, // 915 +0x00, // 920 +0x00, // 925 +0x00, // 930 +0x00, // 935 +0x07, // 940 +0x80, // 945 +0x00, // 950 +0x00, // 955 +0x00, // 960 +0x00, // 6 +0x00, // 12 +0x00, // 18 +0x00, // 24 +0x00, // 30 +0x00, // 36 +0x00, // 42 +0x00, // 48 +0x00, // 54 +0x00, // 60 +0x00, // 66 +0x00, // 72 +0x00, // 78 +0x00, // 84 +0x00, // 90 +0x00, // 96 +0x00, // 102 +0x00, // 108 +0x00, // 114 +0x00, // 120 +0x00, // 126 +0x00, // 132 +0x00, // 138 +0x00, // 144 +0x00, // 150 +0x00, // 156 +0x00, // 162 +0x00, // 168 +0x00, // 174 +0x00, // 180 +0x00, // 186 +0x00, // 192 +0x00, // 198 +0x00, // 204 +0x00, // 210 +0x00, // 216 +0x00, // 222 +0x00, // 228 +0x00, // 234 +0x00, // 240 +0x00, // 246 +0x00, // 252 +0x00, // 258 +0x00, // 264 +0x00, // 270 +0x00, // 276 +0x00, // 282 +0x00, // 288 +0x00, // 294 +0x00, // 300 +0x00, // 306 +0x00, // 312 +0x00, // 318 +0x00, // 324 +0x00, // 330 +0x00, // 336 +0x00, // 342 +0x00, // 348 +0x00, // 354 +0x08, // 360 +0x00, // 366 +0x00, // 372 +0x00, // 378 +0x00, // 384 +0x00, // 390 +0x00, // 396 +0x00, // 402 +0x08, // 408 +0x00, // 414 +0x00, // 420 +0x00, // 426 +0x00, // 432 +0x00, // 438 +0x00, // 444 +0x00, // 450 +0x88, // 456 +0x00, // 462 +0x00, // 468 +0x00, // 474 +0x00, // 480 +0x00, // 486 +0x00, // 492 +0x00, // 498 +0x88, // 504 +0x00, // 510 +0x00, // 516 +0x00, // 522 +0x00, // 528 +0x00, // 534 +0x00, // 540 +0x00, // 546 +0x8e, // 552 +0x00, // 558 +0x00, // 564 +0x00, // 570 +0x00, // 576 +0x00, // 582 +0x00, // 588 +0x00, // 594 +0xdb, // 600 +0x00, // 606 +0x00, // 612 +0x00, // 618 +0x00, // 624 +0x00, // 630 +0x00, // 636 +0x00, // 642 +0x71, // 648 +0x10, // 654 +0x00, // 660 +0x00, // 666 +0x00, // 672 +0x00, // 678 +0x00, // 684 +0x00, // 690 +0x23, // 696 +0xb0, // 702 +0x00, // 708 +0x00, // 714 +0x00, // 720 +0x00, // 726 +0x00, // 732 +0x00, // 738 +0x36, // 744 +0xc0, // 750 +0x00, // 756 +0x00, // 762 +0x00, // 768 +0x00, // 774 +0x00, // 780 +0x00, // 786 +0x3c, // 792 +0x6c, // 798 +0x00, // 804 +0x00, // 810 +0x00, // 816 +0x00, // 822 +0x00, // 828 +0x01, // 834 +0xf0, // 840 +0x38, // 846 +0x00, // 852 +0x00, // 858 +0x00, // 864 +0x00, // 870 +0x00, // 876 +0x03, // 882 +0x10, // 888 +0x30, // 894 +0x00, // 900 +0x00, // 906 +0x00, // 912 +0x00, // 918 +0x00, // 924 +0x06, // 930 +0x38, // 936 +0x10, // 942 +0x00, // 948 +0x00, // 954 +0x00, // 960 +0x00, // 966 +0x00, // 972 +0x04, // 978 +0x7c, // 984 +0x30, // 990 +0x00, // 996 +0x00, // 1002 +0x00, // 1008 +0x00, // 1014 +0x00, // 1020 +0x00, // 1026 +0x46, // 1032 +0x20, // 1038 +0x00, // 1044 +0x00, // 1050 +0x00, // 1056 +0x00, // 1062 +0x00, // 1068 +0x00, // 1074 +0x01, // 1080 +0xe0, // 1086 +0x00, // 1092 +0x00, // 1098 +0x00, // 1104 +0x00, // 1110 +0x00, // 1116 +0x00, // 1122 +0x07, // 1128 +0x80, // 1134 +0x00, // 1140 +0x00, // 1146 +0x00, // 1152 +0x00, // 7 +0x00, // 14 +0x00, // 21 +0x00, // 28 +0x00, // 35 +0x00, // 42 +0x00, // 49 +0x00, // 56 +0x00, // 63 +0x00, // 70 +0x00, // 77 +0x00, // 84 +0x00, // 91 +0x00, // 98 +0x00, // 105 +0x00, // 112 +0x00, // 119 +0x00, // 126 +0x00, // 133 +0x00, // 140 +0x00, // 147 +0x00, // 154 +0x00, // 161 +0x00, // 168 +0x00, // 175 +0x00, // 182 +0x00, // 189 +0x00, // 196 +0x00, // 203 +0x00, // 210 +0x00, // 217 +0x00, // 224 +0x00, // 231 +0x00, // 238 +0x00, // 245 +0x00, // 252 +0x00, // 259 +0x00, // 266 +0x00, // 273 +0x00, // 280 +0x00, // 287 +0x00, // 294 +0x00, // 301 +0x01, // 308 +0x00, // 315 +0x00, // 322 +0x00, // 329 +0x00, // 336 +0x00, // 343 +0x00, // 350 +0x00, // 357 +0x21, // 364 +0x00, // 371 +0x00, // 378 +0x00, // 385 +0x00, // 392 +0x00, // 399 +0x00, // 406 +0x00, // 413 +0x23, // 420 +0x00, // 427 +0x00, // 434 +0x00, // 441 +0x00, // 448 +0x00, // 455 +0x00, // 462 +0x00, // 469 +0x22, // 476 +0x00, // 483 +0x00, // 490 +0x00, // 497 +0x00, // 504 +0x00, // 511 +0x00, // 518 +0x00, // 525 +0x22, // 532 +0x00, // 539 +0x00, // 546 +0x00, // 553 +0x00, // 560 +0x00, // 567 +0x00, // 574 +0x00, // 581 +0x33, // 588 +0x00, // 595 +0x00, // 602 +0x00, // 609 +0x00, // 616 +0x00, // 623 +0x00, // 630 +0x00, // 637 +0x1f, // 644 +0x80, // 651 +0x00, // 658 +0x00, // 665 +0x00, // 672 +0x00, // 679 +0x00, // 686 +0x00, // 693 +0x08, // 700 +0x80, // 707 +0x00, // 714 +0x00, // 721 +0x00, // 728 +0x00, // 735 +0x00, // 742 +0x00, // 749 +0x08, // 756 +0x88, // 763 +0x00, // 770 +0x00, // 777 +0x00, // 784 +0x00, // 791 +0x00, // 798 +0x00, // 805 +0x09, // 812 +0x98, // 819 +0x00, // 826 +0x00, // 833 +0x00, // 840 +0x00, // 847 +0x00, // 854 +0x00, // 861 +0x0f, // 868 +0xf0, // 875 +0x00, // 882 +0x00, // 889 +0x00, // 896 +0x00, // 903 +0x00, // 910 +0x00, // 917 +0x0c, // 924 +0x20, // 931 +0x00, // 938 +0x00, // 945 +0x00, // 952 +0x00, // 959 +0x00, // 966 +0x0f, // 973 +0xf8, // 980 +0x30, // 987 +0x00, // 994 +0x00, // 1001 +0x00, // 1008 +0x00, // 1015 +0x00, // 1022 +0x00, // 1029 +0x08, // 1036 +0x1f, // 1043 +0x80, // 1050 +0x00, // 1057 +0x00, // 1064 +0x00, // 1071 +0x00, // 1078 +0x00, // 1085 +0x1c, // 1092 +0x10, // 1099 +0x00, // 1106 +0x00, // 1113 +0x00, // 1120 +0x00, // 1127 +0x00, // 1134 +0x00, // 1141 +0xf6, // 1148 +0x30, // 1155 +0x00, // 1162 +0x00, // 1169 +0x00, // 1176 +0x00, // 1183 +0x00, // 1190 +0x00, // 1197 +0x83, // 1204 +0x60, // 1211 +0x00, // 1218 +0x00, // 1225 +0x00, // 1232 +0x00, // 1239 +0x00, // 1246 +0x00, // 1253 +0x01, // 1260 +0xc0, // 1267 +0x00, // 1274 +0x00, // 1281 +0x00, // 1288 +0x00, // 1295 +0x00, // 1302 +0x00, // 1309 +0x03, // 1316 +0xe0, // 1323 +0x00, // 1330 +0x00, // 1337 +0x00, // 1344 +0x00, // 8 +0x00, // 16 +0x00, // 24 +0x00, // 32 +0x00, // 40 +0x00, // 48 +0x00, // 56 +0x00, // 64 +0x00, // 72 +0x00, // 80 +0x00, // 88 +0x00, // 96 +0x00, // 104 +0x00, // 112 +0x00, // 120 +0x00, // 128 +0x00, // 136 +0x00, // 144 +0x00, // 152 +0x00, // 160 +0x00, // 168 +0x00, // 176 +0x00, // 184 +0x00, // 192 +0x00, // 200 +0x00, // 208 +0x00, // 216 +0x00, // 224 +0x00, // 232 +0x00, // 240 +0x00, // 248 +0x00, // 256 +0x00, // 264 +0x00, // 272 +0x00, // 280 +0x00, // 288 +0x00, // 296 +0x00, // 304 +0x00, // 312 +0x00, // 320 +0x00, // 328 +0x00, // 336 +0x00, // 344 +0x00, // 352 +0x00, // 360 +0x00, // 368 +0x00, // 376 +0x00, // 384 +0x00, // 392 +0x00, // 400 +0x00, // 408 +0x00, // 416 +0x00, // 424 +0x00, // 432 +0x00, // 440 +0x00, // 448 +0x00, // 456 +0x00, // 464 +0x00, // 472 +0x00, // 480 +0x00, // 488 +0x00, // 496 +0x00, // 504 +0x00, // 512 +0x00, // 520 +0x00, // 528 +0x00, // 536 +0x00, // 544 +0x0c, // 552 +0x00, // 560 +0x00, // 568 +0x00, // 576 +0x00, // 584 +0x00, // 592 +0x00, // 600 +0x06, // 608 +0x18, // 616 +0x00, // 624 +0x00, // 632 +0x00, // 640 +0x00, // 648 +0x00, // 656 +0x00, // 664 +0x03, // 672 +0x30, // 680 +0x00, // 688 +0x00, // 696 +0x00, // 704 +0x00, // 712 +0x00, // 720 +0x00, // 728 +0x01, // 736 +0xe0, // 744 +0x00, // 752 +0x00, // 760 +0x00, // 768 +0x00, // 776 +0x00, // 784 +0x00, // 792 +0x01, // 800 +0x20, // 808 +0x00, // 816 +0x00, // 824 +0x00, // 832 +0x00, // 840 +0x00, // 848 +0x00, // 856 +0x01, // 864 +0x20, // 872 +0x00, // 880 +0x00, // 888 +0x00, // 896 +0x00, // 904 +0x00, // 912 +0x00, // 920 +0x01, // 928 +0xe0, // 936 +0x00, // 944 +0x00, // 952 +0x00, // 960 +0x00, // 968 +0x00, // 976 +0x00, // 984 +0x3d, // 992 +0xb9, // 1000 +0x80, // 1008 +0x00, // 1016 +0x00, // 1024 +0x00, // 1032 +0x00, // 1040 +0x00, // 1048 +0x07, // 1056 +0x0f, // 1064 +0x00, // 1072 +0x00, // 1080 +0x00, // 1088 +0x00, // 1096 +0x00, // 1104 +0x00, // 1112 +0x02, // 1120 +0x08, // 1128 +0x00, // 1136 +0x00, // 1144 +0x00, // 1152 +0x00, // 1160 +0x00, // 1168 +0x00, // 1176 +0x02, // 1184 +0x0b, // 1192 +0x80, // 1200 +0x00, // 1208 +0x00, // 1216 +0x00, // 1224 +0x00, // 1232 +0x00, // 1240 +0x3f, // 1248 +0x1e, // 1256 +0x00, // 1264 +0x00, // 1272 +0x00, // 1280 +0x00, // 1288 +0x00, // 1296 +0x00, // 1304 +0x01, // 1312 +0x10, // 1320 +0x00, // 1328 +0x00, // 1336 +0x00, // 1344 +0x00, // 1352 +0x00, // 1360 +0x00, // 1368 +0x01, // 1376 +0xe0, // 1384 +0x00, // 1392 +0x00, // 1400 +0x00, // 1408 +0x00, // 1416 +0x00, // 1424 +0x00, // 1432 +0x00, // 1440 +0xf0, // 1448 +0x00, // 1456 +0x00, // 1464 +0x00, // 1472 +0x00, // 1480 +0x00, // 1488 +0x00, // 1496 +0x01, // 1504 +0x98, // 1512 +0x00, // 1520 +0x00, // 1528 +0x00, // 1536 +0x00, // 9 +0x00, // 18 +0x00, // 27 +0x01, // 36 +0xff, // 45 +0xc0, // 54 +0x00, // 63 +0x00, // 72 +0x00, // 81 +0x00, // 90 +0x00, // 99 +0x00, // 108 +0xff, // 117 +0x80, // 126 +0x00, // 135 +0x00, // 144 +0x00, // 153 +0x00, // 162 +0x00, // 171 +0x00, // 180 +0x3f, // 189 +0x80, // 198 +0x00, // 207 +0x00, // 216 +0x00, // 225 +0x00, // 234 +0x00, // 243 +0x00, // 252 +0x01, // 261 +0x80, // 270 +0x00, // 279 +0x00, // 288 +0x00, // 297 +0x00, // 306 +0x00, // 315 +0x00, // 324 +0x00, // 333 +0x00, // 342 +0x00, // 351 +0x00, // 360 +0x00, // 369 +0x00, // 378 +0x00, // 387 +0x00, // 396 +0x00, // 405 +0x00, // 414 +0x00, // 423 +0x00, // 432 +0x00, // 441 +0x00, // 450 +0x00, // 459 +0x00, // 468 +0x00, // 477 +0x00, // 486 +0x00, // 495 +0x00, // 504 +0x00, // 513 +0x00, // 522 +0x00, // 531 +0x00, // 540 +0x00, // 549 +0x00, // 558 +0x00, // 567 +0x00, // 576 +0x00, // 585 +0x00, // 594 +0x00, // 603 +0x00, // 612 +0x0c, // 621 +0x00, // 630 +0x00, // 639 +0x00, // 648 +0x00, // 657 +0x00, // 666 +0x00, // 675 +0x06, // 684 +0x18, // 693 +0x00, // 702 +0x00, // 711 +0x00, // 720 +0x00, // 729 +0x00, // 738 +0x00, // 747 +0x03, // 756 +0x30, // 765 +0x00, // 774 +0x00, // 783 +0x00, // 792 +0x00, // 801 +0x00, // 810 +0x00, // 819 +0x01, // 828 +0xe0, // 837 +0x00, // 846 +0x00, // 855 +0x00, // 864 +0x00, // 873 +0x00, // 882 +0x00, // 891 +0x01, // 900 +0x20, // 909 +0x00, // 918 +0x00, // 927 +0x00, // 936 +0x00, // 945 +0x00, // 954 +0x00, // 963 +0x01, // 972 +0x20, // 981 +0x00, // 990 +0x00, // 999 +0x00, // 1008 +0x00, // 1017 +0x00, // 1026 +0x00, // 1035 +0x01, // 1044 +0xe0, // 1053 +0x00, // 1062 +0x00, // 1071 +0x00, // 1080 +0x00, // 1089 +0x00, // 1098 +0x00, // 1107 +0x3d, // 1116 +0xb9, // 1125 +0x80, // 1134 +0x00, // 1143 +0x00, // 1152 +0x00, // 1161 +0x00, // 1170 +0x00, // 1179 +0x07, // 1188 +0x0f, // 1197 +0x00, // 1206 +0x00, // 1215 +0x00, // 1224 +0x00, // 1233 +0x00, // 1242 +0x00, // 1251 +0x02, // 1260 +0x08, // 1269 +0x00, // 1278 +0x00, // 1287 +0x00, // 1296 +0x00, // 1305 +0x00, // 1314 +0x00, // 1323 +0x02, // 1332 +0x0b, // 1341 +0x80, // 1350 +0x00, // 1359 +0x00, // 1368 +0x00, // 1377 +0x00, // 1386 +0x00, // 1395 +0x3f, // 1404 +0x1e, // 1413 +0x00, // 1422 +0x00, // 1431 +0x00, // 1440 +0x00, // 1449 +0x00, // 1458 +0x00, // 1467 +0x01, // 1476 +0x10, // 1485 +0x00, // 1494 +0x00, // 1503 +0x00, // 1512 +0x00, // 1521 +0x00, // 1530 +0x00, // 1539 +0x01, // 1548 +0xe0, // 1557 +0x00, // 1566 +0x00, // 1575 +0x00, // 1584 +0x00, // 1593 +0x00, // 1602 +0x00, // 1611 +0x00, // 1620 +0xf0, // 1629 +0x00, // 1638 +0x00, // 1647 +0x00, // 1656 +0x00, // 1665 +0x00, // 1674 +0x00, // 1683 +0x01, // 1692 +0x98, // 1701 +0x00, // 1710 +0x00, // 1719 +0x00, // 1728 +0x00, // 10 +0x00, // 20 +0x00, // 30 +0x0f, // 40 +0xfe, // 50 +0x00, // 60 +0x00, // 70 +0x00, // 80 +0x00, // 90 +0x00, // 100 +0x00, // 110 +0x0f, // 120 +0xff, // 130 +0xc0, // 140 +0x00, // 150 +0x00, // 160 +0x00, // 170 +0x00, // 180 +0x00, // 190 +0x1f, // 200 +0xff, // 210 +0xc0, // 220 +0x00, // 230 +0x00, // 240 +0x00, // 250 +0x00, // 260 +0x00, // 270 +0x1f, // 280 +0xff, // 290 +0x80, // 300 +0x00, // 310 +0x00, // 320 +0x00, // 330 +0x00, // 340 +0x00, // 350 +0x1f, // 360 +0xff, // 370 +0x80, // 380 +0x00, // 390 +0x00, // 400 +0x00, // 410 +0x00, // 420 +0x00, // 430 +0x1f, // 440 +0xff, // 450 +0x80, // 460 +0x00, // 470 +0x00, // 480 +0x00, // 490 +0x00, // 500 +0x00, // 510 +0x3f, // 520 +0xff, // 530 +0x80, // 540 +0x00, // 550 +0x00, // 560 +0x00, // 570 +0x00, // 580 +0x00, // 590 +0x3f, // 600 +0xff, // 610 +0xff, // 620 +0xff, // 630 +0xf8, // 640 +0x00, // 650 +0x00, // 660 +0x00, // 670 +0x3f, // 680 +0xff, // 690 +0x80, // 700 +0x00, // 710 +0x08, // 720 +0x00, // 730 +0x00, // 740 +0x00, // 750 +0x3f, // 760 +0xff, // 770 +0x80, // 780 +0x00, // 790 +0x08, // 800 +0x00, // 810 +0x00, // 820 +0x00, // 830 +0x3f, // 840 +0xff, // 850 +0x80, // 860 +0x7f, // 870 +0xf8, // 880 +0x00, // 890 +0x00, // 900 +0x00, // 910 +0x3f, // 920 +0xff, // 930 +0xff, // 940 +0xc0, // 950 +0x00, // 960 +0x00, // 970 +0x00, // 980 +0x00, // 990 +0x3f, // 1000 +0xff, // 1010 +0x80, // 1020 +0x00, // 1030 +0x00, // 1040 +0x00, // 1050 +0x00, // 1060 +0x00, // 1070 +0x3f, // 1080 +0xff, // 1090 +0x80, // 1100 +0x00, // 1110 +0x00, // 1120 +0x00, // 1130 +0x00, // 1140 +0x00, // 1150 +0x3f, // 1160 +0xff, // 1170 +0x80, // 1180 +0x00, // 1190 +0x00, // 1200 +0x00, // 1210 +0x00, // 1220 +0x00, // 1230 +0x3f, // 1240 +0xff, // 1250 +0x80, // 1260 +0x00, // 1270 +0x00, // 1280 +0x00, // 1290 +0x00, // 1300 +0x00, // 1310 +0x3f, // 1320 +0xff, // 1330 +0x80, // 1340 +0x00, // 1350 +0x00, // 1360 +0x00, // 1370 +0x00, // 1380 +0x00, // 1390 +0x3f, // 1400 +0xff, // 1410 +0x80, // 1420 +0x00, // 1430 +0x00, // 1440 +0x00, // 1450 +0x00, // 1460 +0x00, // 1470 +0x03, // 1480 +0xfb, // 1490 +0x80, // 1500 +0x00, // 1510 +0x00, // 1520 +0x00, // 1530 +0x00, // 1540 +0x00, // 1550 +0x3f, // 1560 +0x1e, // 1570 +0x00, // 1580 +0x00, // 1590 +0x00, // 1600 +0x00, // 1610 +0x00, // 1620 +0x1c, // 1630 +0x01, // 1640 +0x10, // 1650 +0x7c, // 1660 +0x00, // 1670 +0x00, // 1680 +0x00, // 1690 +0x00, // 1700 +0x10, // 1710 +0x01, // 1720 +0xe0, // 1730 +0x0c, // 1740 +0x00, // 1750 +0x00, // 1760 +0x00, // 1770 +0x00, // 1780 +0x00, // 1790 +0x00, // 1800 +0xf0, // 1810 +0x00, // 1820 +0x80, // 1830 +0x00, // 1840 +0x00, // 1850 +0x00, // 1860 +0x00, // 1870 +0x01, // 1880 +0x98, // 1890 +0x00, // 1900 +0x00, // 1910 +0x00, // 1920 +0x00, // 11 +0x00, // 22 +0x00, // 33 +0x07, // 44 +0xfe, // 55 +0x00, // 66 +0x00, // 77 +0x00, // 88 +0x00, // 99 +0x00, // 110 +0x00, // 121 +0x3f, // 132 +0xff, // 143 +0x80, // 154 +0x00, // 165 +0x00, // 176 +0x00, // 187 +0x00, // 198 +0x00, // 209 +0x3f, // 220 +0xff, // 231 +0xc0, // 242 +0x00, // 253 +0x00, // 264 +0x00, // 275 +0x00, // 286 +0x00, // 297 +0x3f, // 308 +0xff, // 319 +0xc0, // 330 +0x00, // 341 +0x00, // 352 +0x00, // 363 +0x00, // 374 +0x00, // 385 +0x3f, // 396 +0xff, // 407 +0xc0, // 418 +0x00, // 429 +0x00, // 440 +0x00, // 451 +0x00, // 462 +0x00, // 473 +0x3f, // 484 +0xff, // 495 +0xc0, // 506 +0x00, // 517 +0x00, // 528 +0x00, // 539 +0x00, // 550 +0x00, // 561 +0x7f, // 572 +0xff, // 583 +0xc0, // 594 +0x00, // 605 +0x00, // 616 +0x00, // 627 +0x00, // 638 +0x00, // 649 +0x7f, // 660 +0xff, // 671 +0xc0, // 682 +0x01, // 693 +0xf8, // 704 +0x00, // 715 +0x00, // 726 +0x00, // 737 +0x7f, // 748 +0xff, // 759 +0xc0, // 770 +0x1f, // 781 +0x0c, // 792 +0x00, // 803 +0x00, // 814 +0x00, // 825 +0x7f, // 836 +0xff, // 847 +0xc0, // 858 +0xf0, // 869 +0x0c, // 880 +0x00, // 891 +0x00, // 902 +0x00, // 913 +0x7f, // 924 +0xff, // 935 +0xff, // 946 +0x00, // 957 +0x38, // 968 +0x00, // 979 +0x00, // 990 +0x00, // 1001 +0x7f, // 1012 +0xff, // 1023 +0xe0, // 1034 +0x01, // 1045 +0xc0, // 1056 +0x00, // 1067 +0x00, // 1078 +0x00, // 1089 +0x3f, // 1100 +0xff, // 1111 +0xc0, // 1122 +0xff, // 1133 +0x00, // 1144 +0x00, // 1155 +0x00, // 1166 +0x00, // 1177 +0x3f, // 1188 +0xff, // 1199 +0xc7, // 1210 +0x80, // 1221 +0x00, // 1232 +0x00, // 1243 +0x00, // 1254 +0x00, // 1265 +0x3f, // 1276 +0xff, // 1287 +0xfc, // 1298 +0x00, // 1309 +0x00, // 1320 +0x00, // 1331 +0x00, // 1342 +0x00, // 1353 +0x3f, // 1364 +0xff, // 1375 +0xe0, // 1386 +0x00, // 1397 +0x00, // 1408 +0x00, // 1419 +0x00, // 1430 +0x00, // 1441 +0x3f, // 1452 +0xff, // 1463 +0xc0, // 1474 +0x00, // 1485 +0x00, // 1496 +0x00, // 1507 +0x00, // 1518 +0x00, // 1529 +0x3f, // 1540 +0xff, // 1551 +0x80, // 1562 +0x00, // 1573 +0x00, // 1584 +0x00, // 1595 +0x00, // 1606 +0x00, // 1617 +0x3f, // 1628 +0xff, // 1639 +0x80, // 1650 +0x00, // 1661 +0x00, // 1672 +0x00, // 1683 +0x00, // 1694 +0x00, // 1705 +0x3f, // 1716 +0xff, // 1727 +0x80, // 1738 +0x00, // 1749 +0x00, // 1760 +0x00, // 1771 +0x00, // 1782 +0x00, // 1793 +0x1f, // 1804 +0xff, // 1815 +0x80, // 1826 +0x00, // 1837 +0x00, // 1848 +0x00, // 1859 +0x00, // 1870 +0x00, // 1881 +0x1f, // 1892 +0xff, // 1903 +0x80, // 1914 +0x00, // 1925 +0x00, // 1936 +0x00, // 1947 +0x00, // 1958 +0x00, // 1969 +0x1f, // 1980 +0xff, // 1991 +0x80, // 2002 +0x00, // 2013 +0x00, // 2024 +0x00, // 2035 +0x00, // 2046 +0x5f, // 2057 +0x9f, // 2068 +0xff, // 2079 +0x9f, // 2090 +0x10, // 2101 +0x00, // 2112 +}; diff --git a/rosapps/sysutils/utils/pice/module/bp.c b/rosapps/sysutils/utils/pice/module/bp.c new file mode 100644 index 00000000000..7b71296e4c1 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/bp.c @@ -0,0 +1,752 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + bp.c + +Abstract: + + setting, listing and removing breakpoints + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 13-Nov-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//////////////////////////////////////////////////// +// GLOBALS +//// +char tempBp[1024]; + +ULONG OldInt3Handler=0; + +SW_BP aSwBreakpoints[64]={{0,0,0,0},}; + +//************************************************************************* +// FindSwBp() +// +//************************************************************************* +PSW_BP FindSwBp(ULONG ulAddress) +{ + ULONG i; + + for(i=0;ibUsed == TRUE && + p->bVirtual == TRUE && + PICE_strcmpi(p->szModName,ModName)==0 && + PICE_strcmpi(p->szFunctionName,szFunctionName)==0) + { + return p; + } + } + + return NULL; +} + +//************************************************************************* +// IsSwBpAtAddressInstalled() +// +//************************************************************************* +BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress) +{ + ULONG i; + + for(i=0;ibUsed == TRUE && p->bInstalled == FALSE && p->ulAddress==ulAddress && p->bVirtual==FALSE) + { + if(IsAddressValid(p->ulAddress)) + { + DPRINT((0,"NeedToReInstallSWBreakpoint(): [1] found BP\n")); + bResult = TRUE; + break; + } + } + } + else + { + if(p->bUsed == TRUE && p->bInstalled == FALSE && p->bVirtual == FALSE) + { + if(IsAddressValid(p->ulAddress)) + { + DPRINT((0,"NeedToReInstallSWBreakpoint(): [2] found BP\n")); + bResult = TRUE; + break; + } + } + } + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// ReInstallSWBreakpoint() +// +//************************************************************************* +BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress) +{ + PSW_BP p; + BOOLEAN bResult = FALSE; + ULONG i; + + ENTER_FUNC(); + DPRINT((0,"ReInstallSWBreakpoint()\n")); + + for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++) + { + p = &aSwBreakpoints[i]; + if(p->bUsed == TRUE && p->bInstalled == FALSE && p->ulAddress == ulAddress && p->bVirtual == FALSE) + { + if(IsAddressValid(p->ulAddress)) + { + BOOLEAN isWriteable; + + if( !( isWriteable = IsAddressWriteable(p->ulAddress) ) ) + SetAddressWriteable(p->ulAddress,TRUE); + *(PUCHAR)(p->ulAddress) = 0xCC; + if( !isWriteable ) + SetAddressWriteable(p->ulAddress,FALSE); + p->bInstalled = TRUE; + bResult = TRUE; + } + } + } + + LEAVE_FUNC(); + + return bResult; +} + + +//************************************************************************* +// InstallSWBreakpoint() +// +//************************************************************************* +BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpointCallback)(void)) +{ + PSW_BP p; + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + DPRINT((0,"InstallSWBreakpoint()\n")); + + // check if page is present + // TODO: must also check if it's a writable page + if(IsAddressValid(ulAddress) ) + { + DPRINT((0,"InstallSWBreakpoint(): %.8X is valid, writable? %d\n",ulAddress,IsAddressWriteable(ulAddress))); + DPRINT((0,"pde: %x, pte: %x\n", *(ADDR_TO_PDE(ulAddress)), *(ADDR_TO_PTE(ulAddress)))); + if((p = FindSwBp(ulAddress))==NULL) + { + DPRINT((0,"InstallSWBreakpoint(): %.8X is free\n",ulAddress)); + if( (p=FindEmptySwBpSlot()) ) + { + BOOLEAN isWriteable; + DPRINT((0,"InstallSWBreakpoint(): found empty slot\n")); + DPRINT((0,"InstallSWBreakpoint(): %x value: %x", ulAddress, *(PUCHAR)ulAddress)); + p->ucOriginalOpcode = *(PUCHAR)ulAddress; + //allow writing to page + if( !( isWriteable = IsAddressWriteable(ulAddress) ) ) + SetAddressWriteable(ulAddress,TRUE); + DPRINT((0,"writing breakpoint\n")); + *(PUCHAR)ulAddress = 0xCC; + DPRINT((0,"restoring page access\n")); + if( !isWriteable ) + SetAddressWriteable(ulAddress,FALSE); + p->bUsed = TRUE; + p->bInstalled = TRUE; + // find next address + p->ulAddress = ulAddress; + Disasm(&ulAddress,(PUCHAR)&tempBp); + p->ulNextInstr = ulAddress; + p->bPermanent = bPermanent; + if(bPermanent) + p->Callback = SWBreakpointCallback; + else + p->Callback = NULL; + bResult = TRUE; + } + } + else + { + DPRINT((0,"InstallSWBreakpoint(): %.8X is already used\n",ulAddress)); + if(p->bPermanent) + { + DPRINT((0,"InstallSWBreakpoint(): %.8X is a permanent breakpoint\n",ulAddress)); + } + } + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// InstallVirtualSWBreakpoint() +// +//************************************************************************* +BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName,LPSTR FunctionName) +{ + PSW_BP p; + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + DPRINT((0,"InstallVirtualSWBreakpoint(%s!%s)\n",ModName,FunctionName)); + + if( (p=FindEmptySwBpSlot()) ) + { + DPRINT((0,"InstallVirtualSWBreakpoint(): found empty slot\n")); + + p->bUsed = TRUE; + p->bInstalled = TRUE; + p->bVirtual = TRUE; + p->Callback = NULL; + PICE_strcpy(p->szModName,ModName); + PICE_strcpy(p->szFunctionName,FunctionName); + + bResult = TRUE; + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// TryToInstallVirtualSWBreakpoints() +// +//************************************************************************* +void TryToInstallVirtualSWBreakpoints(void) +{ + ULONG i,ulAddress; + PDEBUG_MODULE pMod; + PSW_BP p; + + DPRINT((0,"TryToInstallVirtualSWBreakpoints()\n")); + + for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++) + { + p = &aSwBreakpoints[i]; + if(p->bUsed == TRUE && p->bVirtual) + { + if((pMod = IsModuleLoaded(p->szModName))) + { + if((ulAddress = FindFunctionInModuleByName(p->szFunctionName,pMod))) + { + if((p = FindVirtualSwBp(p->szModName,p->szFunctionName))) + { + ULONG ulAddressWithOffset = ulAddress+p->ulAddress; + DPRINT((0,"TryToInstallVirtualSWBreakpoints(): ulAddressWithOffset = %x (offset = %x)\n",ulAddressWithOffset,p->ulAddress)); + + if(IsAddressValid(ulAddressWithOffset)) + { + BOOLEAN isWriteable; + DPRINT((0,"TryToInstallVirtualSWBreakpoints(): installing...\n")); + p->ucOriginalOpcode = *(PUCHAR)ulAddressWithOffset; + //allow writing to page + if( !( isWriteable = IsAddressWriteable(ulAddressWithOffset) ) ) + SetAddressWriteable(ulAddressWithOffset,TRUE); + *(PUCHAR)ulAddressWithOffset = 0xCC; + if( !isWriteable ) + SetAddressWriteable(ulAddressWithOffset,FALSE); + p->bUsed = TRUE; + p->bInstalled = TRUE; + p->bVirtual = FALSE; + // find next address + p->ulAddress = ulAddressWithOffset; + Disasm(&ulAddressWithOffset,(PUCHAR)&tempBp); + p->ulNextInstr = ulAddressWithOffset; + p->bPermanent = FALSE; + p->Callback = NULL; + } + else + { + DPRINT((0,"TryToInstallVirtualSWBreakpoints(): not valid address\n")); + PICE_memset(p,0,sizeof(*p)); + } + } + + } + } + } + } +} + +//************************************************************************* +// RemoveSWBreakpoint() +// +// removes breakpoint from breakpoint list +//************************************************************************* +BOOLEAN RemoveSWBreakpoint(ULONG ulAddress) +{ + PSW_BP p; + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + DPRINT((0,"RemoveSWBreakpoint()\n")); + + if( (p = FindSwBp(ulAddress)) ) + { + if(IsAddressValid(ulAddress) && p->bInstalled == TRUE && p->bVirtual==FALSE) + { + BOOLEAN isWriteable; + if( !( isWriteable = IsAddressWriteable(ulAddress) ) ) + SetAddressWriteable(ulAddress,TRUE); + // restore original opcode + *(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode; + if( !isWriteable ) + SetAddressWriteable(ulAddress,FALSE); + } + + PICE_memset(p,0,sizeof(*p)); + + bResult = TRUE; + } + + LEAVE_FUNC(); + + return bResult; +} + + +//************************************************************************* +// DeInstallSWBreakpoint() +// +//************************************************************************* +BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress) +{ + PSW_BP p; + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + DPRINT((0,"DeInstallSWBreakpoint()\n")); + + if( (p = FindSwBp(ulAddress)) ) + { + if(IsAddressValid(ulAddress) && p->bInstalled == TRUE && p->bVirtual==FALSE) + { + BOOLEAN isWriteable; + if( !( isWriteable = IsAddressWriteable(ulAddress) ) ) + SetAddressWriteable(ulAddress,TRUE); + // restore original opcode + *(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode; + if( !isWriteable ) + SetAddressWriteable(ulAddress,FALSE); + } + + p->bInstalled = FALSE; + + bResult = TRUE; + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// RemoveAllSWBreakpoints() +// +//************************************************************************* +BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents) +{ + PSW_BP p; + BOOLEAN bResult = FALSE; + ULONG i; + + ENTER_FUNC(); + DPRINT((0,"RemoveAllSWBreakpoint()\n")); + + for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++) + { + p = &aSwBreakpoints[i]; + if(p->bUsed == TRUE) + { + if(bEvenPermanents) + { + if(IsAddressValid(p->ulAddress) && p->bVirtual==FALSE) + { + BOOLEAN isWriteable; + if( !( isWriteable = IsAddressWriteable(p->ulAddress) ) ) + SetAddressWriteable(p->ulAddress,TRUE); + *(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode; + if( !isWriteable ) + SetAddressWriteable(p->ulAddress,FALSE); + bResult = TRUE; + } + PICE_memset(p,0,sizeof(*p)); + } + else + { + if(!p->bPermanent) + { + if(IsAddressValid(p->ulAddress) && p->bVirtual==FALSE) + { + BOOLEAN isWriteable; + if( !( isWriteable = IsAddressWriteable(p->ulAddress) ) ) + SetAddressWriteable(p->ulAddress,TRUE); + *(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode; + if( !isWriteable ) + SetAddressWriteable(p->ulAddress,FALSE); + bResult = TRUE; + } + PICE_memset(p,0,sizeof(*p)); + } + } + } + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// IsPermanentSWBreakpoint() +// +//************************************************************************* +PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress) +{ + PSW_BP p; + ULONG i; + + ENTER_FUNC(); + DPRINT((0,"IsPermanentSWBreakpoint(%.8X)\n",ulAddress)); + + for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(aSwBreakpoints[0]));i++) + { + p = &aSwBreakpoints[i]; + if(p->ulAddress == ulAddress && + p->bUsed == TRUE && + p->bPermanent == TRUE) + { + LEAVE_FUNC(); + return p; + } + } + + LEAVE_FUNC(); + + return NULL; +} + +//************************************************************************* +// ListSWBreakpoints() +// +//************************************************************************* +void ListSWBreakpoints(void) +{ + PSW_BP p; + ULONG i; + LPSTR pSymbolName; + PDEBUG_MODULE pMod; + + ENTER_FUNC(); + DPRINT((0,"ListSWBreakpoints()\n")); + + for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++) + { + p = &aSwBreakpoints[i]; + if(p->bUsed == TRUE && p->bVirtual == FALSE) + { + if((pSymbolName = FindFunctionByAddress(p->ulAddress,NULL,NULL)) ) + { + pMod = FindModuleFromAddress(p->ulAddress); + PICE_sprintf(tempBp,"[%u] %.8X (%S!%s) %s\n",i,p->ulAddress,pMod->name,pSymbolName,p->bPermanent?"PERMANENT":""); + } + else + { + if(ScanExportsByAddress(&pSymbolName,p->ulAddress)) + PICE_sprintf(tempBp,"[%u] %.8X (%s) %s\n",i,p->ulAddress,pSymbolName,p->bPermanent?"PERMANENT":""); + else + PICE_sprintf(tempBp,"[%u] %.8X (no symbol) %s\n",i,p->ulAddress,p->bPermanent?"PERMANENT":""); + } + Print(OUTPUT_WINDOW,tempBp); + } + else if(p->bUsed == TRUE) + { + PICE_sprintf(tempBp,"[%u] xxxxxxxx (%s!%s) VIRTUAL\n",i,p->szModName,p->szFunctionName); + Print(OUTPUT_WINDOW,tempBp); + } + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// RevirtualizeBreakpointsForModule() +// +//************************************************************************* +void RevirtualizeBreakpointsForModule(PDEBUG_MODULE pMod) +{ + ULONG i,start,end; + PSW_BP p; + char temp[DEBUG_MODULE_NAME_LEN]; + + DPRINT((0,"RevirtualizeBreakpointsForModule(%x)\n",(ULONG)pMod)); + + if(IsRangeValid((ULONG)pMod,sizeof(DEBUG_MODULE)) ) + { + start = (ULONG)pMod->BaseAddress; + end = (ULONG)pMod->BaseAddress+pMod->size; + + DPRINT((0,"RevirtualizeBreakpointsForModule(): module %x (%x-%x)\n",(ULONG)pMod,start,end)); + // go through all breakpoints + for(i=0;i<(sizeof(aSwBreakpoints)/sizeof(SW_BP));i++) + { + p = &aSwBreakpoints[i]; + // if it's used and installed and not virtual + if(p->bUsed && p->bInstalled && p->bVirtual == FALSE) + { + // make sure we're in module's bound + if(p->ulAddress>=start && p->ulAddressulAddress)) + { + // from now on it's virtual again + p->bVirtual = TRUE; + if(IsAddressValid(p->ulAddress) ) + { + BOOLEAN isWriteable; + if( !( isWriteable = IsAddressWriteable(p->ulAddress) ) ) + SetAddressWriteable(p->ulAddress,TRUE); + DPRINT((0,"RevirtualizeBreakpointsForModule(): restoring original opcode @ %x\n",p->ulAddress)); + *(PUCHAR)(p->ulAddress) = p->ucOriginalOpcode; + if( !isWriteable ) + SetAddressWriteable(p->ulAddress,FALSE); + } + else + { + DPRINT((0,"RevirtualizeBreakpointsForModule(): could not restore original opcode @ %x\n",p->ulAddress)); + } + // skip past the module separator + while(*pFind!='!')pFind++; + pFind++; + // remember the function and the module for reinstallation + CopyWideToAnsi(temp,pMod->name); + PICE_strcpy(p->szModName,temp); + PICE_strcpy(p->szFunctionName,pFind); + DPRINT((0,"RevirtualizeBreakpointsForModule(): %s!%s\n",p->szModName,p->szFunctionName)); + // if function name contains a '+' it's an offset + pFind = p->szFunctionName; + while(*pFind!=0) + { + DPRINT((0,"RevirtualizeBreakpointsForModule(): [1] %s\n",pFind)); + // found any offset to function + if(*pFind=='+') + { + *pFind=0; + break; + } + pFind++; + } + + DPRINT((0,"RevirtualizeBreakpointsForModule(): [2] %s\n",p->szFunctionName)); + if(ScanExports(p->szFunctionName,&ulFunctionAddress)) + { + p->ulAddress -= ulFunctionAddress; + DPRINT((0,"RevirtualizeBreakpointsForModule(): [1] function @ %x offset = %x\n",ulFunctionAddress,p->ulAddress)); + } + else + { + if((ulFunctionAddress = FindFunctionInModuleByName(p->szFunctionName,pMod)) ) + { + p->ulAddress -= ulFunctionAddress; + DPRINT((0,"RevirtualizeBreakpointsForModule(): [2] function @ %x offset = %x\n",ulFunctionAddress,p->ulAddress)); + } + else + { + DPRINT((0,"RevirtualizeBreakpointsForModule(): Breakpoint %u could not be virtualized properly!\n",i)); + PICE_sprintf(tempBp,"Breakpoint %u could not be virtualized properly!\n",i); + Print(OUTPUT_WINDOW,tempBp); + } + } + } + else + { + DPRINT((0,"RevirtualizeBreakpointsForModule(): function for %x not found!\n",p->ulAddress)); + PICE_memset(p,0,sizeof(*p)); + } + } + } + } + } +} + +//************************************************************************* +// NewInt3Handler() +// +//************************************************************************* +__asm__ ("\n\t \ +NewInt3Handler:\n\t \ + pushl $" STR(REASON_INT3) "\n\t \ + // call debugger loop\n\t \ + jmp NewInt31Handler\n\t \ +"); + + +//************************************************************************* +// InstallInt3Hook() +// +//************************************************************************* +void InstallInt3Hook(void) +{ + ULONG LocalInt3Handler; + + ENTER_FUNC(); + DPRINT((0,"enter InstallInt3Hook()...\n")); + + MaskIrqs(); + if(!OldInt3Handler) + { + PICE_memset(aSwBreakpoints,0,sizeof(aSwBreakpoints)); + __asm__("mov $NewInt3Handler,%0" + :"=r" (LocalInt3Handler) + : + :"eax"); + OldInt3Handler=SetGlobalInt(0x03,(ULONG)LocalInt3Handler); + } + UnmaskIrqs(); + + DPRINT((0,"leave InstallInt3Hook()...\n")); + LEAVE_FUNC(); +} + +//************************************************************************* +// DeInstallInt3Hook() +// +//************************************************************************* +void DeInstallInt3Hook(void) +{ + ENTER_FUNC(); + DPRINT((0,"enter DeInstallInt3Hook()...\n")); + + MaskIrqs(); + if(OldInt3Handler) + { + RemoveAllSWBreakpoints(TRUE); + SetGlobalInt(0x03,(ULONG)OldInt3Handler); + OldInt3Handler=0; + } + UnmaskIrqs(); + + DPRINT((0,"leave DeInstallInt3Hook()...\n")); + LEAVE_FUNC(); +} diff --git a/rosapps/sysutils/utils/pice/module/bp.h b/rosapps/sysutils/utils/pice/module/bp.h new file mode 100644 index 00000000000..29cf59d1926 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/bp.h @@ -0,0 +1,62 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + bp.h + +Abstract: + + HEADER for bp.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +typedef struct _SW_BP +{ + ULONG ulAddress; + ULONG ulNextInstr; + UCHAR ucOriginalOpcode; + BOOLEAN bUsed; + BOOLEAN bInstalled; + BOOLEAN bPermanent; + BOOLEAN bVirtual; + char szModName[128]; + char szFunctionName[128]; + void (*Callback)(void); +}SW_BP,*PSW_BP; + +BOOLEAN InstallSWBreakpoint(ULONG ulAddress,BOOLEAN bPermanent,void (*SWBreakpointCallback)(void)); +BOOLEAN InstallVirtualSWBreakpoint(LPSTR ModName,LPSTR Function); +void TryToInstallVirtualSWBreakpoints(void); +BOOLEAN DeInstallSWBreakpoint(ULONG ulAddress); +BOOLEAN RemoveSWBreakpoint(ULONG ulAddress); +BOOLEAN NeedToReInstallSWBreakpoints(ULONG ulAddress,BOOLEAN bUseAddress); +BOOLEAN ReInstallSWBreakpoint(ULONG ulAddress); +BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents); +PSW_BP IsPermanentSWBreakpoint(ULONG ulAddress); +void ListSWBreakpoints(void); +PSW_BP FindSwBp(ULONG ulAddress); +BOOLEAN IsSwBpAtAddress(ULONG ulAddress); +BOOLEAN IsSwBpAtAddressInstalled(ULONG ulAddress); +void RevirtualizeBreakpointsForModule(PDEBUG_MODULE pMod); + +void InstallInt3Hook(void); +void DeInstallInt3Hook(void); + diff --git a/rosapps/sysutils/utils/pice/module/charset.h b/rosapps/sysutils/utils/pice/module/charset.h new file mode 100644 index 00000000000..4b276a9f5e9 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/charset.h @@ -0,0 +1,2564 @@ +// this file is dynamically generated: DON'T TOUCH + +UCHAR cGraphTable[8*256]= +{ + /* 0 0x00 '^@' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 1 0x01 '^A' */ + 0x7e, /* 01111110 */ + 0x81, /* 10000001 */ + 0xa5, /* 10100101 */ + 0x81, /* 10000001 */ + 0xbd, /* 10111101 */ + 0x99, /* 10011001 */ + 0x81, /* 10000001 */ + 0x7e, /* 01111110 */ + + /* 2 0x02 '^B' */ + 0x7e, /* 01111110 */ + 0xff, /* 11111111 */ + 0xdb, /* 11011011 */ + 0xff, /* 11111111 */ + 0xc3, /* 11000011 */ + 0xe7, /* 11100111 */ + 0xff, /* 11111111 */ + 0x7e, /* 01111110 */ + + /* 3 0x03 '^C' */ + 0x6c, /* 01101100 */ + 0xfe, /* 11111110 */ + 0xfe, /* 11111110 */ + 0xfe, /* 11111110 */ + 0x7c, /* 01111100 */ + 0x38, /* 00111000 */ + 0x10, /* 00010000 */ + 0x00, /* 00000000 */ + + /* 4 0x04 '^D' */ + 0x10, /* 00010000 */ + 0x38, /* 00111000 */ + 0x7c, /* 01111100 */ + 0xfe, /* 11111110 */ + 0x7c, /* 01111100 */ + 0x38, /* 00111000 */ + 0x10, /* 00010000 */ + 0x00, /* 00000000 */ + + /* 5 0x05 '^E' */ + 0x38, /* 00111000 */ + 0x7c, /* 01111100 */ + 0x38, /* 00111000 */ + 0xfe, /* 11111110 */ + 0xfe, /* 11111110 */ + 0xd6, /* 11010110 */ + 0x10, /* 00010000 */ + 0x38, /* 00111000 */ + + /* 6 0x06 '^F' */ + 0x10, /* 00010000 */ + 0x38, /* 00111000 */ + 0x7c, /* 01111100 */ + 0xfe, /* 11111110 */ + 0xfe, /* 11111110 */ + 0x7c, /* 01111100 */ + 0x10, /* 00010000 */ + 0x38, /* 00111000 */ + + /* 7 0x07 '^G' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 8 0x08 '^H' */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xe7, /* 11100111 */ + 0xc3, /* 11000011 */ + 0xc3, /* 11000011 */ + 0xe7, /* 11100111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + + /* 9 0x09 '^I' */ + 0x00, /* 00000000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x42, /* 01000010 */ + 0x42, /* 01000010 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 10 0x0a '^J' */ + 0xff, /* 11111111 */ + 0xc3, /* 11000011 */ + 0x99, /* 10011001 */ + 0xbd, /* 10111101 */ + 0xbd, /* 10111101 */ + 0x99, /* 10011001 */ + 0xc3, /* 11000011 */ + 0xff, /* 11111111 */ + + /* 11 0x0b '^K' */ + 0x0f, /* 00001111 */ + 0x07, /* 00000111 */ + 0x0f, /* 00001111 */ + 0x7d, /* 01111101 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x78, /* 01111000 */ + + /* 12 0x0c '^L' */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + + /* 13 0x0d '^M' */ + 0x3f, /* 00111111 */ + 0x33, /* 00110011 */ + 0x3f, /* 00111111 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x70, /* 01110000 */ + 0xf0, /* 11110000 */ + 0xe0, /* 11100000 */ + + /* 14 0x0e '^N' */ + 0x7f, /* 01111111 */ + 0x63, /* 01100011 */ + 0x7f, /* 01111111 */ + 0x63, /* 01100011 */ + 0x63, /* 01100011 */ + 0x67, /* 01100111 */ + 0xe6, /* 11100110 */ + 0xc0, /* 11000000 */ + + /* 15 0x0f '^O' */ + 0x18, /* 00011000 */ + 0xdb, /* 11011011 */ + 0x3c, /* 00111100 */ + 0xe7, /* 11100111 */ + 0xe7, /* 11100111 */ + 0x3c, /* 00111100 */ + 0xdb, /* 11011011 */ + 0x18, /* 00011000 */ + + /* 16 0x10 '^P' */ + 0x80, /* 10000000 */ + 0xe0, /* 11100000 */ + 0xf8, /* 11111000 */ + 0xfe, /* 11111110 */ + 0xf8, /* 11111000 */ + 0xe0, /* 11100000 */ + 0x80, /* 10000000 */ + 0x00, /* 00000000 */ + + /* 17 0x11 '^Q' */ + 0x02, /* 00000010 */ + 0x0e, /* 00001110 */ + 0x3e, /* 00111110 */ + 0xfe, /* 11111110 */ + 0x3e, /* 00111110 */ + 0x0e, /* 00001110 */ + 0x02, /* 00000010 */ + 0x00, /* 00000000 */ + + /* 18 0x12 '^R' */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + + /* 19 0x13 '^S' */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + + /* 20 0x14 '^T' */ + 0x7f, /* 01111111 */ + 0xdb, /* 11011011 */ + 0xdb, /* 11011011 */ + 0x7b, /* 01111011 */ + 0x1b, /* 00011011 */ + 0x1b, /* 00011011 */ + 0x1b, /* 00011011 */ + 0x00, /* 00000000 */ + + /* 21 0x15 '^U' */ + 0x3e, /* 00111110 */ + 0x61, /* 01100001 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x86, /* 10000110 */ + 0x7c, /* 01111100 */ + + /* 22 0x16 '^V' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x7e, /* 01111110 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 23 0x17 '^W' */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0xff, /* 11111111 */ + + /* 24 0x18 '^X' */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 25 0x19 '^Y' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 26 0x1a '^Z' */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0xfe, /* 11111110 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 27 0x1b '^[' */ + 0x00, /* 00000000 */ + 0x30, /* 00110000 */ + 0x60, /* 01100000 */ + 0xfe, /* 11111110 */ + 0x60, /* 01100000 */ + 0x30, /* 00110000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 28 0x1c '^\' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 29 0x1d '^]' */ + 0x00, /* 00000000 */ + 0x24, /* 00100100 */ + 0x66, /* 01100110 */ + 0xff, /* 11111111 */ + 0x66, /* 01100110 */ + 0x24, /* 00100100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 30 0x1e '^^' */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x7e, /* 01111110 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 31 0x1f '^_' */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0x7e, /* 01111110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 32 0x20 ' ' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 33 0x21 '!' */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 34 0x22 '"' */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x24, /* 00100100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 35 0x23 '#' */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0xfe, /* 11111110 */ + 0x6c, /* 01101100 */ + 0xfe, /* 11111110 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x00, /* 00000000 */ + + /* 36 0x24 '$' */ + 0x18, /* 00011000 */ + 0x3e, /* 00111110 */ + 0x60, /* 01100000 */ + 0x3c, /* 00111100 */ + 0x06, /* 00000110 */ + 0x7c, /* 01111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 37 0x25 '%' */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xcc, /* 11001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x66, /* 01100110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 38 0x26 '&' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 39 0x27 ''' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 40 0x28 '(' */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x00, /* 00000000 */ + + /* 41 0x29 ')' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x00, /* 00000000 */ + + /* 42 0x2a '*' */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0xff, /* 11111111 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 43 0x2b '+' */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 44 0x2c ',' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + + /* 45 0x2d '-' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 46 0x2e '.' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 47 0x2f '/' */ + 0x06, /* 00000110 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x60, /* 01100000 */ + 0xc0, /* 11000000 */ + 0x80, /* 10000000 */ + 0x00, /* 00000000 */ + + /* 48 0x30 '0' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xd6, /* 11010110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + + /* 49 0x31 '1' */ + 0x18, /* 00011000 */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 50 0x32 '2' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0x06, /* 00000110 */ + 0x1c, /* 00011100 */ + 0x30, /* 00110000 */ + 0x66, /* 01100110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 51 0x33 '3' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0x06, /* 00000110 */ + 0x3c, /* 00111100 */ + 0x06, /* 00000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 52 0x34 '4' */ + 0x1c, /* 00011100 */ + 0x3c, /* 00111100 */ + 0x6c, /* 01101100 */ + 0xcc, /* 11001100 */ + 0xfe, /* 11111110 */ + 0x0c, /* 00001100 */ + 0x1e, /* 00011110 */ + 0x00, /* 00000000 */ + + /* 53 0x35 '5' */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xfc, /* 11111100 */ + 0x06, /* 00000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 54 0x36 '6' */ + 0x38, /* 00111000 */ + 0x60, /* 01100000 */ + 0xc0, /* 11000000 */ + 0xfc, /* 11111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 55 0x37 '7' */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x00, /* 00000000 */ + + /* 56 0x38 '8' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 57 0x39 '9' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7e, /* 01111110 */ + 0x06, /* 00000110 */ + 0x0c, /* 00001100 */ + 0x78, /* 01111000 */ + 0x00, /* 00000000 */ + + /* 58 0x3a ':' */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 59 0x3b ';' */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + + /* 60 0x3c '<' */ + 0x06, /* 00000110 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x06, /* 00000110 */ + 0x00, /* 00000000 */ + + /* 61 0x3d '=' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 62 0x3e '>' */ + 0x60, /* 01100000 */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x60, /* 01100000 */ + 0x00, /* 00000000 */ + + /* 63 0x3f '?' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 64 0x40 '@' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xde, /* 11011110 */ + 0xde, /* 11011110 */ + 0xde, /* 11011110 */ + 0xc0, /* 11000000 */ + 0x78, /* 01111000 */ + 0x00, /* 00000000 */ + + /* 65 0x41 'A' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 66 0x42 'B' */ + 0xfc, /* 11111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x7c, /* 01111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0xfc, /* 11111100 */ + 0x00, /* 00000000 */ + + /* 67 0x43 'C' */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 68 0x44 'D' */ + 0xf8, /* 11111000 */ + 0x6c, /* 01101100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x6c, /* 01101100 */ + 0xf8, /* 11111000 */ + 0x00, /* 00000000 */ + + /* 69 0x45 'E' */ + 0xfe, /* 11111110 */ + 0x62, /* 01100010 */ + 0x68, /* 01101000 */ + 0x78, /* 01111000 */ + 0x68, /* 01101000 */ + 0x62, /* 01100010 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 70 0x46 'F' */ + 0xfe, /* 11111110 */ + 0x62, /* 01100010 */ + 0x68, /* 01101000 */ + 0x78, /* 01111000 */ + 0x68, /* 01101000 */ + 0x60, /* 01100000 */ + 0xf0, /* 11110000 */ + 0x00, /* 00000000 */ + + /* 71 0x47 'G' */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xce, /* 11001110 */ + 0x66, /* 01100110 */ + 0x3a, /* 00111010 */ + 0x00, /* 00000000 */ + + /* 72 0x48 'H' */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 73 0x49 'I' */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 74 0x4a 'J' */ + 0x1e, /* 00011110 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x78, /* 01111000 */ + 0x00, /* 00000000 */ + + /* 75 0x4b 'K' */ + 0xe6, /* 11100110 */ + 0x66, /* 01100110 */ + 0x6c, /* 01101100 */ + 0x78, /* 01111000 */ + 0x6c, /* 01101100 */ + 0x66, /* 01100110 */ + 0xe6, /* 11100110 */ + 0x00, /* 00000000 */ + + /* 76 0x4c 'L' */ + 0xf0, /* 11110000 */ + 0x60, /* 01100000 */ + 0x60, /* 01100000 */ + 0x60, /* 01100000 */ + 0x62, /* 01100010 */ + 0x66, /* 01100110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 77 0x4d 'M' */ + 0xc6, /* 11000110 */ + 0xee, /* 11101110 */ + 0xfe, /* 11111110 */ + 0xfe, /* 11111110 */ + 0xd6, /* 11010110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 78 0x4e 'N' */ + 0xc6, /* 11000110 */ + 0xe6, /* 11100110 */ + 0xf6, /* 11110110 */ + 0xde, /* 11011110 */ + 0xce, /* 11001110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 79 0x4f 'O' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 80 0x50 'P' */ + 0xfc, /* 11111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x7c, /* 01111100 */ + 0x60, /* 01100000 */ + 0x60, /* 01100000 */ + 0xf0, /* 11110000 */ + 0x00, /* 00000000 */ + + /* 81 0x51 'Q' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xce, /* 11001110 */ + 0x7c, /* 01111100 */ + 0x0e, /* 00001110 */ + + /* 82 0x52 'R' */ + 0xfc, /* 11111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x7c, /* 01111100 */ + 0x6c, /* 01101100 */ + 0x66, /* 01100110 */ + 0xe6, /* 11100110 */ + 0x00, /* 00000000 */ + + /* 83 0x53 'S' */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 84 0x54 'T' */ + 0x7e, /* 01111110 */ + 0x7e, /* 01111110 */ + 0x5a, /* 01011010 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 85 0x55 'U' */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 86 0x56 'V' */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + + /* 87 0x57 'W' */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xd6, /* 11010110 */ + 0xd6, /* 11010110 */ + 0xfe, /* 11111110 */ + 0x6c, /* 01101100 */ + 0x00, /* 00000000 */ + + /* 88 0x58 'X' */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 89 0x59 'Y' */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 90 0x5a 'Z' */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0x8c, /* 10001100 */ + 0x18, /* 00011000 */ + 0x32, /* 00110010 */ + 0x66, /* 01100110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 91 0x5b '[' */ + 0x3c, /* 00111100 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 92 0x5c '\' */ + 0xc0, /* 11000000 */ + 0x60, /* 01100000 */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x06, /* 00000110 */ + 0x02, /* 00000010 */ + 0x00, /* 00000000 */ + + /* 93 0x5d ']' */ + 0x3c, /* 00111100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 94 0x5e '^' */ + 0x10, /* 00010000 */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 95 0x5f '_' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + + /* 96 0x60 '`' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 97 0x61 'a' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 98 0x62 'b' */ + 0xe0, /* 11100000 */ + 0x60, /* 01100000 */ + 0x7c, /* 01111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0xdc, /* 11011100 */ + 0x00, /* 00000000 */ + + /* 99 0x63 'c' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc0, /* 11000000 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 100 0x64 'd' */ + 0x1c, /* 00011100 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 101 0x65 'e' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 102 0x66 'f' */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x60, /* 01100000 */ + 0xf8, /* 11111000 */ + 0x60, /* 01100000 */ + 0x60, /* 01100000 */ + 0xf0, /* 11110000 */ + 0x00, /* 00000000 */ + + /* 103 0x67 'g' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x76, /* 01110110 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x7c, /* 01111100 */ + 0x0c, /* 00001100 */ + 0xf8, /* 11111000 */ + + /* 104 0x68 'h' */ + 0xe0, /* 11100000 */ + 0x60, /* 01100000 */ + 0x6c, /* 01101100 */ + 0x76, /* 01110110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0xe6, /* 11100110 */ + 0x00, /* 00000000 */ + + /* 105 0x69 'i' */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 106 0x6a 'j' */ + 0x06, /* 00000110 */ + 0x00, /* 00000000 */ + 0x06, /* 00000110 */ + 0x06, /* 00000110 */ + 0x06, /* 00000110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + + /* 107 0x6b 'k' */ + 0xe0, /* 11100000 */ + 0x60, /* 01100000 */ + 0x66, /* 01100110 */ + 0x6c, /* 01101100 */ + 0x78, /* 01111000 */ + 0x6c, /* 01101100 */ + 0xe6, /* 11100110 */ + 0x00, /* 00000000 */ + + /* 108 0x6c 'l' */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 109 0x6d 'm' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xec, /* 11101100 */ + 0xfe, /* 11111110 */ + 0xd6, /* 11010110 */ + 0xd6, /* 11010110 */ + 0xd6, /* 11010110 */ + 0x00, /* 00000000 */ + + /* 110 0x6e 'n' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xdc, /* 11011100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + + /* 111 0x6f 'o' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 112 0x70 'p' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xdc, /* 11011100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x7c, /* 01111100 */ + 0x60, /* 01100000 */ + 0xf0, /* 11110000 */ + + /* 113 0x71 'q' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x76, /* 01110110 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x7c, /* 01111100 */ + 0x0c, /* 00001100 */ + 0x1e, /* 00011110 */ + + /* 114 0x72 'r' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xdc, /* 11011100 */ + 0x76, /* 01110110 */ + 0x60, /* 01100000 */ + 0x60, /* 01100000 */ + 0xf0, /* 11110000 */ + 0x00, /* 00000000 */ + + /* 115 0x73 's' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0xc0, /* 11000000 */ + 0x7c, /* 01111100 */ + 0x06, /* 00000110 */ + 0xfc, /* 11111100 */ + 0x00, /* 00000000 */ + + /* 116 0x74 't' */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0xfc, /* 11111100 */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x36, /* 00110110 */ + 0x1c, /* 00011100 */ + 0x00, /* 00000000 */ + + /* 117 0x75 'u' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 118 0x76 'v' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + + /* 119 0x77 'w' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xd6, /* 11010110 */ + 0xd6, /* 11010110 */ + 0xfe, /* 11111110 */ + 0x6c, /* 01101100 */ + 0x00, /* 00000000 */ + + /* 120 0x78 'x' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 121 0x79 'y' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7e, /* 01111110 */ + 0x06, /* 00000110 */ + 0xfc, /* 11111100 */ + + /* 122 0x7a 'z' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x4c, /* 01001100 */ + 0x18, /* 00011000 */ + 0x32, /* 00110010 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 123 0x7b '{' */ + 0x0e, /* 00001110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x70, /* 01110000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x0e, /* 00001110 */ + 0x00, /* 00000000 */ + + /* 124 0x7c '|' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 125 0x7d '}' */ + 0x70, /* 01110000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x0e, /* 00001110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x70, /* 01110000 */ + 0x00, /* 00000000 */ + + /* 126 0x7e '~' */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 127 0x7f '' */ + 0x00, /* 00000000 */ + 0x10, /* 00010000 */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 128 0x80 '' */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x0c, /* 00001100 */ + 0x78, /* 01111000 */ + + /* 129 0x81 '' */ + 0xcc, /* 11001100 */ + 0x00, /* 00000000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 130 0x82 '' */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 131 0x83 '' */ + 0x7c, /* 01111100 */ + 0x82, /* 10000010 */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 132 0x84 '' */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 133 0x85 '' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 134 0x86 '' */ + 0x30, /* 00110000 */ + 0x30, /* 00110000 */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 135 0x87 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0x7e, /* 01111110 */ + 0x0c, /* 00001100 */ + 0x38, /* 00111000 */ + + /* 136 0x88 '' */ + 0x7c, /* 01111100 */ + 0x82, /* 10000010 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 137 0x89 '' */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 138 0x8a '' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 139 0x8b '' */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 140 0x8c '' */ + 0x7c, /* 01111100 */ + 0x82, /* 10000010 */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 141 0x8d '' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 142 0x8e '' */ + 0xc6, /* 11000110 */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 143 0x8f '' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 144 0x90 '' */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0xf8, /* 11111000 */ + 0xc0, /* 11000000 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 145 0x91 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0xd8, /* 11011000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 146 0x92 '' */ + 0x3e, /* 00111110 */ + 0x6c, /* 01101100 */ + 0xcc, /* 11001100 */ + 0xfe, /* 11111110 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xce, /* 11001110 */ + 0x00, /* 00000000 */ + + /* 147 0x93 '' */ + 0x7c, /* 01111100 */ + 0x82, /* 10000010 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 148 0x94 '' */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 149 0x95 '' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 150 0x96 '' */ + 0x78, /* 01111000 */ + 0x84, /* 10000100 */ + 0x00, /* 00000000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 151 0x97 '' */ + 0x60, /* 01100000 */ + 0x30, /* 00110000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 152 0x98 '' */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7e, /* 01111110 */ + 0x06, /* 00000110 */ + 0xfc, /* 11111100 */ + + /* 153 0x99 '' */ + 0xc6, /* 11000110 */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + + /* 154 0x9a '' */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 155 0x9b '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 156 0x9c '' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0x64, /* 01100100 */ + 0xf0, /* 11110000 */ + 0x60, /* 01100000 */ + 0x66, /* 01100110 */ + 0xfc, /* 11111100 */ + 0x00, /* 00000000 */ + + /* 157 0x9d '' */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 158 0x9e '' */ + 0xf8, /* 11111000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xfa, /* 11111010 */ + 0xc6, /* 11000110 */ + 0xcf, /* 11001111 */ + 0xc6, /* 11000110 */ + 0xc7, /* 11000111 */ + + /* 159 0x9f '' */ + 0x0e, /* 00001110 */ + 0x1b, /* 00011011 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0xd8, /* 11011000 */ + 0x70, /* 01110000 */ + 0x00, /* 00000000 */ + + /* 160 0xa0 '' */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x7c, /* 01111100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 161 0xa1 '' */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x38, /* 00111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 162 0xa2 '' */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + + /* 163 0xa3 '' */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 164 0xa4 '' */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0x00, /* 00000000 */ + 0xdc, /* 11011100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + + /* 165 0xa5 '' */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0x00, /* 00000000 */ + 0xe6, /* 11100110 */ + 0xf6, /* 11110110 */ + 0xde, /* 11011110 */ + 0xce, /* 11001110 */ + 0x00, /* 00000000 */ + + /* 166 0xa6 '' */ + 0x3c, /* 00111100 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x3e, /* 00111110 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 167 0xa7 '' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 168 0xa8 '' */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x63, /* 01100011 */ + 0x3e, /* 00111110 */ + 0x00, /* 00000000 */ + + /* 169 0xa9 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 170 0xaa '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x06, /* 00000110 */ + 0x06, /* 00000110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 171 0xab '' */ + 0x63, /* 01100011 */ + 0xe6, /* 11100110 */ + 0x6c, /* 01101100 */ + 0x7e, /* 01111110 */ + 0x33, /* 00110011 */ + 0x66, /* 01100110 */ + 0xcc, /* 11001100 */ + 0x0f, /* 00001111 */ + + /* 172 0xac '' */ + 0x63, /* 01100011 */ + 0xe6, /* 11100110 */ + 0x6c, /* 01101100 */ + 0x7a, /* 01111010 */ + 0x36, /* 00110110 */ + 0x6a, /* 01101010 */ + 0xdf, /* 11011111 */ + 0x06, /* 00000110 */ + + /* 173 0xad '' */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 174 0xae '' */ + 0x00, /* 00000000 */ + 0x33, /* 00110011 */ + 0x66, /* 01100110 */ + 0xcc, /* 11001100 */ + 0x66, /* 01100110 */ + 0x33, /* 00110011 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 175 0xaf '' */ + 0x00, /* 00000000 */ + 0xcc, /* 11001100 */ + 0x66, /* 01100110 */ + 0x33, /* 00110011 */ + 0x66, /* 01100110 */ + 0xcc, /* 11001100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 176 0xb0 '' */ + 0x22, /* 00100010 */ + 0x88, /* 10001000 */ + 0x22, /* 00100010 */ + 0x88, /* 10001000 */ + 0x22, /* 00100010 */ + 0x88, /* 10001000 */ + 0x22, /* 00100010 */ + 0x88, /* 10001000 */ + + /* 177 0xb1 '' */ + 0x55, /* 01010101 */ + 0xaa, /* 10101010 */ + 0x55, /* 01010101 */ + 0xaa, /* 10101010 */ + 0x55, /* 01010101 */ + 0xaa, /* 10101010 */ + 0x55, /* 01010101 */ + 0xaa, /* 10101010 */ + + /* 178 0xb2 '' */ + 0x77, /* 01110111 */ + 0xdd, /* 11011101 */ + 0x77, /* 01110111 */ + 0xdd, /* 11011101 */ + 0x77, /* 01110111 */ + 0xdd, /* 11011101 */ + 0x77, /* 01110111 */ + 0xdd, /* 11011101 */ + + /* 179 0xb3 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 180 0xb4 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 181 0xb5 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 182 0xb6 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xf6, /* 11110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 183 0xb7 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 184 0xb8 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 185 0xb9 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xf6, /* 11110110 */ + 0x06, /* 00000110 */ + 0xf6, /* 11110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 186 0xba '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 187 0xbb '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x06, /* 00000110 */ + 0xf6, /* 11110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 188 0xbc '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xf6, /* 11110110 */ + 0x06, /* 00000110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 189 0xbd '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 190 0xbe '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 191 0xbf '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xf8, /* 11111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 192 0xc0 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 193 0xc1 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 194 0xc2 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 195 0xc3 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 196 0xc4 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 197 0xc5 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xff, /* 11111111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 198 0xc6 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 199 0xc7 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x37, /* 00110111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 200 0xc8 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x37, /* 00110111 */ + 0x30, /* 00110000 */ + 0x3f, /* 00111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 201 0xc9 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 00111111 */ + 0x30, /* 00110000 */ + 0x37, /* 00110111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 202 0xca '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xf7, /* 11110111 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 203 0xcb '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0xf7, /* 11110111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 204 0xcc '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x37, /* 00110111 */ + 0x30, /* 00110000 */ + 0x37, /* 00110111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 205 0xcd '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 206 0xce '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xf7, /* 11110111 */ + 0x00, /* 00000000 */ + 0xf7, /* 11110111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 207 0xcf '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 208 0xd0 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 209 0xd1 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 210 0xd2 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 211 0xd3 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x3f, /* 00111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 212 0xd4 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 213 0xd5 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 214 0xd6 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 00111111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 215 0xd7 '' */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0xff, /* 11111111 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + + /* 216 0xd8 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xff, /* 11111111 */ + 0x18, /* 00011000 */ + 0xff, /* 11111111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 217 0xd9 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xf8, /* 11111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 218 0xda '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1f, /* 00011111 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 219 0xdb '' */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + + /* 220 0xdc '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + + /* 221 0xdd '' */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + 0xf0, /* 11110000 */ + + /* 222 0xde '' */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + 0x0f, /* 00001111 */ + + /* 223 0xdf '' */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0xff, /* 11111111 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 224 0xe0 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0xc8, /* 11001000 */ + 0xdc, /* 11011100 */ + 0x76, /* 01110110 */ + 0x00, /* 00000000 */ + + /* 225 0xe1 '' */ + 0x78, /* 01111000 */ + 0xcc, /* 11001100 */ + 0xcc, /* 11001100 */ + 0xd8, /* 11011000 */ + 0xcc, /* 11001100 */ + 0xc6, /* 11000110 */ + 0xcc, /* 11001100 */ + 0x00, /* 00000000 */ + + /* 226 0xe2 '' */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0xc0, /* 11000000 */ + 0x00, /* 00000000 */ + + /* 227 0xe3 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x00, /* 00000000 */ + + /* 228 0xe4 '' */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0x60, /* 01100000 */ + 0x30, /* 00110000 */ + 0x60, /* 01100000 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + + /* 229 0xe5 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0xd8, /* 11011000 */ + 0xd8, /* 11011000 */ + 0xd8, /* 11011000 */ + 0x70, /* 01110000 */ + 0x00, /* 00000000 */ + + /* 230 0xe6 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x7c, /* 01111100 */ + 0xc0, /* 11000000 */ + + /* 231 0xe7 '' */ + 0x00, /* 00000000 */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* 232 0xe8 '' */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + + /* 233 0xe9 '' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xfe, /* 11111110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + + /* 234 0xea '' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0xee, /* 11101110 */ + 0x00, /* 00000000 */ + + /* 235 0xeb '' */ + 0x0e, /* 00001110 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x3e, /* 00111110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* 236 0xec '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0xdb, /* 11011011 */ + 0xdb, /* 11011011 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 237 0xed '' */ + 0x06, /* 00000110 */ + 0x0c, /* 00001100 */ + 0x7e, /* 01111110 */ + 0xdb, /* 11011011 */ + 0xdb, /* 11011011 */ + 0x7e, /* 01111110 */ + 0x60, /* 01100000 */ + 0xc0, /* 11000000 */ + + /* 238 0xee '' */ + 0x1e, /* 00011110 */ + 0x30, /* 00110000 */ + 0x60, /* 01100000 */ + 0x7e, /* 01111110 */ + 0x60, /* 01100000 */ + 0x30, /* 00110000 */ + 0x1e, /* 00011110 */ + 0x00, /* 00000000 */ + + /* 239 0xef '' */ + 0x00, /* 00000000 */ + 0x7c, /* 01111100 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + + /* 240 0xf0 '' */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + 0xfe, /* 11111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 241 0xf1 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 242 0xf2 '' */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 243 0xf3 '' */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00001100 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* 244 0xf4 '' */ + 0x0e, /* 00001110 */ + 0x1b, /* 00011011 */ + 0x1b, /* 00011011 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* 245 0xf5 '' */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0xd8, /* 11011000 */ + 0xd8, /* 11011000 */ + 0x70, /* 01110000 */ + + /* 246 0xf6 '' */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 247 0xf7 '' */ + 0x00, /* 00000000 */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0x00, /* 00000000 */ + 0x76, /* 01110110 */ + 0xdc, /* 11011100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 248 0xf8 '' */ + 0x38, /* 00111000 */ + 0x6c, /* 01101100 */ + 0x6c, /* 01101100 */ + 0x38, /* 00111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 249 0xf9 '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 250 0xfa '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 251 0xfb '' */ + 0x0f, /* 00001111 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0x0c, /* 00001100 */ + 0xec, /* 11101100 */ + 0x6c, /* 01101100 */ + 0x3c, /* 00111100 */ + 0x1c, /* 00011100 */ + + /* 252 0xfc '' */ + 0x6c, /* 01101100 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x36, /* 00110110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 253 0xfd '' */ + 0x78, /* 01111000 */ + 0x0c, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00110000 */ + 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 254 0xfe '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* 255 0xff '' */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ +}; diff --git a/rosapps/sysutils/utils/pice/module/dblflt.c b/rosapps/sysutils/utils/pice/module/dblflt.c new file mode 100644 index 00000000000..1535c6bcf38 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/dblflt.c @@ -0,0 +1,133 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + dblflt.c + +Abstract: + + handle double faults on x86 + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 13-Nov-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//////////////////////////////////////////////////// +// GLOBALS +//// +ULONG OldDblFltHandler = 0; + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// HandleDoubleFault() +// +//************************************************************************* +void HandleDoubleFault(FRAME* ptr) +{ + DPRINT((0,"HandleDoubleFault(): ptr = %x\n",ptr)); +} + + +//************************************************************************* +// NewDblFltHandler() +// +//************************************************************************* +__asm__ (" \ +NewDblFltHandler:\n\t \ + pushfl\n\t \ + cli;\n\t \ + cld;\n\t \ + pushal;\n\t \ + pushl %ds;\n\t \ +\n\t \ + // setup default data selectors\n\t \ + movw %ss,%ax\n\t \ + movw %ax,%ds\n\t \ +\n\t \ + // get frame ptr\n\t \ + lea 40(%esp),%eax\n\t \ + pushl %eax\n\t \ + call _HandleDoubleFault\n\t \ + addl $4,%esp\n\t \ +\n\t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ + // remove error code from stack and replace with reason code\n\t \ + movl $" STR(REASON_DOUBLE_FAULT) ",(%esp)\n\t \ + // call debugger loop\n\t \ + jmp NewInt31Handler\n\t"); + + +//************************************************************************* +// InstallDblFltHook() +// +//************************************************************************* +void InstallDblFltHook(void) +{ + ULONG LocalDblFltHandler; + + ENTER_FUNC(); + + MaskIrqs(); + if(!OldDblFltHandler) + { + __asm__("mov $NewDblFltHandler,%0" + :"=r" (LocalDblFltHandler) + : + :"eax"); + OldDblFltHandler=SetGlobalInt(0x08,(ULONG)LocalDblFltHandler); + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} + +//************************************************************************* +// DeInstallDblFltHook() +// +//************************************************************************* +void DeInstallDblFltHook(void) +{ + ENTER_FUNC(); + + MaskIrqs(); + if(OldDblFltHandler) + { + RemoveAllSWBreakpoints(TRUE); + SetGlobalInt(0x08,(ULONG)OldDblFltHandler); + OldDblFltHandler=0; + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} + +// EOF diff --git a/rosapps/sysutils/utils/pice/module/dblflt.h b/rosapps/sysutils/utils/pice/module/dblflt.h new file mode 100644 index 00000000000..c2f8add1e6c --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/dblflt.h @@ -0,0 +1,32 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + dblflt.h + +Abstract: + + HEADER for dblflt.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void InstallDblFltHook(void); +void DeInstallDblFltHook(void); diff --git a/rosapps/sysutils/utils/pice/module/debug.c b/rosapps/sysutils/utils/pice/module/debug.c new file mode 100644 index 00000000000..44529afd064 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/debug.c @@ -0,0 +1,192 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + debug.c + +Abstract: + + debug output + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 04-Feb-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#ifdef DEBUG +#include "remods.h" + +#include "precomp.h" +#include +#include "serial.h" +#include "serial_port.h" + +#define STANDARD_DEBUG_PREFIX "pICE: " + +//////////////////////////////////////////////////// +// GLOBALS +//// +LONG lDebugLevel = 10; +ULONG ulDebugFlags; +char tempDebug[2048]; +USHORT usDebugPortBase; + +extern BOOLEAN bIsPrintkPatched; +//////////////////////////////////////////////////// +// FUNCTIONS +//// +void DebugSendString(LPSTR s); + + +//************************************************************************* +// Pice_dprintf() +// +// internal debug print +//************************************************************************* +VOID Pice_dprintf(ULONG DebugLevel, PCHAR DebugMessage, ...) +{ + va_list ap; + + va_start(ap, DebugMessage); + if (/*DebugLevel <= lDebugLevel*/ DebugLevel == 2) + { + save_flags(ulDebugFlags); + cli(); + PICE_vsprintf(tempDebug, DebugMessage, ap); + //ei DebugSendString(tempDebug); + Print(OUTPUT_WINDOW, tempDebug); + //DbgPrint("%s", tempDebug); + restore_flags(ulDebugFlags); + } + va_end(ap); +} + +//************************************************************************ +// SendByte() +// +// Output a character to the serial port +//************************************************************************ +BOOLEAN DebugSendByte(UCHAR x) +{ + ULONG timeout; + + timeout = 0x00FFFFL; + + // Wait for transmitter to clear + while ((inportb((USHORT)(usDebugPortBase + LSR)) & XMTRDY) == 0) + if (!(--timeout)) + { + return FALSE; + } + + outportb((USHORT)(usDebugPortBase + TXR), x); + + return TRUE; +} + +///************************************************************************ +// DebugSetSpeed() +// +///************************************************************************ +void DebugSendString(LPSTR s) +{ + ULONG len = PICE_strlen(s),i; + + for(i=0;i> 8) & 0x00FF)); + outportb((USHORT)(usDebugPortBase + LCR), c); // Reset DLAB + +} + +///************************************************************************ +// DebugSetOthers() +// +// Set other communications parameters +//************************************************************************ +void DebugSetOthers(ULONG Parity, ULONG Bits, ULONG StopBit) +{ + ULONG setting; + UCHAR c; + + if (usDebugPortBase == 0) return ; + if (Bits < 5 || Bits > 8) return ; + if (StopBit != 1 && StopBit != 2) return ; + if (Parity != NO_PARITY && Parity != ODD_PARITY && Parity != EVEN_PARITY) + return; + + setting = Bits-5; + setting |= ((StopBit == 1) ? 0x00 : 0x04); + setting |= Parity; + + c = inportb((USHORT)(usDebugPortBase + LCR)); + outportb((USHORT)(usDebugPortBase + LCR), (UCHAR)(c & ~0x80)); // Reset DLAB + + // no ints + outportb((USHORT)(usDebugPortBase + IER), (UCHAR)0); + + outportb((USHORT)(usDebugPortBase + FCR), (UCHAR)0); + + outportb((USHORT)(usDebugPortBase + LCR), (UCHAR)setting); + + outportb((USHORT)(usDebugPortBase + MCR), DTR | RTS); + + + return ; +} + +///************************************************************************ +// DebugSetupSerial() +// +///************************************************************************ +void DebugSetupSerial(ULONG port,ULONG baudrate) +{ + USHORT ports[]={COM1BASE,COM2BASE}; +#if 0 //ei temporary + usDebugPortBase = ports[port-1]; + DebugSetOthers(NO_PARITY,8,1); + DebugSetSpeed(baudrate); +#endif +} +#endif // DEBUG + +// EOF diff --git a/rosapps/sysutils/utils/pice/module/debug.h b/rosapps/sysutils/utils/pice/module/debug.h new file mode 100644 index 00000000000..ab4d27e0119 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/debug.h @@ -0,0 +1,47 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + debug.h + +Abstract: + + HEADER for debug.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#ifdef DEBUG + +#define ENTER_FUNC() DPRINT((0,"enter "__FUNCTION__"()\n")) + +#define LEAVE_FUNC() DPRINT((0,"leave "__FUNCTION__"()\n")) + +VOID Pice_dprintf(ULONG DebugLevel, PCHAR DebugMessage, ...); +#define DPRINT(arg) Pice_dprintf arg + +#else // DEBUG + +#define ENTER_FUNC() +#define LEAVE_FUNC() + +#define DPRINT(arg) + +#endif // DEBUG diff --git a/rosapps/sysutils/utils/pice/module/disassembler.c b/rosapps/sysutils/utils/pice/module/disassembler.c new file mode 100644 index 00000000000..ea257143418 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/disassembler.c @@ -0,0 +1,716 @@ +/*++ + +Copyright (c) 2000-2001 Goran Devic +Modified (c) 2001 Klaus P. Gerlicher + +Module Name: + + disassembler.c + +Abstract: + + line disassembler + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Goran Devic + +Revision History: + + 17-Mar-2000: Original (Goran Devic) + 26-Apr-2000: Major rewrite, added coprocessor instructions (Goran Devic) + 04-Nov-2000: Modified for LinIce (Goran Devic) + 05-Jan-2001: Modified for pICE (Klaus P. Gerlicher) + + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +/******************************************************************************* +* Include Files * +******************************************************************************/ +#include "remods.h" +#include "precomp.h" + +#include "disassemblerdata.h" // Include its own data + +/****************************************************************************** +* +* This structure is used to pass parameters and options to the +* line disassembler. +* +******************************************************************************/ +typedef struct +{ + ULONG dwFlags; // Generic flags (described below) + USHORT wSel; // Selector to use to fetch code + UCHAR *bpTarget; // Target pointer to disassemble + UCHAR *szDisasm; // String where to put ascii result + UCHAR Codes[20]; // Buffer where to store code UCHARs + + UCHAR bAsciiLen; // Length of the ascii result + UCHAR bInstrLen; // Instruction lenght in UCHARs + + int nDisplacement; // Scanner: possible constant displacement + int nScanEnum; // Scanner: specific flags SCAN_* + +} TDisassembler; + +// dwFlags contains a set of boolean flags with the following functionality + +#define DIS_DATA32 0x0001 // Data size 16/32 bits (0/1) +#define DIS_GETDATASIZE(flags) ((flags)&DIS_DATA32) +#define DIS_ADDRESS32 0x0002 // Address size 16/32 bits (0/1) +#define DIS_GETADDRSIZE(flags) (((flags)&DIS_ADDRESS32)?1:0) + +#define DIS_SEGOVERRIDE 0x0004 // Default segment has been overriden + +#define DIS_REP 0x0100 // Return: REP prefix found (followed by..) +#define DIS_REPNE 0x0200 // Return: REPNE prefix found +#define DIS_GETREPENUM(flags) (((flags)>>8)&3) +#define DIS_ILLEGALOP 0x8000 // Return: illegal opcode + + +/****************************************************************************** +* * +* Global Variables * +* * +******************************************************************************/ + + +/****************************************************************************** +* * +* External functions (optional) * +* * +******************************************************************************/ + +/****************************************************************************** +* * +* Local Defines, Variables and Macros * +* * +******************************************************************************/ +UCHAR GetUCHAR(ULONG addr) +{ + if(IsAddressValid(addr)) + return *(PUCHAR)addr; + else + return 0x82; // INVALID OPCODE +} + +static UCHAR GetNextUCHAR(USHORT sel, UCHAR *offset, UCHAR *pCode) +{ + pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF; + + return( pCode[0] ); +} + +static USHORT GetNextUSHORT(USHORT sel, UCHAR *offset, UCHAR *pCode) +{ + pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF; + pCode[1] = GetUCHAR((ULONG) offset + 1) & 0xFF; + + return( *(USHORT *) pCode ); +} + +static ULONG GetNextULONG(USHORT sel, UCHAR *offset, UCHAR *pCode) +{ + pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF; + pCode[1] = GetUCHAR((ULONG) offset + 1) & 0xFF; + pCode[2] = GetUCHAR((ULONG) offset + 2) & 0xFF; + pCode[3] = GetUCHAR((ULONG) offset + 3) & 0xFF; + + return( *(ULONG *) pCode ); +} + + +#define NEXTUCHAR GetNextUCHAR( pDis->wSel, bpTarget, bpCode); bpCode += 1; bpTarget += 1; bInstrLen += 1 + +#define NEXTUSHORT GetNextUSHORT( pDis->wSel, bpTarget, bpCode); bpCode += 2; bpTarget += 2; bInstrLen += 2 + +#define NEXTULONG GetNextULONG(pDis->wSel, bpTarget, bpCode); bpCode += 4; bpTarget += 4; bInstrLen += 4 + + +/****************************************************************************** +* * +* Functions * +* * +******************************************************************************/ + +/****************************************************************************** +* * +* UCHAR Disassembler( TDisassembler *pDis ); * +* * +******************************************************************************* +* +* This is a generic Intel line disassembler. +* +* Where: +* TDisassembler: +* bpTarget is the address of instruction to disassemble +* szDisasm is the address of the buffer to print a line into +* dwFlags contains the default operand and address bits +* pCode is the address to store code UCHARs (up to 16) +* +* Disassembled instruction is stored as an ASCIIZ string pointed by +* szDisasm pointer (from the pDis structure). +* +* Returns: +* TDisassembler: +* *szDisasm contains the disassembled instruction string +* bAsciiLen is set to the length of the printed string +* bInstrLen is set to instruction length in UCHARs +* dwFlags - has operand and address size flags adjusted +* - DIS_ILLEGALOP set if that was illegal instruction +* UCHAR - instruction length in UCHARs +* +******************************************************************************/ +UCHAR Disassembler( TDisassembler *pDis ) +{ + TOpcodeData *p; // Pointer to a current instruction record + UCHAR *bpTarget; // Pointer to the target code to be disassembled + UCHAR *bpCode; // Pointer to code UCHARs + ULONG arg; // Argument counter + char *sPtr; // Message selection pointer + int nPos; // Printing position in the output string + UCHAR *pArg; // Pointer to record where instruction arguments are + ULONG dwULONG; // Temporary ULONG storage + USHORT wUSHORT; // Temporary USHORT storage + UCHAR bUCHAR; // Temporary UCHAR storage + UCHAR bInstrLen; // Current instruction lenght in UCHARs + UCHAR bOpcode; // Current opcode that is being disassembled + UCHAR bSegOverride; // 0 default segment. >0, segment index + UCHAR bMod=0; // Mod field of the instruction + UCHAR bReg=0; // Register field of the instruction + UCHAR bRm=0; // R/M field of the instruction + UCHAR bW; // Width bit for the register selection + + UCHAR bSib; // S-I-B UCHAR for the instruction + UCHAR bSs; // SS field of the s-i-b UCHAR + UCHAR bIndex; // Index field of the s-i-b UCHAR + UCHAR bBase; // Base field of the s-i-b UCHAR + LPSTR pSymbolName; // used to symbolic name of value + + bInstrLen = 0; // Reset instruction lenght to zero + bSegOverride = 0; // Set default segment (no override) + nPos = 0; // Reset printing position + sPtr = NULL; // Points to no message by default + bpTarget = pDis->bpTarget; // Set internal pointer to a target address + bpCode = pDis->Codes; // Set internal pointer to code UCHARs + + do + { + bOpcode = NEXTUCHAR; // Get the first opcode UCHAR from the target address + p = &Op1[bOpcode]; // Get the address of the instruction record + + if( p->flags & DIS_SPECIAL ) + { + // Opcode is one of the special ones, so do what needs to be done there + + switch( p->name ) + { + case _EscD8: + case _EscD9: + case _EscDA: + case _EscDB: + case _EscDC: + case _EscDD: + case _EscDE: + case _EscDF: // Coprocessor escape: UCHARs D8 - DF + bOpcode = NEXTUCHAR; // Get the modRM UCHAR of the instruction + + if( bOpcode < 0xC0 ) + { + // Opcodes 00-BF use Coproc1 table + + bReg = (bOpcode >> 3) & 7; + p = &Coproc1[ p->name - _EscD8 ][ bReg ]; + + goto StartInstructionParseMODRM; + } + // Opcodes C0-FF use Coproc2 table + + p = &Coproc2[ p->name - _EscD8 ][ bOpcode - 0xC0 ]; + + goto StartInstructionNoMODRM; + + case _S_ES: // Segment override + case _S_CS: + case _S_SS: + case _S_DS: + case _S_FS: + case _S_GS: + bSegOverride = p->name - _S_ES + 1; + continue; + + case _OPSIZ: // Operand size override - toggle + pDis->dwFlags ^= DIS_DATA32; + continue; + + case _ADSIZ: // Address size override - toggle + pDis->dwFlags ^= DIS_ADDRESS32; + continue; + + case _REPNE: // REPNE/REPNZ prefix + pDis->dwFlags |= DIS_REPNE; + continue; + + case _REP: // REP/REPE/REPZ prefix + pDis->dwFlags |= DIS_REP; + continue; + + case _2BESC: // 2 UCHAR escape code 0x0F + bOpcode = NEXTUCHAR; // Get the second UCHAR of the instruction + p = &Op2[bOpcode]; // Get the address of the instruction record + + if( !(p->flags & DIS_SPECIAL) ) goto StartInstruction; + if( p->name < _GRP6 ) goto IllegalOpcode; + + case _GRP1a: // Additional groups of instructions + case _GRP1b: + case _GRP1c: + case _GRP2a: + case _GRP2b: + case _GRP2c: + case _GRP2d: + case _GRP2e: + case _GRP2f: + case _GRP3a: + case _GRP3b: + case _GRP4: + case _GRP5: + case _GRP6: + case _GRP7: + case _GRP8: + case _GRP9: + + bOpcode = NEXTUCHAR; // Get the Mod R/M UCHAR whose... + // bits 3,4,5 select instruction + + bReg = (bOpcode >> 3) & 7; + p = &Groups[p->name - _GRP1a][ bReg ]; + + if( !(p->flags & DIS_SPECIAL) ) goto StartInstructionParseMODRM; + + case _NDEF : // Not defined or illegal opcode + goto IllegalOpcode; + + default :; // Should not happen + } + } + else + goto StartInstruction; + } + while( bInstrLen < 15 ); + +IllegalOpcode: + + nPos += PICE_sprintf( pDis->szDisasm+nPos, "invalid"); + pDis->dwFlags |= DIS_ILLEGALOP; + + goto DisEnd; + +StartInstruction: + + // If this instruction needs additional Mod R/M UCHAR, fetch it + + if( p->flags & DIS_MODRM ) + { + // Get the next UCHAR (modR/M bit field) + bOpcode = NEXTUCHAR; + + bReg = (bOpcode >> 3) & 7; + +StartInstructionParseMODRM: + + // Parse that UCHAR and get mod, reg and rm fields + bMod = bOpcode >> 6; + bRm = bOpcode & 7; + } + +StartInstructionNoMODRM: + + // Print the possible repeat prefix followed by the instruction + + if( p->flags & DIS_COPROC ) + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%-6s ", sCoprocNames[ p->name ]); + else + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s%-6s ", + sRep[DIS_GETREPENUM(pDis->dwFlags)], + sNames[ p->name + (DIS_GETNAMEFLAG(p->flags) & DIS_GETDATASIZE(pDis->dwFlags)) ] ); + + // Do instruction argument processing, up to 3 times + + pArg = &p->dest; + + for( arg=p->args; arg!=0; arg--, pArg++, arg? nPos += PICE_sprintf( pDis->szDisasm+nPos,", ") : 0 ) + { + switch( *pArg ) + { + case _Eb : // modR/M used - bW = 0 + bW = 0; + goto _E; + + case _Ev : // modR/M used - bW = 1 + bW = 1; + goto _E; + + case _Ew : // always USHORT size + pDis->dwFlags &= ~DIS_DATA32; + bW = 1; + goto _E; + + case _Ms : // fword ptr (sgdt,sidt,lgdt,lidt) + sPtr = sFwordPtr; + goto _E1; + + case _Mq : // qword ptr (cmpxchg8b) + sPtr = sQwordPtr; + goto _E1; + + case _Mp : // 32 or 48 bit pointer (les,lds,lfs,lss,lgs) + case _Ep : // Always a memory pointer (call, jmp) + if( pDis->dwFlags & DIS_DATA32 ) + sPtr = sFwordPtr; + else + sPtr = sDwordPtr; + goto _E1; + + _E: + // Do registers first so that the rest may be done together + if( bMod == 3 ) + { + // Registers depending on the w field and data size + nPos+=PICE_sprintf(pDis->szDisasm+nPos, "%s", sRegs1[DIS_GETDATASIZE(pDis->dwFlags)][bW][bRm] ); + + break; + } + + if( bW==0 ) + sPtr = sBytePtr; + else + if( pDis->dwFlags & DIS_DATA32 ) + sPtr = sDwordPtr; + else + sPtr = sWordPtr; + + case _M : // Pure memory pointer (lea,invlpg,floats) + if( bMod == 3 ) goto IllegalOpcode; + + _E1: + + if( sPtr ) + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sPtr ); + + case _Ma : // Used by bound instruction, skip the pointer info + + // Print the segment if it is overriden + // + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sSegOverride[ bSegOverride ] ); + + // + // Special case when sib UCHAR is present in 32 address encoding + // + if( (bRm==4) && (pDis->dwFlags & DIS_ADDRESS32) ) + { + // + // Get the s-i-b UCHAR and parse it + // + bSib = NEXTUCHAR; + + bSs = bSib >> 6; + bIndex = (bSib >> 3) & 7; + bBase = bSib & 7; + + // Special case for base=5 && mod==0 -> fetch 32 bit offset + if( (bBase==5) && (bMod==0) ) + { + dwULONG = NEXTULONG; + if(ScanExportsByAddress(&pSymbolName,dwULONG)) + { + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s", pSymbolName ); + } + else + { + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%08X", (unsigned int) dwULONG ); + } + } + else + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s", sGenReg16_32[ 1 ][ bBase ] ); + + // Scaled index, no index if bIndex is 4 + if( bIndex != 4 ) + nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%s%s", sScale[ bSs ], sGenReg16_32[ 1 ][ bIndex ] ); + else + if(bSs != 0) + nPos += PICE_sprintf( pDis->szDisasm+nPos,"" ); + + // Offset 8 bit or 32 bit + if( bMod == 1 ) + { + bUCHAR = NEXTUCHAR; + if( (signed char)bUCHAR < 0 ) + nPos += PICE_sprintf( pDis->szDisasm+nPos,"-%02X", 0-(signed char)bUCHAR ); + else + nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%02X", bUCHAR ); + } + + if( bMod == 2 ) + { + dwULONG = NEXTULONG; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%08X", (unsigned int) dwULONG ); + } + + // Wrap up the instruction + nPos += PICE_sprintf( pDis->szDisasm+nPos,"]" ); + break; + } + + // + // 16 or 32 address bit cases with mod zero, one or two + // + // Special cases when r/m is 5 and mod is 0, immediate d16 or d32 + if( bMod==0 && ((bRm==6 && !(pDis->dwFlags & DIS_ADDRESS32)) || (bRm==5 && (pDis->dwFlags & DIS_ADDRESS32))) ) + { + if( pDis->dwFlags & DIS_ADDRESS32 ) + { + dwULONG = NEXTULONG; + if(ScanExportsByAddress(&pSymbolName,dwULONG)) + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s]", pSymbolName ); + else + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%08X]", (unsigned int) dwULONG ); + } + else + { + wUSHORT = NEXTUSHORT; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%04X]", wUSHORT ); + } + + break; + } + + // Print the start of the line + nPos += PICE_sprintf( pDis->szDisasm+nPos,"[%s", sAdr1[DIS_GETADDRSIZE(pDis->dwFlags)][ bRm ] ); + + // Offset (8 or 16) or (8 or 32) bit - 16, 32 bits are unsigned + if( bMod==1 ) + { + bUCHAR = NEXTUCHAR; + if( (signed char)bUCHAR < 0 ) + nPos += PICE_sprintf( pDis->szDisasm+nPos,"-%02X", 0-(signed char)bUCHAR ); + else + nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%02X", bUCHAR ); + } + + if( bMod==2 ) + { + if( pDis->dwFlags & DIS_ADDRESS32 ) + { + dwULONG = NEXTULONG; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%08X", (unsigned int) dwULONG ); + } + else + { + wUSHORT = NEXTUSHORT; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"+%04X", wUSHORT ); + } + } + + // Wrap up the instruction + nPos += PICE_sprintf( pDis->szDisasm+nPos,"]" ); + + break; + + case _Gb : // general, UCHAR register + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sRegs1[0][0][ bReg ] ); + break; + + case _Gv : // general, (d)USHORT register + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[DIS_GETDATASIZE(pDis->dwFlags)][ bReg ] ); + break; + + case _Yb : // ES:(E)DI pointer + case _Yv : + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s%s", sSegOverrideDefaultES[ bSegOverride ], sYptr[DIS_GETADDRSIZE(pDis->dwFlags)] ); + break; + + case _Xb : // DS:(E)SI pointer + case _Xv : + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s%s", sSegOverrideDefaultDS[ bSegOverride ], sXptr[DIS_GETADDRSIZE(pDis->dwFlags)] ); + break; + + case _Rd : // general register double USHORT + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[ 1 ][ bRm ] ); + break; + + case _Rw : // register USHORT + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[ 0 ][ bMod ] ); + break; + + case _Sw : // segment register + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sSeg[ bReg ] ); + break; + + case _Cd : // control register + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sControl[ bReg ] ); + break; + + case _Dd : // debug register + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sDebug[ bReg ] ); + break; + + case _Td : // test register + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sTest[ bReg ] ); + break; + + + case _Jb : // immediate UCHAR, relative offset + bUCHAR = NEXTUCHAR; + nPos += PICE_sprintf( pDis->szDisasm+nPos, "short %08X", (unsigned int)(pDis->bpTarget + (signed char)bUCHAR + bInstrLen) ); + break; + + case _Jv : // immediate USHORT or ULONG, relative offset + if( pDis->dwFlags & DIS_DATA32 ) + { + dwULONG = NEXTULONG; + if(ScanExportsByAddress(&pSymbolName,(unsigned int)(pDis->bpTarget + (signed long)dwULONG + bInstrLen))) + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", pSymbolName ); + else + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int)(pDis->bpTarget + (signed long)dwULONG + bInstrLen) ); + } + else + { + wUSHORT = NEXTUSHORT; + if(ScanExportsByAddress(&pSymbolName,(unsigned int)(pDis->bpTarget + (signed short)wUSHORT + bInstrLen))) + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", pSymbolName ); + else + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int)(pDis->bpTarget + (signed short)wUSHORT + bInstrLen) ); + } + break; + + case _O : // Simple USHORT or ULONG offset + if( pDis->dwFlags & DIS_ADDRESS32 ) // depending on the address size + { + dwULONG = NEXTULONG; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s[%08X]", sSegOverride[ bSegOverride ], (unsigned int) dwULONG ); + } + else + { + wUSHORT = NEXTUSHORT; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s[%04X]", sSegOverride[ bSegOverride ], wUSHORT ); + } + break; + + case _Ib : // immediate UCHAR + bUCHAR = NEXTUCHAR; + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%02X", bUCHAR ); + break; + + case _Iv : // immediate USHORT or ULONG + if( pDis->dwFlags & DIS_DATA32 ) + { + dwULONG = NEXTULONG; + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int) dwULONG ); + } + else + { + wUSHORT = NEXTUSHORT; + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%04X", wUSHORT ); + } + break; + + case _Iw : // Immediate USHORT + wUSHORT = NEXTUSHORT; + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%04X", wUSHORT ); + break; + + case _Ap : // 32 bit or 48 bit pointer (call far, jump far) + if( pDis->dwFlags & DIS_DATA32 ) + { + dwULONG = NEXTULONG; + wUSHORT = NEXTUSHORT; + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%04X:%08X", wUSHORT, (unsigned int) dwULONG ); + } + else + { + dwULONG = NEXTULONG; + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%08X", (unsigned int) dwULONG ); + } + break; + + case _1 : // numerical 1 + nPos += PICE_sprintf( pDis->szDisasm+nPos,"1" ); + break; + + case _3 : // numerical 3 + nPos += PICE_sprintf( pDis->szDisasm+nPos,"3" ); + break; + + // Hard coded registers + case _DX: case _AL: case _AH: case _BL: case _BH: case _CL: case _CH: + case _DL: case _DH: case _CS: case _DS: case _ES: case _SS: case _FS: + case _GS: + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sRegs2[ *pArg - _DX ] ); + break; + + case _eAX: case _eBX: case _eCX: case _eDX: + case _eSP: case _eBP: case _eSI: case _eDI: + nPos += PICE_sprintf( pDis->szDisasm+nPos, "%s", sGenReg16_32[DIS_GETDATASIZE(pDis->dwFlags)][ *pArg - _eAX ]); + break; + + case _ST: // Coprocessor ST + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sST[9] ); + break; + + case _ST0: // Coprocessor ST(0) - ST(7) + case _ST1: + case _ST2: + case _ST3: + case _ST4: + case _ST5: + case _ST6: + case _ST7: + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sST[ *pArg - _ST0 ] ); + break; + + case _AX: // Coprocessor AX + nPos += PICE_sprintf( pDis->szDisasm+nPos,"%s", sGenReg16_32[0][0] ); + break; + } + } + +DisEnd: + + // Set the returning values and return with the bInstrLen field + + pDis->bAsciiLen = (UCHAR) nPos; + pDis->bInstrLen = bInstrLen; + + return bInstrLen; +} + +/****************************************************************************** +* * +* BOOLEAN Disasm(PULONG pOffset,PUCHAR pchDst) * +* * +* entry point for disassembly from other modules * +******************************************************************************/ +BOOLEAN Disasm(PULONG pOffset,PUCHAR pchDst) +{ + TDisassembler dis; + + dis.dwFlags = DIS_DATA32 | DIS_ADDRESS32; + dis.bpTarget = (UCHAR*)*pOffset; + dis.szDisasm = pchDst; + dis.wSel = CurrentCS; + + *pOffset += (ULONG)Disassembler( &dis); + return TRUE; +} diff --git a/rosapps/sysutils/utils/pice/module/disassembler.h b/rosapps/sysutils/utils/pice/module/disassembler.h new file mode 100644 index 00000000000..9e9a7571b54 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/disassembler.h @@ -0,0 +1,159 @@ + /* Operand and instruction types */ +#define OP_REG 0x100 /* register */ +#define OP_IMM 0x200 /* immediate value */ +#define OP_IND 0x300 /* indirect memory reference */ +#define OP_BPTR 0x400 /* BYTE Pointer */ +#define OP_WPTR 0x500 /* WORD Pointer */ +#define OP_DPTR 0x600 /* DWORD Pointer */ +#define OP_UNK 0x900 +//#define INS_INVALID 0x00 /* Not a valid instruction */ + /* Branch Instruction types */ +#define INS_BRANCH 0x01 /* Unconditional branch */ +#define INS_COND 0x02 /* Conditional branch */ +#define INS_SUB 0x04 /* Jump to subroutine */ +#define INS_RET 0x08 /* Return from subroutine */ + /* modify ( 'w' ) instructions */ +#define INS_ARITH 0x10 /* Arithmetic inst */ +#define INS_LOGIC 0x20 /* logical inst */ +#define INS_FPU 0x40 /* Floating Point inst */ +#define INS_FLAG 0x80 /* Modify flags */ + /* misc Instruction Types */ +#define INS_MOVE 0x0100 +#define INS_ARRAY 0x0200 /* String and XLAT ops */ +#define INS_PTR 0x0400 /* Load EA/pointer */ +#define INS_STACK 0x1000 /* PUSH, POP, etc */ +#define INS_FRAME 0x2000 /* ENTER, LEAVE, etc */ +#define INS_SYSTEM 0x4000 /* CPUID, WBINVD, etc */ + +/* Other info */ +#define BIG_ENDIAN_ORDER 0 +#define LITTLE_ENDIAN_ORDER 1 + +struct code { /* size 100 */ + unsigned long rva; + unsigned short flags; + char mnemonic[16]; + char dest[32]; + char src[32]; + char aux[32]; + int mnemType; + int destType; + int srcType; + int auxType; +}; + +/* struct used in Init routine */ +struct CPU_TYPE{ + char vendor; + char model[12]; +}; + +#define cpu_80386 0x01 +#define cpu_80486 0x02 +#define cpu_PENTIUM 0x04 +#define cpu_PENTMMX 0x08 +#define cpu_PENTPRO 0x10 +#define cpu_PENTIUM2 0x20 +#define cpu_PENTIUM3 0x40 +#define cpu_PENTIUM4 0x80 + +#define FLAGS_MODRM 0x00001 //contains mod r/m byte +#define FLAGS_8BIT 0x00002 //force 8-bit arguments +#define FLAGS_16BIT 0x00004 //force 16-bit arguments +#define FLAGS_32BIT 0x00008 //force 32-bit arguments +#define FLAGS_REAL 0x00010 //real mode only +#define FLAGS_PMODE 0x00020 //protected mode only +#define FLAGS_PREFIX 0x00040 //for lock and rep prefix +#define FLAGS_MMX 0x00080 //mmx instruction/registers +#define FLAGS_FPU 0x00100 //fpu instruction/registers +#define FLAGS_CJMP 0x00200 //codeflow - conditional jump +#define FLAGS_JMP 0x00400 //codeflow - jump +#define FLAGS_IJMP 0x00800 //codeflow - indexed jump +#define FLAGS_CALL 0x01000 //codeflow - call +#define FLAGS_ICALL 0x02000 //codeflow - indexed call +#define FLAGS_RET 0x04000 //codeflow - return +#define FLAGS_SEGPREFIX 0x08000 //segment prefix +#define FLAGS_OPERPREFIX 0x10000 //operand prefix +#define FLAGS_ADDRPREFIX 0x20000 //address prefix +#define FLAGS_OMODE16 0x40000 //16-bit operand mode only +#define FLAGS_OMODE32 0x80000 //32-bit operand mode only + +enum argtype { + ARG_REG=1,ARG_IMM,ARG_NONE,ARG_MODRM,ARG_REG_AX, + ARG_REG_ES,ARG_REG_CS,ARG_REG_SS,ARG_REG_DS,ARG_REG_FS,ARG_REG_GS,ARG_REG_BX, + ARG_REG_CX,ARG_REG_DX, + ARG_REG_SP,ARG_REG_BP,ARG_REG_SI,ARG_REG_DI,ARG_IMM8,ARG_RELIMM8,ARG_FADDR,ARG_REG_AL, + ARG_MEMLOC,ARG_SREG,ARG_RELIMM,ARG_16REG_DX,ARG_REG_CL,ARG_REG_DL,ARG_REG_BL,ARG_REG_AH, + ARG_REG_CH,ARG_REG_DH,ARG_REG_BH,ARG_MODREG,ARG_CREG,ARG_DREG,ARG_TREG_67,ARG_TREG, + ARG_MREG,ARG_MMXMODRM,ARG_MODRM8,ARG_IMM_1,ARG_MODRM_FPTR,ARG_MODRM_S,ARG_MODRMM512, + ARG_MODRMQ,ARG_MODRM_SREAL,ARG_REG_ST0,ARG_FREG,ARG_MODRM_PTR,ARG_MODRM_WORD,ARG_MODRM_SINT, + ARG_MODRM_EREAL,ARG_MODRM_DREAL,ARG_MODRM_WINT,ARG_MODRM_LINT,ARG_REG_BC,ARG_REG_DE, + ARG_REG_HL,ARG_REG_DE_IND,ARG_REG_HL_IND,ARG_REG_BC_IND,ARG_REG_SP_IND,ARG_REG_A, + ARG_REG_B,ARG_REG_C,ARG_REG_D,ARG_REG_E,ARG_REG_H,ARG_REG_L,ARG_IMM16,ARG_REG_AF, + ARG_REG_AF2,ARG_MEMLOC16,ARG_IMM8_IND,ARG_BIT,ARG_REG_IX,ARG_REG_IX_IND,ARG_REG_IY, + ARG_REG_IY_IND,ARG_REG_C_IND,ARG_REG_I,ARG_REG_R,ARG_IMM16_A,ARG_MODRM16,ARG_SIMM8, + ARG_IMM32,ARG_STRING,ARG_MODRM_BCD,ARG_PSTRING,ARG_DOSSTRING,ARG_CUNICODESTRING, + ARG_PUNICODESTRING,ARG_NONEBYTE,ARG_XREG,ARG_XMMMODRM}; + +typedef struct x86_inst { + int flags; + int destType, srcType, auxType; + int cpu_type; + int inst_type; + char *mnem; + char *dest, *src, *aux; +} instr; + + +#define GENREG_8 0x0001 +#define GENREG_16 0x0002 +#define GENREG_32 0x0004 +#define SEGREG 0x0008 +#define MMXREG 0x0010 +#define SIMDREG 0x0020 +#define DEBUGREG 0x0040 +#define CONTROLREG 0x0080 +#define TESTREG 0x0100 + +#define NO_REG 0x100 +#define DIRECT_REG 0x200 +#define NO_BASE 0x400 +#define NO_INDEX 0x800 +#define DISP8 0x1000 +#define DISP32 0x2000 +#define HAS_SIB 0x4000 +#define HAS_MODRM 0x8000 + +struct OPERAND { //arg1, arg2, arg3 + char * str; //temporary buffer for building arg text + int type; //argument type + int * flag; //pointer to CODE arg flags + char * text; //pointer to CODE arg text +}; + +struct EA { //effective address [SIB/disp] + int mode, flags; + int mod, rm, reg; + long disp; + char sib[32]; +}; + +struct modRM_byte { + unsigned int mod : 2; + unsigned int reg : 3; + unsigned int rm : 3; +}; + +struct SIB_byte { + unsigned int scale : 2; + unsigned int index : 3; + unsigned int base : 3; +}; + +typedef struct x86_table { //Assembly instruction tables + instr *table; //Pointer to table of instruction encodings + char divisor; // number to divide by for look up + char mask; // bit mask for look up + char minlim,maxlim; // limits on min/max entries. + char modrmpos; // modrm byte position plus +} asmtable; diff --git a/rosapps/sysutils/utils/pice/module/disassemblerdata.h b/rosapps/sysutils/utils/pice/module/disassemblerdata.h new file mode 100644 index 00000000000..2bde2ec2f48 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/disassemblerdata.h @@ -0,0 +1,1802 @@ +/*++ + +Copyright (c) 2000-2001 Goran Devic +Modified (c) 2001 Klaus P. Gerlicher + +Module Name: + + disassembler.h + +Abstract: + + header for disassembler.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Goran Devic + +Revision History: + + 17-Mar-2000: Original (Goran Devic) + 05-Jan-2001: Modified for pICE (Klaus P. Gerlicher) + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +BUGS: + There is no segment override for _Ap (look the code) +--*/ + + +/****************************************************************************** +* * +* Include Files * +* * +******************************************************************************/ + +#include "disassemblerdefines.h" // Include its own defines + +/****************************************************************************** +* * +* Define opcode names as ASCIIZ strings * +* * +******************************************************************************/ +char* sNames[] = { +"", /* 0X000 */ +"AAA", /* 0X001 */ +"AAD", /* 0X002 */ +"AAM", /* 0X003 */ +"AAS", /* 0X004 */ +"ADC", /* 0X005 */ +"ADD", /* 0X006 */ +"AND", /* 0X007 */ +"ARPL", /* 0X008 */ +"BOUND", /* 0X009 */ +"BSF", /* 0X00A */ +"BSR", /* 0X00B */ +"BT", /* 0X00C */ +"BTC", /* 0X00D */ +"BTR", /* 0X00E */ +"BTS", /* 0X00F */ +"CALL", /* 0X010 */ +"CBW", /* 0X011 */ +"CWDE", /* 0X012 */ +"CLC", /* 0X013 */ +"CLD", /* 0X014 */ +"CLI", /* 0X015 */ +"CLTS", /* 0X016 */ +"CMC", /* 0X017 */ +"CMP", /* 0X018 */ +"CMPS", /* 0X019 */ +"CMPSB", /* 0X01A */ +"CMPSW", /* 0X01B */ +"CMPSD", /* 0X01C */ +"CWD", /* 0X01D */ +"CDQ", /* 0X01E */ +"DAA", /* 0X01F */ +"DAS", /* 0X020 */ +"DEC", /* 0X021 */ +"DIV", /* 0X022 */ +"ENTER", /* 0X023 */ +"HLT", /* 0X024 */ +"IDIV", /* 0X025 */ +"IMUL", /* 0X026 */ +"IN", /* 0X027 */ +"INC", /* 0X028 */ +"INS", /* 0X029 */ +"INSB", /* 0X02A */ +"INSW", /* 0X02B */ +"INSD", /* 0X02C */ +"INT", /* 0X02D */ +"INTO", /* 0X02E */ +"IRET", /* 0X02F */ +"IRETD", /* 0X030 */ +"JO", /* 0X031 */ +"JNO", /* 0X032 */ +"JB", /* 0X033 */ +"JNB", /* 0X034 */ +"JZ", /* 0X035 */ +"JNZ", /* 0X036 */ +"JBE", /* 0X037 */ +"JNBE", /* 0X038 */ +"JS", /* 0X039 */ +"JNS", /* 0X03A */ +"JP", /* 0X03B */ +"JNP", /* 0X03C */ +"JL", /* 0X03D */ +"JNL", /* 0X03E */ +"JLE", /* 0X03F */ +"JNLE", /* 0X040 */ +"JMP", /* 0X041 */ +"LAHF", /* 0X042 */ +"LAR", /* 0X043 */ +"LEA", /* 0X044 */ +"LEAVE", /* 0X045 */ +"LGDT", /* 0X046 */ +"LIDT", /* 0X047 */ +"LGS", /* 0X048 */ +"LSS", /* 0X049 */ +"LDS", /* 0X04A */ +"LES", /* 0X04B */ +"LFS", /* 0X04C */ +"LLDT", /* 0X04D */ +"LMSW", /* 0X04E */ +"LOCK", /* 0X04F */ +"LODS", /* 0X050 */ +"LODSB", /* 0X051 */ +"LODSW", /* 0X052 */ +"LODSD", /* 0X053 */ +"LOOP", /* 0X054 */ +"LOOPE", /* 0X055 */ +"LOOPZ", /* 0X056 */ +"LOOPNE", /* 0X057 */ +"LOOPNZ", /* 0X058 */ +"LSL", /* 0X059 */ +"LTR", /* 0X05A */ +"MOV", /* 0X05B */ +"MOVS", /* 0X05C */ +"MOVSB", /* 0X05D */ +"MOVSW", /* 0X05E */ +"MOVSD", /* 0X05F */ +"MOVSX", /* 0X060 */ +"MOVZX", /* 0X061 */ +"MUL", /* 0X062 */ +"NEG", /* 0X063 */ +"NOP", /* 0X064 */ +"NOT", /* 0X065 */ +"OR", /* 0X066 */ +"OUT", /* 0X067 */ +"OUTS", /* 0X068 */ +"OUTSB", /* 0X069 */ +"OUTSW", /* 0X06A */ +"OUTSD", /* 0X06B */ +"POP", /* 0X06C */ +"POPA", /* 0X06D */ +"POPAD", /* 0X06E */ +"POPF", /* 0X06F */ +"POPFD", /* 0X070 */ +"PUSH", /* 0X071 */ +"PUSHA", /* 0X072 */ +"PUSHAD", /* 0X073 */ +"PUSHF", /* 0X074 */ +"PUSHFD", /* 0X075 */ +"RCL", /* 0X076 */ +"RCR", /* 0X077 */ +"ROL", /* 0X078 */ +"ROR", /* 0X079 */ +"REP", /* 0X07A */ +"REPE", /* 0X07B */ +"REPZ", /* 0X07C */ +"REPNE", /* 0X07D */ +"REPNZ", /* 0X07E */ +"RET", /* 0X07F */ +"SAHF", /* 0X080 */ +"SAL", /* 0X081 */ +"SAR", /* 0X082 */ +"SHL", /* 0X083 */ +"SHR", /* 0X084 */ +"SBB", /* 0X085 */ +"SCAS", /* 0X086 */ +"SCASB", /* 0X087 */ +"SCASW", /* 0X088 */ +"SCASD", /* 0X089 */ +"SET", /* 0X08A */ +"SGDT", /* 0X08B */ +"SIDT", /* 0X08C */ +"SHLD", /* 0X08D */ +"SHRD", /* 0X08E */ +"SLDT", /* 0X08F */ +"SMSW", /* 0X090 */ +"STC", /* 0X091 */ +"STD", /* 0X092 */ +"STI", /* 0X093 */ +"STOS", /* 0X094 */ +"STOSB", /* 0X095 */ +"STOSW", /* 0X096 */ +"STOSD", /* 0X097 */ +"STR", /* 0X098 */ +"SUB", /* 0X099 */ +"TEST", /* 0X09A */ +"VERR", /* 0X09B */ +"VERW", /* 0X09C */ +"WAIT", /* 0X09D */ +"XCHG", /* 0X09E */ +"XLAT", /* 0X09F */ +"XLATB", /* 0X0A0 */ +"XOR", /* 0X0A1 */ +"JCXZ", /* 0X0A2 */ +"LOADALL", /* 0X0A3 */ +"INVD", /* 0X0A4 */ +"WBINVD", /* 0X0A5 */ +"SETO", /* 0X0A6 */ +"SETNO", /* 0X0A7 */ +"SETB", /* 0X0A8 */ +"SETNB", /* 0X0A9 */ +"SETZ", /* 0X0AA */ +"SETNZ", /* 0X0AB */ +"SETBE", /* 0X0AC */ +"SETNBE", /* 0X0AD */ +"SETS", /* 0X0AE */ +"SETNS", /* 0X0AF */ +"SETP", /* 0X0B0 */ +"SETNP", /* 0X0B1 */ +"SETL", /* 0X0B2 */ +"SETNL", /* 0X0B3 */ +"SETLE", /* 0X0B4 */ +"SETNLE", /* 0X0B5 */ +"WRMSR", /* 0X0B6 */ +"RDTSC", /* 0X0B7 */ +"RDMSR", /* 0X0B8 */ +"CPUID", /* 0X0B9 */ +"RSM", /* 0X0BA */ +"CMPXCHG", /* 0X0BB */ +"XADD", /* 0X0BC */ +"BSWAP", /* 0X0BD */ +"INVLPG", /* 0X0BE */ +"CMPXCHG8B", /* 0X0BF */ +"JMP FAR", /* 0X0C0 */ +"RETF", /* 0X0C1 */ +"RDPMC" /* 0X0C2 */ +}; + + +char* sCoprocNames[] = { +"", /* 0X000 */ +"F2XM1", /* 0X001 */ +"FABS", /* 0X002 */ +"FADD", /* 0X003 */ +"FADDP", /* 0X004 */ +"FBLD", /* 0X005 */ +"FBSTP", /* 0X006 */ +"FCHS", /* 0X007 */ +"FCLEX", /* 0X008 */ +"FCOM", /* 0X009 */ +"FCOMP", /* 0X00A */ +"FCOMPP", /* 0X00B */ +"FCOS", /* 0X00C */ +"FDECSTP", /* 0X00D */ +"FDIV", /* 0X00E */ +"FDIVP", /* 0X00F */ +"FDIVR", /* 0X010 */ +"FDIVRP", /* 0X011 */ +"FFREE", /* 0X012 */ +"FIADD", /* 0X013 */ +"FICOM", /* 0X014 */ +"FICOMP", /* 0X015 */ +"FIDIV", /* 0X016 */ +"FIDIVR", /* 0X017 */ +"FILD", /* 0X018 */ +"FIMUL", /* 0X019 */ +"FINCSTP", /* 0X01A */ +"FINIT", /* 0X01B */ +"FIST", /* 0X01C */ +"FISTP", /* 0X01D */ +"FISUB", /* 0X01E */ +"FISUBR", /* 0X01F */ +"FLD", /* 0X020 */ +"FLD1", /* 0X021 */ +"FLDCW", /* 0X022 */ +"FLDENV", /* 0X023 */ +"FLDL2E", /* 0X024 */ +"FLDL2T", /* 0X025 */ +"FLDLG2", /* 0X026 */ +"FLDLN2", /* 0X027 */ +"FLDPI", /* 0X028 */ +"FLDZ", /* 0X029 */ +"FMUL", /* 0X02A */ +"FMULP", /* 0X02B */ +"FNOP", /* 0X02C */ +"FPATAN", /* 0X02D */ +"FPREM", /* 0X02E */ +"FPREM1", /* 0X02F */ +"FPTAN", /* 0X030 */ +"FRNDINT", /* 0X031 */ +"FRSTOR", /* 0X032 */ +"FSAVE", /* 0X033 */ +"FSCALE", /* 0X034 */ +"FSIN", /* 0X035 */ +"FSINCOS", /* 0X036 */ +"FSQRT", /* 0X037 */ +"FST", /* 0X038 */ +"FSTCW", /* 0X039 */ +"FSTENV", /* 0X03A */ +"FSTP", /* 0X03B */ +"FSTSW", /* 0X03C */ +"FSUB", /* 0X03D */ +"FSUBP", /* 0X03E */ +"FSUBR", /* 0X03F */ +"FSUBRP", /* 0X040 */ +"FTST", /* 0X041 */ +"FUCOM", /* 0X042 */ +"FUCOMP", /* 0X043 */ +"FUCOMPP", /* 0X044 */ +"FXAM", /* 0X045 */ +"FXCH", /* 0X046 */ +"FXTRACT", /* 0X047 */ +"FYL2X", /* 0X048 */ +"FYL2XP1" /* 0X049 */ +}; + + +/****************************************************************************** +* +* Table of the first byte of an instruction +* +******************************************************************************/ +TOpcodeData Op1[ 256 ] = { +{ /* 00 */ _add ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 01 */ _add ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 02 */ _add ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 03 */ _add ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 04 */ _add ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 05 */ _add ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 06 */ _push ,1 ,_ES ,0 ,0 ,0 ,0, 0 }, +{ /* 07 */ _pop ,1 ,_ES ,0 ,0 ,0 ,0, 0 }, +{ /* 08 */ _or ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 09 */ _or ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0A */ _or ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 0B */ _or ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 0C */ _or ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 0D */ _or ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 0E */ _push ,1 ,_CS ,0 ,0 ,0 ,0, 0 }, +{ /* 0F */ _2BESC ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 10 */ _adc ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 11 */ _adc ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 12 */ _adc ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 13 */ _adc ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 14 */ _adc ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 15 */ _adc ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 16 */ _push ,1 ,_SS ,0 ,0 ,0 ,0, 0 }, +{ /* 17 */ _pop ,1 ,_SS ,0 ,0 ,0 ,0, 0 }, +{ /* 18 */ _sbb ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 19 */ _sbb ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 1A */ _sbb ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 1B */ _sbb ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 1C */ _sbb ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 1D */ _sbb ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 1E */ _push ,1 ,_DS ,0 ,0 ,0 ,0, 0 }, +{ /* 1F */ _pop ,1 ,_DS ,0 ,0 ,0 ,0, 0 }, + +{ /* 20 */ _and ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 21 */ _and ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 22 */ _and ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 23 */ _and ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 24 */ _and ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 25 */ _and ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 26 */ _S_ES ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 27 */ _daa ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 28 */ _sub ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 29 */ _sub ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 2A */ _sub ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 2B */ _sub ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 2C */ _sub ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 2D */ _sub ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 2E */ _S_CS ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 2F */ _das ,0 ,0 ,0 ,0 ,0 ,0, 0 }, + +{ /* 30 */ _xor ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 31 */ _xor ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 32 */ _xor ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 33 */ _xor ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 34 */ _xor ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 35 */ _xor ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 36 */ _S_SS ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 37 */ _aaa ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 38 */ _cmp ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 39 */ _cmp ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 3A */ _cmp ,2 ,_Gb ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 3B */ _cmp ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 3C */ _cmp ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* 3D */ _cmp ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* 3E */ _S_DS ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 3F */ _aas ,0 ,0 ,0 ,0 ,0 ,0, 0 }, + +{ /* 40 */ _inc ,1 ,_eAX,0 ,0 ,0 ,0, 0 }, +{ /* 41 */ _inc ,1 ,_eCX,0 ,0 ,0 ,0, 0 }, +{ /* 42 */ _inc ,1 ,_eDX,0 ,0 ,0 ,0, 0 }, +{ /* 43 */ _inc ,1 ,_eBX,0 ,0 ,0 ,0, 0 }, +{ /* 44 */ _inc ,1 ,_eSP,0 ,0 ,0 ,0, 0 }, +{ /* 45 */ _inc ,1 ,_eBP,0 ,0 ,0 ,0, 0 }, +{ /* 46 */ _inc ,1 ,_eSI,0 ,0 ,0 ,0, 0 }, +{ /* 47 */ _inc ,1 ,_eDI,0 ,0 ,0 ,0, 0 }, +{ /* 48 */ _dec ,1 ,_eAX,0 ,0 ,0 ,0, 0 }, +{ /* 49 */ _dec ,1 ,_eCX,0 ,0 ,0 ,0, 0 }, +{ /* 4A */ _dec ,1 ,_eDX,0 ,0 ,0 ,0, 0 }, +{ /* 4B */ _dec ,1 ,_eBX,0 ,0 ,0 ,0, 0 }, +{ /* 4C */ _dec ,1 ,_eSP,0 ,0 ,0 ,0, 0 }, +{ /* 4D */ _dec ,1 ,_eBP,0 ,0 ,0 ,0, 0 }, +{ /* 4E */ _dec ,1 ,_eSI,0 ,0 ,0 ,0, 0 }, +{ /* 4F */ _dec ,1 ,_eDI,0 ,0 ,0 ,0, 0 }, + +{ /* 50 */ _push ,1 ,_eAX,0 ,0 ,0 ,0, 0 }, +{ /* 51 */ _push ,1 ,_eCX,0 ,0 ,0 ,0, 0 }, +{ /* 52 */ _push ,1 ,_eDX,0 ,0 ,0 ,0, 0 }, +{ /* 53 */ _push ,1 ,_eBX,0 ,0 ,0 ,0, 0 }, +{ /* 54 */ _push ,1 ,_eSP,0 ,0 ,0 ,0, 0 }, +{ /* 55 */ _push ,1 ,_eBP,0 ,0 ,0 ,0, 0 }, +{ /* 56 */ _push ,1 ,_eSI,0 ,0 ,0 ,0, 0 }, +{ /* 57 */ _push ,1 ,_eDI,0 ,0 ,0 ,0, 0 }, +{ /* 58 */ _pop ,1 ,_eAX,0 ,0 ,0 ,0, 0 }, +{ /* 59 */ _pop ,1 ,_eCX,0 ,0 ,0 ,0, 0 }, +{ /* 5A */ _pop ,1 ,_eDX,0 ,0 ,0 ,0, 0 }, +{ /* 5B */ _pop ,1 ,_eBX,0 ,0 ,0 ,0, 0 }, +{ /* 5C */ _pop ,1 ,_eSP,0 ,0 ,0 ,0, 0 }, +{ /* 5D */ _pop ,1 ,_eBP,0 ,0 ,0 ,0, 0 }, +{ /* 5E */ _pop ,1 ,_eSI,0 ,0 ,0 ,0, 0 }, +{ /* 5F */ _pop ,1 ,_eDI,0 ,0 ,0 ,0, 0 }, + +{ /* 60 */ _pusha ,0 ,0 ,0 ,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* 61 */ _popa ,0 ,0 ,0 ,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* 62 */ _bound ,2 ,_Gv ,_Ma ,0 ,0 ,0, DIS_MODRM }, +{ /* 63 */ _arpl ,2 ,_Ew ,_Rw ,0 ,0 ,0, DIS_MODRM }, +{ /* 64 */ _S_FS ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 65 */ _S_GS ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 66 */ _OPSIZ ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 67 */ _ADSIZ ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 68 */ _push ,1 ,_Iv ,0 ,0 ,0 ,0, 0 }, +{ /* 69 */ _imul ,2 ,_Gv ,_Ev ,_Iv ,0 ,0, DIS_MODRM }, +{ /* 6A */ _push ,1 ,_Ib ,0 ,0 ,0 ,0, 0 }, +{ /* 6B */ _imul ,3 ,_Gv ,_Ev ,_Ib ,0 ,0, DIS_MODRM }, +{ /* 6C */ _insb ,2 ,_Yb ,_DX ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 6D */ _insw ,2 ,_Yv ,_DX ,0 ,0 ,0, SCAN_TERMINATING | DIS_NAME_FLAG }, +{ /* 6E */ _outsb ,2 ,_DX ,_Xb ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 6F */ _outsw ,2 ,_DX ,_Xv ,0 ,0 ,0, SCAN_TERMINATING | DIS_NAME_FLAG }, + +{ /* 70 */ _jo ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 71 */ _jno ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 72 */ _jb ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 73 */ _jnb ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 74 */ _jz ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 75 */ _jnz ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 76 */ _jbe ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 77 */ _jnbe ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 78 */ _js ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 79 */ _jns ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 7A */ _jp ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 7B */ _jnp ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 7C */ _jl ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 7D */ _jnl ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 7E */ _jle ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 7F */ _jnle ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, + +{ /* 80 */ _GRP1a ,2 ,_Eb ,_Ib ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 81 */ _GRP1b ,2 ,_Ev ,_Iv ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 82 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 83 */ _GRP1c ,2 ,_Ev ,_Ib ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 84 */ _test ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 85 */ _test ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 86 */ _xchg ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 87 */ _xchg ,2 ,_Ev ,_Gv ,0 ,0 ,INSTR_READ_WRITE | INSTR_WORD_DWORD, DIS_MODRM }, +{ /* 88 */ _mov ,2 ,_Eb ,_Gb ,0 ,0 ,INSTR_WRITE | INSTR_BYTE, DIS_MODRM }, +{ /* 89 */ _mov ,2 ,_Ev ,_Gv ,0 ,0 ,INSTR_WRITE | INSTR_WORD, DIS_MODRM }, +{ /* 8A */ _mov ,2 ,_Gb ,_Eb ,0 ,0 ,INSTR_READ | INSTR_BYTE, DIS_MODRM }, +{ /* 8B */ _mov ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 8C */ _mov ,2 ,_Ew ,_Sw ,0 ,0 ,0, DIS_MODRM }, +{ /* 8D */ _lea ,2 ,_Gv ,_M ,0 ,0 ,0, DIS_MODRM }, +{ /* 8E */ _mov ,2 ,_Sw ,_Ew ,0 ,0 ,0, SCAN_TERM_PMODE | DIS_MODRM }, +{ /* 8F */ _pop ,1 ,_Ev ,0 ,0 ,0 ,0, DIS_MODRM }, + +{ /* 90 */ _nop ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 91 */ _xchg ,2 ,_eCX,_eAX,0 ,0 ,0, 0 }, +{ /* 92 */ _xchg ,2 ,_eDX,_eAX,0 ,0 ,0, 0 }, +{ /* 93 */ _xchg ,2 ,_eBX,_eAX,0 ,0 ,0, 0 }, +{ /* 94 */ _xchg ,2 ,_eSP,_eAX,0 ,0 ,0, 0 }, +{ /* 95 */ _xchg ,2 ,_eBP,_eAX,0 ,0 ,0, 0 }, +{ /* 96 */ _xchg ,2 ,_eSI,_eAX,0 ,0 ,0, 0 }, +{ /* 97 */ _xchg ,2 ,_eDI,_eAX,0 ,0 ,0, 0 }, +{ /* 98 */ _cbw ,0 ,0 ,0 ,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* 99 */ _cwd ,0 ,0 ,0 ,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* 9A */ _call ,1 ,_Ap ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, +{ /* 9B */ _wait ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 9C */ _pushf ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING | DIS_NAME_FLAG }, +{ /* 9D */ _popf ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING | DIS_NAME_FLAG }, +{ /* 9E */ _sahf ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 9F */ _lahf ,0 ,0 ,0 ,0 ,0 ,0, 0 }, + +{ /* A0 */ _mov ,2 ,_AL ,_O ,0 ,0 ,0, 0 }, +{ /* A1 */ _mov ,2 ,_eAX,_O ,0 ,0 ,INSTR_READ | INSTR_WORD_DWORD, 0 }, +{ /* A2 */ _mov ,2 ,_O ,_AL ,0 ,0 ,0, 0 }, +{ /* A3 */ _mov ,2 ,_O ,_eAX,0 ,0 ,INSTR_WRITE | INSTR_WORD_DWORD, 0 }, +{ /* A4 */ _movsb ,2 ,_Yb ,_Xb ,0 ,0 ,0, 0 }, +{ /* A5 */ _movsw ,2 ,_Yv ,_Xv ,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* A6 */ _cmpsb ,2 ,_Xb ,_Yb ,0 ,0 ,0, 0 }, +{ /* A7 */ _cmpsw ,2 ,_Xv ,_Yv ,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* A8 */ _test ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* A9 */ _test ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* AA */ _stosb ,2 ,_Yb ,_AL ,0 ,0 ,0, 0 }, +{ /* AB */ _stosw ,2 ,_Yb ,_eAX,0 ,0 ,0, DIS_NAME_FLAG }, +{ /* AC */ _lodsb ,2 ,_AL ,_Xb ,0 ,0 ,INSTR_READ | INSTR_BYTE, 0 }, +{ /* AD */ _lodsw ,2 ,_eAX,_Xv ,0 ,0 ,INSTR_READ | INSTR_WORD_DWORD, DIS_NAME_FLAG }, +{ /* AE */ _scasb ,2 ,_AL ,_Xb ,0 ,0 ,0, 0 }, +{ /* AF */ _scasw ,2 ,_eAX,_Xv ,0 ,0 ,0, DIS_NAME_FLAG }, + +{ /* B0 */ _mov ,2 ,_AL ,_Ib ,0 ,0 ,0, 0 }, +{ /* B1 */ _mov ,2 ,_CL ,_Ib ,0 ,0 ,0, 0 }, +{ /* B2 */ _mov ,2 ,_DL ,_Ib ,0 ,0 ,0, 0 }, +{ /* B3 */ _mov ,2 ,_BL ,_Ib ,0 ,0 ,0, 0 }, +{ /* B4 */ _mov ,2 ,_AH ,_Ib ,0 ,0 ,0, 0 }, +{ /* B5 */ _mov ,2 ,_CH ,_Ib ,0 ,0 ,0, 0 }, +{ /* B6 */ _mov ,2 ,_DH ,_Ib ,0 ,0 ,0, 0 }, +{ /* B7 */ _mov ,2 ,_BH ,_Ib ,0 ,0 ,0, 0 }, +{ /* B8 */ _mov ,2 ,_eAX,_Iv ,0 ,0 ,0, 0 }, +{ /* B9 */ _mov ,2 ,_eCX,_Iv ,0 ,0 ,0, 0 }, +{ /* BA */ _mov ,2 ,_eDX,_Iv ,0 ,0 ,0, 0 }, +{ /* BB */ _mov ,2 ,_eBX,_Iv ,0 ,0 ,0, 0 }, +{ /* BC */ _mov ,2 ,_eSP,_Iv ,0 ,0 ,0, 0 }, +{ /* BD */ _mov ,2 ,_eBP,_Iv ,0 ,0 ,0, 0 }, +{ /* BE */ _mov ,2 ,_eSI,_Iv ,0 ,0 ,0, 0 }, +{ /* BF */ _mov ,2 ,_eDI,_Iv ,0 ,0 ,0, 0 }, + +{ /* C0 */ _GRP2a ,2 ,_Eb ,_Ib ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* C1 */ _GRP2b ,2 ,_Ev ,_Ib ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* C2 */ _ret ,1 ,_Iw ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, +{ /* C3 */ _ret ,0 ,0 ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, +{ /* C4 */ _les ,2 ,_Gv ,_Mp ,0 ,0 ,0, SCAN_TERM_PMODE | DIS_MODRM }, +{ /* C5 */ _lds ,2 ,_Gv ,_Mp ,0 ,0 ,0, SCAN_TERM_PMODE | DIS_MODRM }, +{ /* C6 */ _mov ,2 ,_Eb ,_Ib ,0 ,0 ,0, DIS_MODRM }, +{ /* C7 */ _mov ,2 ,_Ev ,_Iv ,0 ,0 ,0, DIS_MODRM }, +{ /* C8 */ _enter ,2 ,_Iw ,_Ib ,0 ,0 ,0, 0 }, +{ /* C9 */ _leave ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* CA */ _retf ,1 ,_Iw ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, +{ /* CB */ _retf ,0 ,0 ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, +{ /* CC */ _int ,1 ,_3 ,0 ,0 ,0 ,0, 0 }, +{ /* CD */ _int ,1 ,_Ib ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* CE */ _into ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* CF */ _iret ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + +{ /* D0 */ _GRP2c ,2 ,_Eb ,_1 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* D1 */ _GRP2d ,2 ,_Ev ,_1 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* D2 */ _GRP2e ,2 ,_Eb ,_CL ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* D3 */ _GRP2f ,2 ,_Ev ,_CL ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* D4 */ _aam ,1 ,_Ib ,0 ,0 ,0 ,0, 0 }, +{ /* D5 */ _aad ,1 ,_Ib ,0 ,0 ,0 ,0, 0 }, +{ /* D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D7 */ _xlat ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* D8 */ _EscD8 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 */ _EscD9 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA */ _EscDA ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB */ _EscDB ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC */ _EscDC ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD */ _EscDD ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE */ _EscDE ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF */ _EscDF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* E0 */ _loopne ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* E1 */ _loope ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* E2 */ _loop ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* E3 */ _jcxz ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* E4 */ _in ,2 ,_AL ,_Ib ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* E5 */ _in ,2 ,_eAX,_Ib ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* E6 */ _out ,2 ,_Ib ,_AL ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* E7 */ _out ,2 ,_Ib ,_eAX,0 ,0 ,0, SCAN_TERMINATING }, +{ /* E8 */ _call ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* E9 */ _jmp ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_JUMP }, +{ /* EA */ _jmpf ,1 ,_Ap ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* EB */ _jmp ,1 ,_Jb ,0 ,0 ,0 ,0, SCAN_JUMP }, +{ /* EC */ _in ,2 ,_AL ,_DX ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* ED */ _in ,2 ,_eAX,_DX ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* EE */ _out ,2 ,_DX ,_AL ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* EF */ _out ,2 ,_DX ,_eAX,0 ,0 ,0, SCAN_TERMINATING }, + +{ /* F0 */ _lock ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* F1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* F2 */ _REPNE ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* F3 */ _REP ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* F4 */ _hlt ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* F5 */ _cmc ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* F6 */ _GRP3a ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* F7 */ _GRP3b ,1 ,_Ev ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* F8 */ _clc ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* F9 */ _stc ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* FA */ _cli ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* FB */ _sti ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* FC */ _cld ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* FD */ _std ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* FE */ _GRP4 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* FF */ _GRP5 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM } +}; + + +/****************************************************************************** +* +* Table of the second byte of an instruction where the first byte was FF, +* the 2-byte escape code +* +******************************************************************************/ +TOpcodeData Op2[ 256 ] = { +{ /* 0F 00 */ _GRP6 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 0F 01 */ _GRP7 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 0F 02 */ _lar ,2 ,_Gv ,_Ew ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 03 */ _lsl ,2 ,_Gv ,_Ew ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 04 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 05 */ _loadall ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 0F 06 */ _clts ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 07 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 08 */ _invd ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 09 */ _wbinv ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 0A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 0B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 0C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 0D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 0E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 0F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 10 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 11 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 12 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 13 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 14 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 15 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 16 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 17 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 18 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 19 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 1A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 1B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 1C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 1D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 1E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 1F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 20 */ _mov ,2 ,_Rd ,_Cd ,0 ,0 ,0, SCAN_TERMINATING | DIS_MODRM }, +{ /* 0F 21 */ _mov ,2 ,_Rd ,_Dd ,0 ,0 ,0, SCAN_TERMINATING | DIS_MODRM }, +{ /* 0F 22 */ _mov ,2 ,_Cd ,_Rd ,0 ,0 ,0, SCAN_TERMINATING | DIS_MODRM }, +{ /* 0F 23 */ _mov ,2 ,_Dd ,_Rd ,0 ,0 ,0, SCAN_TERMINATING | DIS_MODRM }, +{ /* 0F 24 */ _mov ,2 ,_Rd ,_Td ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 25 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 26 */ _mov ,2 ,_Td ,_Rd ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 27 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 28 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 29 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 2A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 2B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 2C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 2D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 2E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 2F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 30 */ _wrmsr ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 31 */ _rdtsc ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 32 */ _rdmsr ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 33 */ _rdpmc ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F 34 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 35 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 36 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 37 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 38 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 39 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 3A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 3B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 3C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 3D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 3E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 3F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 40 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 41 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 42 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 43 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 44 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 45 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 46 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 47 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 48 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 49 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 4A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 4B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 4C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 4D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 4E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 4F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 50 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 51 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 52 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 53 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 54 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 55 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 56 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 57 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 58 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 59 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 5A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 5B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 5C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 5D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 5E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 5F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 60 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 61 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 62 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 63 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 64 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 65 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 66 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 67 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 68 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 69 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 6A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 6B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 6C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 6D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 6E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 6F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 70 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 71 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 72 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 73 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 74 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 75 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 76 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 77 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 78 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 79 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 7A */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 7B */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 7C */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 7D */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 7E */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F 7F */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F 80 */ _jo ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 81 */ _jno ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 82 */ _jb ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 83 */ _jnb ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 84 */ _jz ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 85 */ _jnz ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 86 */ _jbe ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 87 */ _jnbe ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 88 */ _js ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 89 */ _jns ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 8A */ _jp ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 8B */ _jnp ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 8C */ _jl ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 8D */ _jnl ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 8E */ _jle ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, +{ /* 0F 8F */ _jnle ,1 ,_Jv ,0 ,0 ,0 ,0, SCAN_COND_JUMP }, + +{ /* 0F 90 */ _seto ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 91 */ _setno ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 92 */ _setb ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 93 */ _setnb ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 94 */ _setz ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 95 */ _setnz ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 96 */ _setbe ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 97 */ _setnbe ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 98 */ _sets ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 99 */ _setns ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 9A */ _setp ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 9B */ _setnp ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 9C */ _setl ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 9D */ _setnl ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 9E */ _setle ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F 9F */ _setnle ,1 ,_Eb ,0 ,0 ,0 ,0, DIS_MODRM }, + +{ /* 0F A0 */ _push ,1 ,_FS ,0 ,0 ,0 ,0, 0 }, +{ /* 0F A1 */ _pop ,1 ,_FS ,0 ,0 ,0 ,0, 0 }, +{ /* 0F A2 */ _cpuid ,0 ,0 ,0 ,0 ,0 ,0, SCAN_TERMINATING }, +{ /* 0F A3 */ _bt ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F A4 */ _shld ,3 ,_Ev ,_Gv ,_Ib ,0 ,0, DIS_MODRM }, +{ /* 0F A5 */ _shld ,3 ,_Ev ,_Gv ,_CL ,0 ,0, DIS_MODRM }, +{ /* 0F A6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F A7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F A8 */ _push ,1 ,_GS ,0 ,0 ,0 ,0, 0 }, +{ /* 0F A9 */ _pop ,1 ,_GS ,0 ,0 ,0 ,0, 0 }, +{ /* 0F AA */ _rsm ,0 ,0 ,0 ,0 ,0 ,0, 0 }, +{ /* 0F AB */ _bts ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F AC */ _shrd ,3 ,_Ev ,_Gv ,_Ib ,0 ,0, DIS_MODRM }, +{ /* 0F AD */ _shrd ,3 ,_Ev ,_Gv ,_CL ,0 ,0, DIS_MODRM }, +{ /* 0F AE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F AF */ _imul ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, + +{ /* 0F B0 */ _cmpx ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F B1 */ _cmpx ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F B2 */ _lss ,2 ,_Gv ,_Mp ,0 ,0 ,0, SCAN_TERM_PMODE | DIS_MODRM }, +{ /* 0F B3 */ _btr ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F B4 */ _lfs ,2 ,_Gv ,_Mp ,0 ,0 ,0, SCAN_TERM_PMODE | DIS_MODRM }, +{ /* 0F B5 */ _lgs ,2 ,_Gv ,_Mp ,0 ,0 ,0, SCAN_TERM_PMODE | DIS_MODRM }, +{ /* 0F B6 */ _movzx ,2 ,_Gv ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F B7 */ _movzx ,2 ,_Gv ,_Ew ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F B8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F B9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F BA */ _GRP8 ,2 ,_Ev ,_Ib ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 0F BB */ _btc ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F BC */ _bsf ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F BD */ _bsr ,2 ,_Gv ,_Ev ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F BE */ _movsx ,2 ,_Gv ,_Eb ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F BF */ _movsx ,2 ,_Gv ,_Ew ,0 ,0 ,0, DIS_MODRM }, + +{ /* 0F C0 */ _xadd ,2 ,_Eb ,_Gb ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F C1 */ _xadd ,2 ,_Ev ,_Gv ,0 ,0 ,0, DIS_MODRM }, +{ /* 0F C2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F C3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F C4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F C5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F C6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F C7 */ _GRP9 ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL | DIS_MODRM }, +{ /* 0F C8 */ _bswap ,1 ,_eAX,0 ,0 ,0 ,0, 0 }, +{ /* 0F C9 */ _bswap ,1 ,_eCX,0 ,0 ,0 ,0, 0 }, +{ /* 0F CA */ _bswap ,1 ,_eDX,0 ,0 ,0 ,0, 0 }, +{ /* 0F CB */ _bswap ,1 ,_eBX,0 ,0 ,0 ,0, 0 }, +{ /* 0F CC */ _bswap ,1 ,_eSP,0 ,0 ,0 ,0, 0 }, +{ /* 0F CD */ _bswap ,1 ,_eBP,0 ,0 ,0 ,0, 0 }, +{ /* 0F CE */ _bswap ,1 ,_eSI,0 ,0 ,0 ,0, 0 }, +{ /* 0F CF */ _bswap ,1 ,_eDI,0 ,0 ,0 ,0, 0 }, + +{ /* 0F D0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F D9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F E0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F E9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F EA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F EB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F EC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F ED */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F EE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F EF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* 0F F0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F F9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F FA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F FB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F FC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F FD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F FE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* 0F FF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL } +}; + + +/****************************************************************************** +* +* Table for Groups codes; groups 1 - 9 +* +* (These records have DIS_MODRM implied) +* +******************************************************************************/ +TOpcodeData Groups[ 17 ][ 8 ] = { +{{ /* Group 1a */ _add ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 001 */ _or ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 010 */ _adc ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 011 */ _sbb ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 100 */ _and ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 101 */ _sub ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 110 */ _xor ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 111 */ _cmp ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }}, + +{{ /* Group 1b */ _add ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 001 */ _or ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 010 */ _adc ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 011 */ _sbb ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 100 */ _and ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 101 */ _sub ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 110 */ _xor ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 111 */ _cmp ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }}, + +{{ /* Group 1c */ _add ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 001 */ _or ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 010 */ _adc ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 011 */ _sbb ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 100 */ _and ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 101 */ _sub ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 110 */ _xor ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 111 */ _cmp ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }}, + +{{ /* Group 2a */ _rol ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 001 */ _ror ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 010 */ _rcl ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 011 */ _rcr ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 100 */ _sal ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 101 */ _shr ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 110 */ _shl ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 111 */ _sar ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }}, + +{{ /* Group 2b */ _rol ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 001 */ _ror ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 010 */ _rcl ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 011 */ _rcr ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 100 */ _sal ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 101 */ _shr ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 110 */ _shl ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 111 */ _sar ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }}, + +{{ /* Group 2c */ _rol ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 001 */ _ror ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 010 */ _rcl ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 011 */ _rcr ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 100 */ _sal ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 101 */ _shr ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 110 */ _shl ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }, + { /* 111 */ _sar ,2 ,_Eb ,_1 ,0 ,0 ,0, 0 }}, + +{{ /* Group 2d */ _rol ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 001 */ _ror ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 010 */ _rcl ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 011 */ _rcr ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 100 */ _sal ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 101 */ _shr ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 110 */ _shl ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }, + { /* 111 */ _sar ,2 ,_Ev ,_1 ,0 ,0 ,0, 0 }}, + +{{ /* Group 2e */ _rol ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 001 */ _ror ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 010 */ _rcl ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 011 */ _rcr ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 100 */ _sal ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 101 */ _shr ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 110 */ _shl ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }, + { /* 111 */ _sar ,2 ,_Eb ,_CL ,0 ,0 ,0, 0 }}, + +{{ /* Group 2f */ _rol ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 001 */ _ror ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 010 */ _rcl ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 011 */ _rcr ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 100 */ _sal ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 101 */ _shr ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 110 */ _shl ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }, + { /* 111 */ _sar ,2 ,_Ev ,_CL ,0 ,0 ,0, 0 }}, + +{{ /* Group 3a */ _test ,2 ,_Eb ,_Ib ,0 ,0 ,0, 0 }, + { /* 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 010 */ _not ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 011 */ _neg ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 100 */ _mul ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 101 */ _imul ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 110 */ _div ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 111 */ _idiv ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }}, + +{{ /* Group 3b */ _test ,2 ,_Ev ,_Iv ,0 ,0 ,0, 0 }, + { /* 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 010 */ _not ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 011 */ _neg ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 100 */ _mul ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 101 */ _imul ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 110 */ _div ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 111 */ _idiv ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }}, + +{{ /* Group 4 */ _inc ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 001 */ _dec ,1 ,_Eb ,0 ,0 ,0 ,0, 0 }, + { /* 010 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 011 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 100 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 101 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 110 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 111 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }}, + +{{ /* Group 5 */ _inc ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 001 */ _dec ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 010 */ _call ,1 ,_Ev ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, + { /* 011 */ _call ,1 ,_Ep ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, + { /* 100 */ _jmp ,1 ,_Ev ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, + { /* 101 */ _jmp ,1 ,_Ep ,0 ,0 ,0 ,0, SCAN_SINGLE_STEP }, + { /* 110 */ _push ,1 ,_Ev ,0 ,0 ,0 ,0, 0 }, + { /* 111 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }}, + +{{ /* Group 6 */ _sldt ,1 ,_Ew ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 001 */ _str ,1 ,_Ew ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 010 */ _lldt ,1 ,_Ew ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 011 */ _ltr ,1 ,_Ew ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 100 */ _verr ,1 ,_Ew ,0 ,0 ,0 ,0, 0 }, + { /* 101 */ _verw ,1 ,_Ew ,0 ,0 ,0 ,0, 0 }, + { /* 110 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 111 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }}, + +{{ /* Group 7 */ _sgdt ,1 ,_Ms ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 001 */ _sidt ,1 ,_Ms ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 010 */ _lgdt ,1 ,_Ms ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 011 */ _lidt ,1 ,_Ms ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 100 */ _smsw ,1 ,_Ew ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 101 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 110 */ _lmsw ,1 ,_Ew ,0 ,0 ,0 ,0, SCAN_TERMINATING }, + { /* 111 */ _invpg ,1 ,_M ,0 ,0 ,0 ,0, SCAN_TERMINATING }}, + +{{ /* Group 8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 010 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 011 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 100 */ _bt ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 101 */ _bts ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 110 */ _btr ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }, + { /* 111 */ _btc ,2 ,_Ev ,_Ib ,0 ,0 ,0, 0 }}, + +{{ /* Group 9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 001 */ _cmpx8 ,1 ,_Mq ,0 ,0 ,0 ,0, 0 }, + { /* 010 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 011 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 100 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 101 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 110 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + { /* 111 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }} +}; + + +/****************************************************************************** +* +* Coprocessor instructions have the prefix byte of D8-DF. +* The Coproc1 table defines instructions that have the second byte in the +* range 00-BF +* +******************************************************************************/ +TOpcodeData Coproc1[ 8 ][ 8 ] = { +{{ /* D8 000 */ _fadd ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 001 */ _fmul ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 010 */ _fcom ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 011 */ _fcomp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 100 */ _fsub ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 101 */ _fsubr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 110 */ _fdiv ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D8 111 */ _fdivr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* D9 000 */ _fld ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 010 */ _fst ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 011 */ _fstp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 100 */ _fldenv ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 101 */ _fldcw ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 110 */ _fstenv ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 111 */ _fstcw ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* DA 000 */ _fiadd ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 001 */ _fimul ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 010 */ _ficom ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 011 */ _ficomp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 100 */ _fisub ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 101 */ _fisubr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 110 */ _fidiv ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA 111 */ _fidivr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* DB 000 */ _fild ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DB 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB 010 */ _fist ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DB 011 */ _fistp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DB 100 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB 101 */ _fld ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DB 110 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB 111 */ _fstp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* DC 000 */ _fadd ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 001 */ _fmul ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 010 */ _fcom ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 011 */ _fcomp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 100 */ _fsub ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 101 */ _fsubr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 110 */ _fdiv ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DC 111 */ _fdivr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* DD 000 */ _fld ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD 010 */ _fst ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD 011 */ _fstp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD 100 */ _frstor ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD 101 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD 110 */ _fsave ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD 111 */ _fstsw ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* DE 000 */ _fiadd ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 001 */ _fimul ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 010 */ _ficom ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 011 */ _ficomp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 100 */ _fisub ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 101 */ _fisubr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 110 */ _fidiv ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE 111 */ _fidivr ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }}, + +{{ /* DF 000 */ _fild ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF 001 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF 010 */ _fist ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF 011 */ _fistp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF 100 */ _fbld ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF 101 */ _fild ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF 110 */ _fbstp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF 111 */ _fistp ,1 ,_M ,0 ,0 ,0 ,0, DIS_COPROC }} +}; + + +/****************************************************************************** +* +* The Coproc2 table defines coprocessor instructions that have the second +* byte in the range C0-FF +* +******************************************************************************/ +TOpcodeData Coproc2[ 8 ][ 16 * 4 ] = { +{{ /* D8 C0 */ _fadd ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C1 */ _fadd ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C2 */ _fadd ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C3 */ _fadd ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C4 */ _fadd ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C5 */ _fadd ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C6 */ _fadd ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C7 */ _fadd ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 C8 */ _fmul ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 C9 */ _fmul ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 CA */ _fmul ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 CB */ _fmul ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 CC */ _fmul ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 CD */ _fmul ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 CE */ _fmul ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 CF */ _fmul ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 D0 */ _fcom ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D1 */ _fcom ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D2 */ _fcom ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D3 */ _fcom ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D4 */ _fcom ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D5 */ _fcom ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D6 */ _fcom ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D7 */ _fcom ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 D8 */ _fcomp ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 D9 */ _fcomp ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 DA */ _fcomp ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 DB */ _fcomp ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 DC */ _fcomp ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 DD */ _fcomp ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 DE */ _fcomp ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 DF */ _fcomp ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 E0 */ _fsub ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E1 */ _fsub ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E2 */ _fsub ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E3 */ _fsub ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E4 */ _fsub ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E5 */ _fsub ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E6 */ _fsub ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E7 */ _fsub ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 E8 */ _fsubr ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 E9 */ _fsubr ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 EA */ _fsubr ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 EB */ _fsubr ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 EC */ _fsubr ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 ED */ _fsubr ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 EE */ _fsubr ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 EF */ _fsubr ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 F0 */ _fdiv ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F1 */ _fdiv ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F2 */ _fdiv ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F3 */ _fdiv ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F4 */ _fdiv ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F5 */ _fdiv ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F6 */ _fdiv ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F7 */ _fdiv ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D8 F8 */ _fdivr ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D8 F9 */ _fdivr ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D8 FA */ _fdivr ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D8 FB */ _fdivr ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D8 FC */ _fdivr ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D8 FD */ _fdivr ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D8 FE */ _fdivr ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D8 FF */ _fdivr ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }}, +/*----------------------------------------------------*/ +{{ /* D9 C0 */ _fld ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C1 */ _fld ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C2 */ _fld ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C3 */ _fld ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C4 */ _fld ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C5 */ _fld ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C6 */ _fld ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C7 */ _fld ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D9 C8 */ _fxch ,2 ,_ST ,_ST0,0 ,0 ,0, DIS_COPROC }, +{ /* D9 C9 */ _fxch ,2 ,_ST ,_ST1,0 ,0 ,0, DIS_COPROC }, +{ /* D9 CA */ _fxch ,2 ,_ST ,_ST2,0 ,0 ,0, DIS_COPROC }, +{ /* D9 CB */ _fxch ,2 ,_ST ,_ST3,0 ,0 ,0, DIS_COPROC }, +{ /* D9 CC */ _fxch ,2 ,_ST ,_ST4,0 ,0 ,0, DIS_COPROC }, +{ /* D9 CD */ _fxch ,2 ,_ST ,_ST5,0 ,0 ,0, DIS_COPROC }, +{ /* D9 CE */ _fxch ,2 ,_ST ,_ST6,0 ,0 ,0, DIS_COPROC }, +{ /* D9 CF */ _fxch ,2 ,_ST ,_ST7,0 ,0 ,0, DIS_COPROC }, + +{ /* D9 D0 */ _fnop ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* D9 D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 D9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* D9 E0 */ _fchs ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 E1 */ _fabs ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 E2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 E3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 E4 */ _ftst ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 E5 */ _fxam ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 E6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* D9 E7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* D9 E8 */ _fld1 ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 E9 */ _fldl2t ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 EA */ _fldl2e ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 EB */ _fldpi ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 EC */ _fldlg2 ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 ED */ _fldln2 ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 EE */ _fldz ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 EF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* D9 F0 */ _f2xm1 ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F1 */ _fyl2x ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F2 */ _fptan ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F3 */ _fpatan ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F4 */ _fxtract ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F5 */ _fprem1 ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F6 */ _fdecstp ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F7 */ _fincstp ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, + +{ /* D9 F8 */ _fprem ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 F9 */ _fyl2xp1 ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 FA */ _fsqrt ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 FB */ _fsincos ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 FC */ _frndint ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 FD */ _fscale ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 FE */ _fsin ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* D9 FF */ _fcos ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }}, +/*----------------------------------------------------*/ +{{ /* DA C0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA C8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA C9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA CA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA CB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA CC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA CD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA CE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA CF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA D0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA D9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA E0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA E8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA E9 */ _fucompp ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DA EA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA EB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA EC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA ED */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA EE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA EF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA F0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DA F8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA F9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA FA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA FB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA FC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA FD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA FE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DA FF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }}, +/*----------------------------------------------------*/ +{{ /* DB C0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB C8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB C9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB CA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB CB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB CC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB CD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB CE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB CF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB D0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB D9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB E0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB E1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB E2 */ _fclex ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DB E3 */ _finit ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DB E4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB E5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB E6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB E7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB E8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB E9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB EA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB EB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB EC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB ED */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB EE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB EF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB F0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DB F8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB F9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB FA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB FB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB FC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB FD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB FE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DB FF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }}, +/*----------------------------------------------------*/ +{{ /* DC C0 */ _fadd ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C1 */ _fadd ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C2 */ _fadd ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C3 */ _fadd ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C4 */ _fadd ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C5 */ _fadd ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C6 */ _fadd ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C7 */ _fadd ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DC C8 */ _fmul ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC C9 */ _fmul ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC CA */ _fmul ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC CB */ _fmul ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC CC */ _fmul ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC CD */ _fmul ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC CE */ _fmul ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC CF */ _fmul ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DC D0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DC D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC D9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DC DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DC E0 */ _fsubr ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E1 */ _fsubr ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E2 */ _fsubr ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E3 */ _fsubr ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E4 */ _fsubr ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E5 */ _fsubr ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E6 */ _fsubr ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E7 */ _fsubr ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DC E8 */ _fsub ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC E9 */ _fsub ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC EA */ _fsub ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC EB */ _fsub ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC EC */ _fsub ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC ED */ _fsub ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC EE */ _fsub ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC EF */ _fsub ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DC F0 */ _fdivr ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F1 */ _fdivr ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F2 */ _fdivr ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F3 */ _fdivr ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F4 */ _fdivr ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F5 */ _fdivr ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F6 */ _fdivr ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F7 */ _fdivr ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DC F8 */ _fdiv ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC F9 */ _fdiv ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC FA */ _fdiv ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC FB */ _fdiv ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC FC */ _fdiv ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC FD */ _fdiv ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC FE */ _fdiv ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DC FF */ _fdiv ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }}, +/*----------------------------------------------------*/ +{{ /* DD C0 */ _ffree ,1 ,_ST0,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C1 */ _ffree ,1 ,_ST1,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C2 */ _ffree ,1 ,_ST2,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C3 */ _ffree ,1 ,_ST3,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C4 */ _ffree ,1 ,_ST4,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C5 */ _ffree ,1 ,_ST5,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C6 */ _ffree ,1 ,_ST6,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD C7 */ _ffree ,1 ,_ST7,0 ,0 ,0 ,0, DIS_COPROC }, + +{ /* DD C8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD C9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD CA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD CB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD CC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD CD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD CE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD CF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DD D0 */ _fst ,1 ,_ST0,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D1 */ _fst ,1 ,_ST1,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D2 */ _fst ,1 ,_ST2,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D3 */ _fst ,1 ,_ST3,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D4 */ _fst ,1 ,_ST4,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D5 */ _fst ,1 ,_ST5,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D6 */ _fst ,1 ,_ST6,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D7 */ _fst ,1 ,_ST7,0 ,0 ,0 ,0, DIS_COPROC }, + +{ /* DD D8 */ _fstp ,1 ,_ST0,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD D9 */ _fstp ,1 ,_ST1,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD DA */ _fstp ,1 ,_ST2,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD DB */ _fstp ,1 ,_ST3,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD DC */ _fstp ,1 ,_ST4,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD DD */ _fstp ,1 ,_ST5,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD DE */ _fstp ,1 ,_ST6,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD DF */ _fstp ,1 ,_ST7,0 ,0 ,0 ,0, DIS_COPROC }, + +{ /* DD E0 */ _fucom ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E1 */ _fucom ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E2 */ _fucom ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E3 */ _fucom ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E4 */ _fucom ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E5 */ _fucom ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E6 */ _fucom ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E7 */ _fucom ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DD E8 */ _fucomp ,1 ,_ST0,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD E9 */ _fucomp ,1 ,_ST1,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD EA */ _fucomp ,1 ,_ST2,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD EB */ _fucomp ,1 ,_ST3,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD EC */ _fucomp ,1 ,_ST4,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD ED */ _fucomp ,1 ,_ST5,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD EE */ _fucomp ,1 ,_ST6,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DD EF */ _fucomp ,1 ,_ST7,0 ,0 ,0 ,0, DIS_COPROC }, + +{ /* DD F0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DD F8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD F9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD FA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD FB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD FC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD FD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD FE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DD FF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }}, +/*----------------------------------------------------*/ +{{ /* DE C0 */ _faddp ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C1 */ _faddp ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C2 */ _faddp ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C3 */ _faddp ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C4 */ _faddp ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C5 */ _faddp ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C6 */ _faddp ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C7 */ _faddp ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DE C8 */ _fmulp ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE C9 */ _fmulp ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE CA */ _fmulp ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE CB */ _fmulp ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE CC */ _fmulp ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE CD */ _fmulp ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE CE */ _fmulp ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE CF */ _fmulp ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DE D0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DE D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE D9 */ _fcompp ,0 ,0 ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DE DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DE DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DE E0 */ _fsubrp ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E1 */ _fsubrp ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E2 */ _fsubrp ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E3 */ _fsubrp ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E4 */ _fsubrp ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E5 */ _fsubrp ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E6 */ _fsubrp ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E7 */ _fsubrp ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DE E8 */ _fsubp ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE E9 */ _fsubp ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE EA */ _fsubp ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE EB */ _fsubp ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE EC */ _fsubp ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE ED */ _fsubp ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE EE */ _fsubp ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE EF */ _fsubp ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DE F0 */ _fdivrp ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F1 */ _fdivrp ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F2 */ _fdivrp ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F3 */ _fdivrp ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F4 */ _fdivrp ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F5 */ _fdivrp ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F6 */ _fdivrp ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F7 */ _fdivrp ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }, + +{ /* DE F8 */ _fdivp ,2 ,_ST0,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE F9 */ _fdivp ,2 ,_ST1,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE FA */ _fdivp ,2 ,_ST2,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE FB */ _fdivp ,2 ,_ST3,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE FC */ _fdivp ,2 ,_ST4,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE FD */ _fdivp ,2 ,_ST5,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE FE */ _fdivp ,2 ,_ST6,_ST ,0 ,0 ,0, DIS_COPROC }, +{ /* DE FF */ _fdivp ,2 ,_ST7,_ST ,0 ,0 ,0, DIS_COPROC }}, +/*----------------------------------------------------*/ +{{ /* DF C0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF C8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF C9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF CA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF CB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF CC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF CD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF CE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF CF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF D0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF D8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF D9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF DA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF DB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF DC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF DD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF DE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF DF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF E0 */ _fstsw ,1 ,_AX ,0 ,0 ,0 ,0, DIS_COPROC }, +{ /* DF E1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF E8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF E9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF EA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF EB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF EC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF ED */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF EE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF EF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF F0 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F1 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F2 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F3 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F4 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F5 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F6 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F7 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, + +{ /* DF F8 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF F9 */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF FA */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF FB */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF FC */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF FD */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF FE */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }, +{ /* DF FF */ _NDEF ,0 ,0 ,0 ,0 ,0 ,0, DIS_SPECIAL }} +}; + +/****************************************************************************** +* +* Generic messages used by the disassembler +* +******************************************************************************/ +char *sBytePtr = "BYTE PTR "; +char *sWordPtr = "WORD PTR "; +char *sDwordPtr = "DWORD PTR "; +char *sFwordPtr = "FWORD PTR "; +char *sQwordPtr = "QWORD PTR "; + +/****************************************************************************** +* +* Different register messages used by the disassembler +* +******************************************************************************/ +char *sGenReg16_32[ 2 ][ 8 ] = { +{ "AX","CX","DX","BX","SP","BP","SI","DI" }, +{ "EAX","ECX","EDX","EBX","ESP","EBP","ESI","EDI" } +}; + +char *sSeg[ 8 ] = { +"ES","CS","SS","DS","FS","GS","?","?" +}; + +char *sSegOverride[ 8 ] = { +"", "ES:","CS:","SS:","DS:","FS:","GS:","?:" +}; + +char *sSegOverrideDefaultES[ 8 ] = { +"ES:", "ES:","CS:","SS:","DS:","FS:","GS:","?:" +}; + +char *sSegOverrideDefaultDS[ 8 ] = { +"DS:", "ES:","CS:","SS:","DS:","FS:","GS:","?:" +}; + +char *sScale[ 4 ] = { +"", "2*", "4*", "8*" +}; + +char *sAdr1[ 2 ][ 8 ] = { +{ "BX+SI","BX+DI","BP+SI","BP+DI","SI","DI","BP","BX" }, +{ "EAX","ECX","EDX","EBX","?","EBP","ESI","EDI" } +}; + +char *sRegs1[ 2 ][ 2 ][ 8 ] = { +{{ "AL","CL","DL","BL","AH","CH","DH","BH" }, + { "AX","CX","DX","BX","SP","BP","SI","DI" } }, +{{ "AL","CL","DL","BL","AH","CH","DH","BH" }, + { "EAX","ECX","EDX","EBX","ESP","EBP","ESI","EDI" } } +}; + +char *sRegs2[] = { +"DX", "AL", "AH", "BL", "BH", "CL", "CH", "DL", "DH", "CS", "DS", "ES", "SS", "FS", "GS" +}; + +char *sControl[ 8 ] = { +"CR0","CR1","CR2","CR3","CR4","?","?","?" +}; + +char *sDebug[ 8 ] = { +"DR0","DR1","DR2","DR3","DR4","DR5","DR6","DR7" +}; + +char *sTest[ 8 ] = { +"?","?","?","?","?","?","TR6","TR7" +}; + +char *sYptr[ 2 ] = { +"[DI]", "[EDI]" +}; + +char *sXptr[ 2 ] = { +"[SI]", "[ESI]" +}; + +char *sRep[ 4 ] = { +"", "REP ", "REPNZ ", "?" +}; + +char *sST[ 9 ] = { +"ST(0)","ST(1)","ST(2)","ST(3)","ST(4)","ST(5)","ST(6)","ST(7)","ST" +}; + + diff --git a/rosapps/sysutils/utils/pice/module/disassemblerdefines.h b/rosapps/sysutils/utils/pice/module/disassemblerdefines.h new file mode 100644 index 00000000000..dc52a99c371 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/disassemblerdefines.h @@ -0,0 +1,515 @@ +/****************************************************************************** +* * +* Module: disassemblerdefines.h * +* * +* Revision: 1.00 * +* * +* Date: 3/17/2000 * +* * +* Copyright (c) 2000 Goran Devic * +* * +* Author: Goran Devic * +* * +******************************************************************************* + + Module Description: + + This is a header file containing the disassembler defines that are + used in DisassemblerData.h + +******************************************************************************* +* * +* Changes: * +* * +* DATE DESCRIPTION OF CHANGES AUTHOR * +* -------- --------------------------------------------------- ----------- * +* 4/28/2000 Original Goran Devic * +* 11/4/2000 Modified for LinIce Goran Devic * +* -------- --------------------------------------------------- ----------- * +******************************************************************************* +* Important Defines * +******************************************************************************/ +#ifndef _DDEF_H_ +#define _DDEF_H_ + +/****************************************************************************** +* +* Groups and special codes in place of name index +* +******************************************************************************/ +#define _NDEF 0x00 // Udefined/reserved opcode +#define _2BESC 0x01 // 2 byte escape code +#define _S_ES 0x02 // Segment ES override | these defines +#define _S_CS 0x03 // Segment CS override | must have +#define _S_SS 0x04 // Segment SS override | consecutive +#define _S_DS 0x05 // Segment DS override | enumeration +#define _S_FS 0x06 // Segment FS override | numbers. +#define _S_GS 0x07 // Segment GS override | +#define _OPSIZ 0x08 // Operand size override +#define _ADSIZ 0x09 // Address size override +#define _REPNE 0x0A // REPNE/REPNZ prefix +#define _REP 0x0B // REP/REPE/REPZ prefix +#define _EscD8 0x0C // Escape to coprocessor set: prefix D8 +#define _EscD9 0x0D // Escape to coprocessor set: prefix D9 +#define _EscDA 0x0E // Escape to coprocessor set: prefix DA +#define _EscDB 0x0F // Escape to coprocessor set: prefix DB +#define _EscDC 0x10 // Escape to coprocessor set: prefix DC +#define _EscDD 0x11 // Escape to coprocessor set: prefix DD +#define _EscDE 0x12 // Escape to coprocessor set: prefix DE +#define _EscDF 0x13 // Escape to coprocessor set: prefix DF +#define _GRP1a 0x14 // Group 1a extended opcode +#define _GRP1b 0x15 // Group 1b extended opcode +#define _GRP1c 0x16 // Group 1c extended opcode +#define _GRP2a 0x17 // Group 2a extended opcode +#define _GRP2b 0x18 // Group 2b extended opcode +#define _GRP2c 0x19 // Group 2c extended opcode +#define _GRP2d 0x1A // Group 2d extended opcode +#define _GRP2e 0x1B // Group 2e extended opcode +#define _GRP2f 0x1C // Group 2f extended opcode +#define _GRP3a 0x1D // Group 3a extended opcode +#define _GRP3b 0x1E // Group 3b extended opcode +#define _GRP4 0x1F // Group 4 extended opcode +#define _GRP5 0x20 // Group 5 extended opcode +#define _GRP6 0x21 // Group 6 extended opcode +#define _GRP7 0x22 // Group 7 extended opcode +#define _GRP8 0x23 // Group 8 extended opcode +#define _GRP9 0x24 // Group 9 extended opcode + +/****************************************************************************** +* +* Addressing modes argument definiton for the opcodes in a table +* +******************************************************************************/ +#define _O 0x01 + +#define _Ib 0x03 +#define _Iv 0x04 +#define _Iw 0x05 +#define _Yb 0x06 +#define _Yv 0x07 +#define _Xb 0x08 +#define _Xv 0x09 +#define _Jb 0x0A +#define _Jv 0x0B +#define _Ap 0x0C +#define _1 0x10 +#define _3 0x11 +#define _DX 0x12 +#define _AL 0x13 +#define _AH 0x14 +#define _BL 0x15 +#define _BH 0x16 +#define _CL 0x17 +#define _CH 0x18 +#define _DL 0x19 +#define _DH 0x1A +#define _CS 0x1B +#define _DS 0x1C +#define _ES 0x1D +#define _SS 0x1E +#define _FS 0x1F +#define _GS 0x20 +#define _eAX 0x21 +#define _eCX 0x22 +#define _eDX 0x23 +#define _eBX 0x24 +#define _eSP 0x25 +#define _eBP 0x26 +#define _eSI 0x27 +#define _eDI 0x28 +#define _Eb 0x2F +#define _Ev 0x30 +#define _Ew 0x31 +#define _Ep 0x32 +#define _Gb 0x33 +#define _Gv 0x34 +#define _M 0x35 +#define _Ma 0x36 +#define _Mp 0x37 +#define _Ms 0x38 +#define _Mq 0x39 +#define _Rd 0x3A +#define _Rw 0x3B +#define _Sw 0x3C +#define _Cd 0x3D +#define _Dd 0x3E +#define _Td 0x3F +#define _ST 0x40 +#define _ST0 0x41 +#define _ST1 0x42 +#define _ST2 0x43 +#define _ST3 0x44 +#define _ST4 0x45 +#define _ST5 0x46 +#define _ST6 0x47 +#define _ST7 0x48 +#define _AX 0x49 + +/****************************************************************************** +* +* Define holding structure for opcode +* +******************************************************************************/ + +typedef struct +{ + UCHAR name; // Index into the opcode name table + UCHAR args; // Number of addressing codes that follow + UCHAR dest; // Destination operand addressing code + UCHAR src; // Source operand addressing code + UCHAR thrid; // Third operand addressing code + UCHAR v_instruction; // Virtual instruction index + UCHAR access; // Instruction data access type + UCHAR flags; // Miscellaneous flags +} TOpcodeData; + +// `access' field: +// Data access flags are used with memory access instructions + +#define INSTR_READ 0x80 // Faulting instruction reads memory +#define INSTR_WRITE 0x40 // Faulting instruction writes to memory +#define INSTR_READ_WRITE 0x20 // Faulting instruction is read-modify-write + +// Low nibble contains the data length code - do not change these values as +// they represent the data width value as well + +#define INSTR_BYTE 0x01 // Byte access instruction +#define INSTR_WORD 0x02 // Word access instruction +#define INSTR_WORD_DWORD 0x03 // Word or dword, depending on operand size +#define INSTR_DWORD 0x04 // Dword access instruction + +// `flags' field: +// Disassembler flags; bottom 4 bits are used by the scanner flags + +#define DIS_SPECIAL 0x80 // Special opcode +#define DIS_NAME_FLAG 0x40 // Name changes +#define DIS_GETNAMEFLAG(flags) (((flags)>>6)&1) +#define DIS_COPROC 0x20 // Coprocessor instruction +#define DIS_MODRM 0x10 // Use additional Mod R/M byte + +// Scanner enums: 4 bits wide + +#define SCAN_NATIVE 0x0 // Native instruction are default 0 +#define SCAN_JUMP 0x1 // Evaluate new path +#define SCAN_COND_JUMP 0x2 // Evaluate both paths +#define SCAN_TERMINATING 0x3 // Terminating instruction needs virtualization +#define SCAN_TERM_PMODE 0x4 // Terminating instruction in protected mode only +#define SCAN_SINGLE_STEP 0x5 // Single-step instruction + +// Define values stored in meta pages (bits [7:4]) + +#define META_NATIVE 0x0 // Native instruction are default 0 +#define META_UNDEF 0x1 // Undefined/illegal instruction +#define META_TERMINATING 0x2 // Terminating instruction +#define META_SINGLE_STEP 0x3 // Execute natively single step + +/****************************************************************************** +* * +* Define opcode values for the main table * +* * +******************************************************************************/ +#define _aaa 0x001 +#define _aad 0x002 +#define _aam 0x003 +#define _aas 0x004 +#define _adc 0x005 +#define _add 0x006 +#define _and 0x007 +#define _arpl 0x008 +#define _bound 0x009 +#define _bsf 0x00a +#define _bsr 0x00b +#define _bt 0x00c +#define _btc 0x00d +#define _btr 0x00e +#define _bts 0x00f +#define _call 0x010 +#define _cbw 0x011 +#define _cwde 0x012 +#define _clc 0x013 +#define _cld 0x014 +#define _cli 0x015 +#define _clts 0x016 +#define _cmc 0x017 +#define _cmp 0x018 +#define _cmps 0x019 +#define _cmpsb 0x01a +#define _cmpsw 0x01b +#define _cmpsd 0x01c +#define _cwd 0x01d +#define _cdq 0x01e +#define _daa 0x01f +#define _das 0x020 +#define _dec 0x021 +#define _div 0x022 +#define _enter 0x023 +#define _hlt 0x024 +#define _idiv 0x025 +#define _imul 0x026 +#define _in 0x027 +#define _inc 0x028 +#define _ins 0x029 +#define _insb 0x02a +#define _insw 0x02b +#define _insd 0x02c +#define _int 0x02d +#define _into 0x02e +#define _iret 0x02f +#define _iretd 0x030 +#define _jo 0x031 +#define _jno 0x032 +#define _jb 0x033 +#define _jnb 0x034 +#define _jz 0x035 +#define _jnz 0x036 +#define _jbe 0x037 +#define _jnbe 0x038 +#define _js 0x039 +#define _jns 0x03a +#define _jp 0x03b +#define _jnp 0x03c +#define _jl 0x03d +#define _jnl 0x03e +#define _jle 0x03f +#define _jnle 0x040 +#define _jmp 0x041 +#define _lahf 0x042 +#define _lar 0x043 +#define _lea 0x044 +#define _leave 0x045 +#define _lgdt 0x046 +#define _lidt 0x047 +#define _lgs 0x048 +#define _lss 0x049 +#define _lds 0x04a +#define _les 0x04b +#define _lfs 0x04c +#define _lldt 0x04d +#define _lmsw 0x04e +#define _lock 0x04f +#define _lods 0x050 +#define _lodsb 0x051 +#define _lodsw 0x052 +#define _lodsd 0x053 +#define _loop 0x054 +#define _loope 0x055 +#define _loopz 0x056 +#define _loopne 0x057 +#define _loopnz 0x058 +#define _lsl 0x059 +#define _ltr 0x05a +#define _mov 0x05b +#define _movs 0x05c +#define _movsb 0x05d +#define _movsw 0x05e +#define _movsd 0x05f +#define _movsx 0x060 +#define _movzx 0x061 +#define _mul 0x062 +#define _neg 0x063 +#define _nop 0x064 +#define _not 0x065 +#define _or 0x066 +#define _out 0x067 +#define _outs 0x068 +#define _outsb 0x069 +#define _outsw 0x06a +#define _outsd 0x06b +#define _pop 0x06c +#define _popa 0x06d +#define _popad 0x06e +#define _popf 0x06f +#define _popfd 0x070 +#define _push 0x071 +#define _pusha 0x072 +#define _pushad 0x073 +#define _pushf 0x074 +#define _pushfd 0x075 +#define _rcl 0x076 +#define _rcr 0x077 +#define _rol 0x078 +#define _ror 0x079 +#define _rep 0x07a +#define _repe 0x07b +#define _repz 0x07c +#define _repne 0x07d +#define _repnz 0x07e +#define _ret 0x07f +#define _sahf 0x080 +#define _sal 0x081 +#define _sar 0x082 +#define _shl 0x083 +#define _shr 0x084 +#define _sbb 0x085 +#define _scas 0x086 +#define _scasb 0x087 +#define _scasw 0x088 +#define _scasd 0x089 +#define _set 0x08a +#define _sgdt 0x08b +#define _sidt 0x08c +#define _shld 0x08d +#define _shrd 0x08e +#define _sldt 0x08f +#define _smsw 0x090 +#define _stc 0x091 +#define _std 0x092 +#define _sti 0x093 +#define _stos 0x094 +#define _stosb 0x095 +#define _stosw 0x096 +#define _stosd 0x097 +#define _str 0x098 +#define _sub 0x099 +#define _test 0x09a +#define _verr 0x09b +#define _verw 0x09c +#define _wait 0x09d +#define _xchg 0x09e +#define _xlat 0x09f +#define _xlatb 0x0a0 +#define _xor 0x0a1 +#define _jcxz 0x0a2 +#define _loadall 0x0a3 +#define _invd 0x0a4 +#define _wbinv 0x0a5 +#define _seto 0x0a6 +#define _setno 0x0a7 +#define _setb 0x0a8 +#define _setnb 0x0a9 +#define _setz 0x0aa +#define _setnz 0x0ab +#define _setbe 0x0ac +#define _setnbe 0x0ad +#define _sets 0x0ae +#define _setns 0x0af +#define _setp 0x0b0 +#define _setnp 0x0b1 +#define _setl 0x0b2 +#define _setnl 0x0b3 +#define _setle 0x0b4 +#define _setnle 0x0b5 +#define _wrmsr 0x0b6 +#define _rdtsc 0x0b7 +#define _rdmsr 0x0b8 +#define _cpuid 0x0b9 +#define _rsm 0x0ba +#define _cmpx 0x0bb +#define _xadd 0x0bc +#define _bswap 0x0bd +#define _invpg 0x0be +#define _cmpx8 0x0bf +#define _jmpf 0x0c0 +#define _retf 0x0c1 +#define _rdpmc 0x0c2 + +#define _f2xm1 0x001 +#define _fabs 0x002 +#define _fadd 0x003 +#define _faddp 0x004 +#define _fbld 0x005 +#define _fbstp 0x006 +#define _fchs 0x007 +#define _fclex 0x008 +#define _fcom 0x009 +#define _fcomp 0x00a +#define _fcompp 0x00b +#define _fcos 0x00c +#define _fdecstp 0x00d +#define _fdiv 0x00e +#define _fdivp 0x00f +#define _fdivr 0x010 +#define _fdivrp 0x011 +#define _ffree 0x012 +#define _fiadd 0x013 +#define _ficom 0x014 +#define _ficomp 0x015 +#define _fidiv 0x016 +#define _fidivr 0x017 +#define _fild 0x018 +#define _fimul 0x019 +#define _fincstp 0x01a +#define _finit 0x01b +#define _fist 0x01c +#define _fistp 0x01d +#define _fisub 0x01e +#define _fisubr 0x01f +#define _fld 0x020 +#define _fld1 0x021 +#define _fldcw 0x022 +#define _fldenv 0x023 +#define _fldl2e 0x024 +#define _fldl2t 0x025 +#define _fldlg2 0x026 +#define _fldln2 0x027 +#define _fldpi 0x028 +#define _fldz 0x029 +#define _fmul 0x02a +#define _fmulp 0x02b +#define _fnop 0x02c +#define _fpatan 0x02d +#define _fprem 0x02e +#define _fprem1 0x02f +#define _fptan 0x030 +#define _frndint 0x031 +#define _frstor 0x032 +#define _fsave 0x033 +#define _fscale 0x034 +#define _fsin 0x035 +#define _fsincos 0x036 +#define _fsqrt 0x037 +#define _fst 0x038 +#define _fstcw 0x039 +#define _fstenv 0x03a +#define _fstp 0x03b +#define _fstsw 0x03c +#define _fsub 0x03d +#define _fsubp 0x03e +#define _fsubr 0x03f +#define _fsubrp 0x040 +#define _ftst 0x041 +#define _fucom 0x042 +#define _fucomp 0x043 +#define _fucompp 0x044 +#define _fxam 0x045 +#define _fxch 0x046 +#define _fxtract 0x047 +#define _fyl2x 0x048 +#define _fyl2xp1 0x049 + +/****************************************************************************** +* +* External data and strings +* +******************************************************************************/ +extern char* sNames[]; +extern char* sCoprocNames[]; +extern TOpcodeData Op1[ 256 ]; +extern TOpcodeData Op2[ 256 ]; +extern TOpcodeData Groups[ 17 ][ 8 ]; +extern TOpcodeData Coproc1[ 8 ][ 8 ]; +extern TOpcodeData Coproc2[ 8 ][ 16 * 4 ]; +extern char *sBytePtr; +extern char *sWordPtr; +extern char *sDwordPtr; +extern char *sFwordPtr; +extern char *sQwordPtr; +extern char *sGenReg16_32[ 2 ][ 8 ]; +extern char *sSeg[ 8 ]; +extern char *sSegOverride[ 8 ]; +extern char *sSegOverrideDefaultES[ 8 ]; +extern char *sSegOverrideDefaultDS[ 8 ]; +extern char *sScale[ 4 ]; +extern char *sAdr1[ 2 ][ 8 ]; +extern char *sRegs1[ 2 ][ 2 ][ 8 ]; +extern char *sRegs2[]; +extern char *sControl[ 8 ]; +extern char *sDebug[ 8 ]; +extern char *sTest[ 8 ]; +extern char *sYptr[ 2 ]; +extern char *sXptr[ 2 ]; +extern char *sRep[ 4 ]; +extern char *sST[ 9 ]; + + +#endif // _DDEF_H_ diff --git a/rosapps/sysutils/utils/pice/module/gpfault.c b/rosapps/sysutils/utils/pice/module/gpfault.c new file mode 100644 index 00000000000..34e156eb0b2 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/gpfault.c @@ -0,0 +1,142 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + GPFault.c + +Abstract: + + handle general protection faults on x86 + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 13-Nov-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//////////////////////////////////////////////////// +// GLOBALS +//// +ULONG OldGPFaultHandler = 0; + +char tempGP[1024]; + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// NewGPFaultHandler() +// +//************************************************************************* +void HandleGPFault(FRAME* ptr) +{ + DPRINT((0,"HandleGPFault(): ptr = %x at eip: %x\n",ptr, ptr->eip)); +} + +//************************************************************************* +// NewGPFaultHandler() +// +//************************************************************************* +__asm__ ("\n\t \ + NewGPFaultHandler:\n\t \ + pushfl\n\t \ + cli\n\t \ + cld\n\t \ + pushal\n\t \ + pushl %ds\n\t \ +\n\t \ + // test for v86 mode\n\t \ + testl $0x20000,40(%esp)\n\t \ + jnz notv86\n\t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ + .byte 0x2e\n\t \ + jmp *_OldGPFaultHandler\n\t \ + notv86:\n\t \ + // setup default data selectors\n\t \ + movw %ss,%ax\n\t \ + movw %ax,%ds\n\t \ +\n\t \ + // get frame ptr\n\t \ + lea 40(%esp),%eax\n\t \ + pushl %eax\n\t \ + call _HandleGPFault\n\t \ + addl $4,%esp\n\t \ +\n \t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ + // remove error code from stack and replace with reason code\n\t \ + movl $" STR(REASON_GP_FAULT) ",(%esp)\n\t \ + // call debugger loop\n\t \ + jmp NewInt31Handler\n\t \ + "); + +//************************************************************************* +// InstallGPFaultHook() +// +//************************************************************************* +void InstallGPFaultHook(void) +{ + ULONG LocalGPFaultHandler; + + ENTER_FUNC(); + + MaskIrqs(); + if(!OldGPFaultHandler) + { + __asm__("mov $NewGPFaultHandler,%0" + :"=r" (LocalGPFaultHandler) + : + :"eax"); + OldGPFaultHandler=SetGlobalInt(0x0D,(ULONG)LocalGPFaultHandler); + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} + +//************************************************************************* +// DeInstallGPFaultHook() +// +//************************************************************************* +void DeInstallGPFaultHook(void) +{ + ENTER_FUNC(); + + MaskIrqs(); + if(OldGPFaultHandler) + { + RemoveAllSWBreakpoints(TRUE); + SetGlobalInt(0x0D,(ULONG)OldGPFaultHandler); + OldGPFaultHandler=0; + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} + +// EOF diff --git a/rosapps/sysutils/utils/pice/module/gpfault.h b/rosapps/sysutils/utils/pice/module/gpfault.h new file mode 100644 index 00000000000..76879a6df24 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/gpfault.h @@ -0,0 +1,34 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + gpfault.h + +Abstract: + + HEADER for gpfault.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void InstallGPFaultHook(void); +void DeInstallGPFaultHook(void); + +extern ULONG OldGPFaultHandler; diff --git a/rosapps/sysutils/utils/pice/module/hardware.c b/rosapps/sysutils/utils/pice/module/hardware.c new file mode 100644 index 00000000000..0a067fd5a5b --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/hardware.c @@ -0,0 +1,1042 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + hardware.c + +Abstract: + + output to console + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 04-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//////////////////////////////////////////////////// +// PROTOTYPES +//// + +//////////////////////////////////////////////////// +// DEFINES +//// + +//////////////////////////////////////////////////// +// GLOBALS +//// + +// flagging stuff +BOOLEAN bCursorEnabled = FALSE; +BOOLEAN bConsoleIsInitialized = FALSE; + + +// terminal emulation +ETERMINALMODE eTerminalMode = TERMINAL_MODE_NONE; + +// window stuff +WINDOW wWindow[4]; + +// screen parameter +ULONG GLOBAL_SCREEN_WIDTH,GLOBAL_SCREEN_HEIGHT; + +// jump table to real output functions +OUTPUT_HANDLERS ohandlers; +INPUT_HANDLERS ihandlers; + +// ring buffer stuff +ULONG ulInPos = 0,ulLastPos = 0; +ULONG ulOldInPos = 0,ulOldDelta = 0; +BOOLEAN bSuspendPrintRingBuffer = FALSE; + +char aBuffers[LINES_IN_BUFFER][1024]; + +// output lock +ULONG ulOutputLock; + +// color of windows pane separation bars +USHORT usCaptionColor = BLUE; +USHORT usCaptionText = WHITE; +USHORT usForegroundColor = LTGRAY; +USHORT usBackgroundColor = BLACK; +USHORT usHiLiteColor = WHITE; + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// SuspendPrintRingBuffer() +// +//************************************************************************* +void SuspendPrintRingBuffer(BOOLEAN bSuspend) +{ + ENTER_FUNC(); + bSuspendPrintRingBuffer = bSuspend; + LEAVE_FUNC(); +} + +//************************************************************************* +// EmptyRingBuffer() +// +//************************************************************************* +void EmptyRingBuffer(void) +{ + //ENTER_FUNC(); + ulLastPos = ulInPos = ulOldInPos = ulOldDelta = 0; + PICE_memset(aBuffers,0,sizeof(aBuffers)); + //LEAVE_FUNC(); +} + +//************************************************************************* +// LinesInRingBuffer() +// +//************************************************************************* +ULONG LinesInRingBuffer(void) +{ + ULONG ulResult; + +// ENTER_FUNC(); + + ulResult = (ulInPos-ulLastPos)%LINES_IN_BUFFER; + +// LEAVE_FUNC(); + + return ulResult; +} + +//************************************************************************* +// CheckRingBuffer() +// +//************************************************************************* +void CheckRingBuffer(void) +{ +// ENTER_FUNC(); + + Acquire_Output_Lock(); + + if(ulInPos != ulOldInPos ) + { + ulOldInPos = ulInPos; + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + } + + Release_Output_Lock(); + +// LEAVE_FUNC(); +} + +//************************************************************************* +// AddToRingBuffer() +// +//************************************************************************* +BOOLEAN AddToRingBuffer(LPSTR p) +{ + ULONG i,j,len; + BOOLEAN bHadReturn = FALSE; + char temp[sizeof(aBuffers[0])]; + +// ENTER_FUNC(); + + // size of current string + j=PICE_strlen(aBuffers[ulInPos]); + + // start with ':' and current has ':' in front + if(aBuffers[ulInPos][0]==':' && *p==':') + { + if(j==1) + { + //LEAVE_FUNC(); + return FALSE; + } + aBuffers[ulInPos][j++]='\n'; + aBuffers[ulInPos][j]=0; + ulInPos = (ulInPos+1)%LINES_IN_BUFFER; + // wrap around + if(ulInPos == ulLastPos) + { + ulLastPos = (ulLastPos+1)%LINES_IN_BUFFER; + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + } + // reset to start of buffer + j = 0; + } + // it's an internal print ("pICE: ...") + else if(aBuffers[ulInPos][0]==':' && PICE_strncmpi(p,"pICE:",5)==0) + { + if(j==1) + { + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + } + else + { + aBuffers[ulInPos][j++]='\n'; + aBuffers[ulInPos][j]=0; + ulInPos = (ulInPos+1)%LINES_IN_BUFFER; + // wrap around + if(ulInPos == ulLastPos) + { + ulLastPos = (ulLastPos+1)%LINES_IN_BUFFER; + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + } + } + // reset to start of buffer + j = 0; + } + // it's a debug print and the current line is starting with ':' + else if(aBuffers[ulInPos][0]==':' && + ( (*p=='<' && PICE_isdigit(*(p+1)) && *(p+2)=='>') || bIsDebugPrint) ) + { + if(j==1) + { + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + } + else + { + aBuffers[ulInPos][j++]='\n'; + aBuffers[ulInPos][j]=0; + ulInPos = (ulInPos+1)%LINES_IN_BUFFER; + // wrap around + if(ulInPos == ulLastPos) + { + ulLastPos = (ulLastPos+1)%LINES_IN_BUFFER; + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + } + } + // reset to start of buffer + j = 0; + } + // it's a debug print + else if(( (*p=='<' && PICE_isdigit(*(p+1)) && *(p+2)=='>') || bIsDebugPrint) ) + { + p += 3; + } + + // size of new string + len=PICE_strlen(p); + + // if combined string length too big + // reduce to maximum + if( (len+j) > sizeof(aBuffers[0])-2 ) + { + PICE_memcpy(temp,p,sizeof(aBuffers[0])-2); + p = temp; + // assume we end in NEWLINE + p[sizeof(aBuffers[0])-2]='\n'; + p[sizeof(aBuffers[0])-1]=0; + } + + for(i=0;p[i]!=0;i++) + { + // newline + if(p[i]=='\n') + { + aBuffers[ulInPos][j++]='\n'; + aBuffers[ulInPos][j]=0; + ulInPos = (ulInPos+1)%LINES_IN_BUFFER; + // wrap around + if(ulInPos == ulLastPos) + { + ulLastPos = (ulLastPos+1)%LINES_IN_BUFFER; + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + } + // reset to start of buffer + j = 0; + // notify that we had a NEWLINE + bHadReturn = TRUE; + } + // backspace + else if(p[i]=='\b') + { + if(j!=0) + { + j--; + aBuffers[ulInPos][j] = 0; + } + } + // TAB + else if(p[i]=='\t') + { + // copy TAB + aBuffers[ulInPos][j++] = p[i]; + } + else + { + if((UCHAR)p[i]<0x20 && (UCHAR)p[i]>0x7f) + p[i]=0x20; + + aBuffers[ulInPos][j++] = p[i]; + } + } +// LEAVE_FUNC(); + + return bHadReturn; +} + +//************************************************************************* +// ReplaceRingBufferCurrent() +// +//************************************************************************* +void ReplaceRingBufferCurrent(LPSTR s) +{ +// ENTER_FUNC(); + + PICE_memset(aBuffers[ulInPos],0,sizeof(aBuffers[0])); + PICE_strcpy(aBuffers[ulInPos],s); + +// LEAVE_FUNC(); +} + +//************************************************************************* +// PrintRingBuffer() +// +//************************************************************************* +void PrintRingBuffer(ULONG ulLines) +{ + ULONG ulDelta = LinesInRingBuffer(); + ULONG ulOutPos,i=0; + +// ENTER_FUNC(); + + if(bSuspendPrintRingBuffer) + { + DPRINT((0,"PrintRingBuffer(): suspended\n")); + LEAVE_FUNC(); + return; + } + + if(!ulDelta) + { + DPRINT((0,"PrintRingBuffer(): no lines in ring buffer\n")); + LEAVE_FUNC(); + return; + } + + if(ulDelta=0x20 && (UCHAR)p[i]<0x80) + { + PrintGraf(x+i,y,p[i]); + } + } + + Flush(); + + Release_Output_Lock(); + +// LEAVE_FUNC(); +} + +//************************************************************************* +// CopyLineTo() +// +// copy a line from src to dest +//************************************************************************* +void CopyLineTo(USHORT dest,USHORT src) +{ + ohandlers.CopyLineTo(dest,src); +} + +//************************************************************************* +// InvertLine() +// +// invert a line on the screen +//************************************************************************* +void InvertLine(ULONG line) +{ + ohandlers.InvertLine(line); +} + +//************************************************************************* +// HatchLine() +// +// hatches a line on the screen +//************************************************************************* +void HatchLine(ULONG line) +{ + ohandlers.HatchLine(line); +} + +//************************************************************************* +// ClrLine() +// +// clear a line on the screen +//************************************************************************* +void ClrLine(ULONG line) +{ + ohandlers.ClrLine(line); +} + +//************************************************************************* +// ScrollUp() +// +// Scroll a specific window up one line +//************************************************************************* +void ScrollUp(USHORT Window) +{ + USHORT i; + + return; + + if(!wWindow[Window].bScrollDisabled) + { + for(i=1;i (GLOBAL_SCREEN_WIDTH-1)) + bOutput = FALSE; + + // newline + if(p[i]=='\n') + { + wWindow[Window].usCurX = 0; + wWindow[Window].usCurY++; + if(wWindow[Window].usCurY>=wWindow[Window].cy) + { + wWindow[Window].usCurY=wWindow[Window].cy-1; + ScrollUp(Window); + } + if(wWindow[Window].bScrollDisabled==TRUE)break; + } + // backspace + else if(p[i]=='\b') + { + if(wWindow[Window].usCurX>0) + { + wWindow[Window].usCurX--; + if(bOutput) + PrintGraf(wWindow[Window].usCurX,wWindow[Window].y+wWindow[Window].usCurY,0x20); + } + + } + // TAB + else if(p[i]=='\t') + { + if((wWindow[Window].usCurX + 4) < (GLOBAL_SCREEN_WIDTH-1)) + { + wWindow[Window].usCurX += 4; + } + } + else + { + if((UCHAR)p[i]<0x20 && (UCHAR)p[i]>0x7f) + p[i]=0x20; + + if(bOutput) + PrintGraf(wWindow[Window].usCurX,wWindow[Window].y+wWindow[Window].usCurY,p[i]); + + wWindow[Window].usCurX++; + } + } + + // flush + Flush(); + } + //LEAVE_FUNC(); +} + + +//************************************************************************* +// SaveGraphicsState() +// +//************************************************************************* +void SaveGraphicsState(void) +{ + ohandlers.SaveGraphicsState(); +} + +//************************************************************************* +// RestoreGraphicsState() +// +//************************************************************************* +void RestoreGraphicsState(void) +{ + ohandlers.RestoreGraphicsState(); +} + +//************************************************************************* +// SetWindowGeometry() +// +//************************************************************************* +void SetWindowGeometry(PVOID pWindow) +{ + PICE_memcpy(wWindow,pWindow,sizeof(wWindow)); +} + +// INPUT handlers + +//************************************************************************* +// GetKeyPolled() +// +//************************************************************************* +UCHAR GetKeyPolled(void) +{ + return ihandlers.GetKeyPolled(); +} + +//************************************************************************* +// FlushKeyboardQueue() +// +//************************************************************************* +void FlushKeyboardQueue(void) +{ + ihandlers.FlushKeyboardQueue(); +} + + +//************************************************************************* +// ConsoleInit() +// +// init terminal screen +//************************************************************************* +BOOLEAN ConsoleInit(void) +{ + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + + // preset ohandlers and ihandler to NULL + PICE_memset((void*)&ohandlers,0,sizeof(ohandlers)); + PICE_memset((void*)&ihandlers,0,sizeof(ihandlers)); + + switch(eTerminalMode) + { + case TERMINAL_MODE_HERCULES_GRAPHICS: + bResult = ConsoleInitHercules(); + break; + case TERMINAL_MODE_HERCULES_TEXT: + break; + case TERMINAL_MODE_VGA_TEXT: + bResult = ConsoleInitVga(); + break; + case TERMINAL_MODE_SERIAL: + bResult = ConsoleInitSerial(); + break; + case TERMINAL_MODE_NONE: + default: + // fail + break; + } + + // check that outputhandlers have all been set + // ohandlers.Flush may be zero on return + if( !ohandlers.ClrLine || + !ohandlers.CopyLineTo || + !ohandlers.HatchLine || + !ohandlers.HideCursor || + !ohandlers.InvertLine || + !ohandlers.PrintCursor || + !ohandlers.PrintGraf || + !ohandlers.PrintLogo || + !ohandlers.RestoreGraphicsState || + !ohandlers.SaveGraphicsState || + !ohandlers.SetBackgroundColor || + !ohandlers.SetForegroundColor || + !ohandlers.ShowCursor) + { + bResult = FALSE; + } + + // check that inputhandlers were installed + if( !ihandlers.GetKeyPolled || + !ihandlers.FlushKeyboardQueue) + { + bResult = FALSE; + } + + LEAVE_FUNC(); + + bConsoleIsInitialized = bResult; + + return bResult; +} + +//************************************************************************* +// ConsoleShutdown() +// +// exit terminal screen +//************************************************************************* +void ConsoleShutdown(void) +{ + ENTER_FUNC(); + + // sleep for a few seconds + KeStallExecutionProcessor(1000*5000); + + switch(eTerminalMode) + { + case TERMINAL_MODE_HERCULES_GRAPHICS: + ConsoleShutdownHercules(); + break; + case TERMINAL_MODE_HERCULES_TEXT: + break; + case TERMINAL_MODE_VGA_TEXT: + ConsoleShutdownVga(); + break; + case TERMINAL_MODE_SERIAL: + ConsoleShutdownSerial(); + break; + case TERMINAL_MODE_NONE: + default: + // fail + break; + } + + LEAVE_FUNC(); +} + +// EOF diff --git a/rosapps/sysutils/utils/pice/module/hardware.h b/rosapps/sysutils/utils/pice/module/hardware.h new file mode 100644 index 00000000000..e2e1b3fbfa5 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/hardware.h @@ -0,0 +1,166 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + hardwar.h + +Abstract: + + HEADER for hardware.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +typedef struct tagWindow +{ + USHORT y,cy; + USHORT usCurX,usCurY; + BOOLEAN bScrollDisabled; +}WINDOW,*PWINDOW; + +// pointer indirection table for output functions +typedef struct _OUTPUT_HANDLERS +{ + void (*CopyLineTo) (USHORT dest,USHORT src); + void (*PrintGraf) (ULONG x,ULONG y,UCHAR c); + void (*Flush) (void); + void (*ClrLine) (ULONG line); + void (*InvertLine) (ULONG line); + void (*HatchLine) (ULONG line); + void (*PrintLogo) (BOOLEAN bShow); + void (*PrintCursor) (BOOLEAN bForce); + void (*SaveGraphicsState) (void); + void (*RestoreGraphicsState) (void); + void (*ShowCursor) (void); + void (*HideCursor) (void); + void (*SetForegroundColor) (ECOLORS); + void (*SetBackgroundColor) (ECOLORS); +}OUTPUT_HANDLERS,*POUTPUT_HANDLERS; + +// pointer indirection table for input functions +typedef struct _INPUT_HANDLERS +{ + UCHAR (*GetKeyPolled) (void); + void (*FlushKeyboardQueue) (void); +}INPUT_HANDLERS,*PINPUT_HANDLERS; + +extern OUTPUT_HANDLERS ohandlers; +extern INPUT_HANDLERS ihandlers; + +enum +{ + REGISTER_WINDOW = 0 , + DATA_WINDOW , + SOURCE_WINDOW , + OUTPUT_WINDOW , + OUTPUT_WINDOW_UNBUFFERED +}; + +typedef enum _ETERMINALMODE +{ + TERMINAL_MODE_HERCULES_GRAPHICS = 0 , + TERMINAL_MODE_HERCULES_TEXT, + TERMINAL_MODE_VGA_TEXT, + TERMINAL_MODE_SERIAL, + TERMINAL_MODE_NONE +}ETERMINALMODE; + +extern ETERMINALMODE eTerminalMode; + +extern WINDOW wWindow[]; +extern BOOLEAN bRev; +extern BOOLEAN bGrayed; +extern BOOLEAN bCursorEnabled; + +// install and remove handler +BOOLEAN ConsoleInit(void); +void ConsoleShutdown(void); + +// OUTPUT handler +void Print(USHORT Window,LPSTR p); +void SetBackgroundColor(ECOLORS c); +void SetForegroundColor(ECOLORS c); +void Clear(USHORT window); +void PutChar(LPSTR p,ULONG x,ULONG y); +void ClrLine(ULONG line); +void ShowCursor(void); +void HideCursor(void); +void EnableScroll(USHORT Window); +void DisableScroll(USHORT Window); +void CopyLineTo(USHORT dest,USHORT src); +void PrintLogo(BOOLEAN bShow); +void PrintCursor(BOOLEAN bForce); +void PrintGraf(ULONG x,ULONG y,UCHAR c); +void ScrollUp(USHORT Window); +void Home(USHORT Window); +void InvertLine(ULONG line); +void FillLine(ULONG line,UCHAR c); +void PrintTemplate(void); +void PrintCaption(void); +void ClrLineToEnd(USHORT Window,ULONG line,ULONG x); +void SuspendPrintRingBuffer(BOOLEAN bSuspend); +void HatchLine(ULONG line); +void SaveGraphicsState(void); +void RestoreGraphicsState(void); +void SetWindowGeometry(PVOID pWindow); + +// INPUT handler +UCHAR GetKeyPolled(void); +void FlushKeyboardQueue(void); + + +BOOLEAN PrintRingBufferOffset(ULONG ulLines,ULONG ulOffset); +BOOLEAN PrintRingBufferHome(ULONG ulLines); +void PrintRingBuffer(ULONG ulLines); +ULONG LinesInRingBuffer(void); +void ReplaceRingBufferCurrent(LPSTR s); +void EmptyRingBuffer(void); +void CheckRingBuffer(void); +BOOLEAN AddToRingBuffer(LPSTR p); +void ResetColor(void); + +extern ULONG GLOBAL_SCREEN_WIDTH; +extern ULONG GLOBAL_SCREEN_HEIGHT; + +extern ULONG ulOutputLock; + +#define Acquire_Output_Lock() \ +{ \ + save_flags(ulOutputLock); \ + cli(); \ +} + +#define Release_Output_Lock() \ + restore_flags(ulOutputLock); + +#define NOT_IMPLEMENTED() + +extern USHORT usCaptionColor; +#define COLOR_CAPTION usCaptionColor +extern USHORT usCaptionText; +#define COLOR_TEXT usCaptionText +extern USHORT usForegroundColor; +#define COLOR_FOREGROUND usForegroundColor +extern USHORT usBackgroundColor; + +#undef COLOR_BACKGROUND +#define COLOR_BACKGROUND usBackgroundColor +extern USHORT usHiLiteColor; +#define COLOR_HILITE usHiLiteColor diff --git a/rosapps/sysutils/utils/pice/module/hercules.c b/rosapps/sysutils/utils/pice/module/hercules.c new file mode 100644 index 00000000000..045f89eee11 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/hercules.c @@ -0,0 +1,486 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + hercules.c + +Abstract: + + HW dependent draw routines + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 04-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +#include "charset.h" +#include "logo.h" + +//////////////////////////////////////////////////// +// PROTOTYPES +//// + +//////////////////////////////////////////////////// +// DEFINES +//// + +//////////////////////////////////////////////////// +// GLOBALS +//// +// cursor state +BOOLEAN bRev=FALSE; + +// HERCULES graphics adapter stuff +// 43 line graphics mode +UCHAR MGATable43[]={53,45,46, 7,96, 2,91,91, 2, 3, 0, 0, 0, 0, 0, 0}; + +PUCHAR pVgaOffset[4]; +// END of HERCULES graphics adapter stuff + +// used for HERCULES graphics mode +WINDOW wWindowHercGraph[4]= +{ + {1,3,1,0,FALSE}, + {5,6,1,0,FALSE}, + {12,19,1,0,FALSE}, + {32,12,1,0,FALSE} +}; +// used for HERCUELS text and VGA text mode +WINDOW wWindowHerc[4]= +{ + {1,3,1,0,FALSE}, + {5,4,1,0,FALSE}, + {10,9,1,0,FALSE}, + {20,4,1,0,FALSE} +}; + +PUCHAR pScreenBufferHercules; + +struct _attr +{ + union + { + struct + { + + UCHAR fgcol : 4; + UCHAR bkcol : 3; + UCHAR blink : 1; + }bits; + UCHAR Asuchar; + }u; +}attr; + +//************************************************************************* +// SetForegroundColorVga() +// +//************************************************************************* +void SetForegroundColorHercules(ECOLORS col) +{ + attr.u.bits.fgcol = col; + attr.u.bits.blink = 0; +} + +//************************************************************************* +// SetBackgroundColorVga() +// +//************************************************************************* +void SetBackgroundColorHercules(ECOLORS col) +{ + attr.u.bits.bkcol = col; + attr.u.bits.blink = 0; +} + +//************************************************************************* +// PrintGrafHercules() +// +//************************************************************************* +void PrintGrafHercules(ULONG x,ULONG y,UCHAR c) +{ + ULONG i; + PUCHAR p; + ULONG _line = y<<3; + + if(!pScreenBufferHercules) + return; + + p=&cGraphTable[(ULONG)c<<3]; + + if((attr.u.bits.bkcol == COLOR_FOREGROUND && attr.u.bits.fgcol == COLOR_BACKGROUND) || + (attr.u.bits.bkcol == COLOR_CAPTION && attr.u.bits.fgcol == COLOR_TEXT) ) + for(i=0 ;i<8 ;i++,_line++) + { + *(PUCHAR)(pVgaOffset[_line & 0x3] + ( 90* (_line >> 2) ) + x) = ~*p++; + } + else + for(i=0 ;i<8 ;i++,_line++) + { + *(PUCHAR)(pVgaOffset[_line & 0x3] + ( 90* (_line >> 2) ) + x) = *p++; + } +} + + +//************************************************************************* +// FlushHercules() +// +//************************************************************************* +void FlushHercules(void) +{ +} + +//************************************************************************* +// ShowCursor() +// +// show hardware cursor +//************************************************************************* +void ShowCursorHercules(void) +{ + ENTER_FUNC(); + + bCursorEnabled=TRUE; + + LEAVE_FUNC(); +} + +//************************************************************************* +// HideCursorHercules() +// +// hide hardware cursor +//************************************************************************* +void HideCursorHercules(void) +{ + ENTER_FUNC(); + + bCursorEnabled=FALSE; + + LEAVE_FUNC(); +} + +//************************************************************************* +// CopyLineTo() +// +// copy a line from src to dest +//************************************************************************* +void CopyLineToHercules(USHORT dest,USHORT src) +{ + USHORT i,j; + PULONG pDest,pSrc; + + ENTER_FUNC(); + + dest <<= 3; + src <<= 3; + for(i=0;i<8;i++) + { + (PUCHAR)pDest = (PUCHAR)pScreenBufferHercules + ( ( ( dest+i )&3) <<13 )+ 90 * ((dest+i) >> 2); + (PUCHAR)pSrc = (PUCHAR)pScreenBufferHercules + ( ( ( src+i )&3) <<13 )+ 90 * ((src+i) >> 2); + for(j=0;j<(GLOBAL_SCREEN_WIDTH>>2);j++) + { + *pDest++=*pSrc++; + } + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// InvertLineHercules() +// +// invert a line on the screen +//************************************************************************* +void InvertLineHercules(ULONG line) +{ + ULONG i,j; + ULONG _line = line<<3; + PUSHORT p; + + //ENTER_FUNC(); + + for(j=0;j<8;j++) + { + p=(PUSHORT)( pVgaOffset[_line&3] + (90*(_line>>2)) ); + for(i=0;i<(GLOBAL_SCREEN_WIDTH>>1);i++) + { + p[i]=~p[i]; + } + _line++; + } + + //LEAVE_FUNC(); +} + +//************************************************************************* +// HatchLineHercules() +// +// hatches a line on the screen +//************************************************************************* +void HatchLineHercules(ULONG line) +{ + USHORT cc; + ULONG i,j; + ULONG _line = (line<<3) ; + PUSHORT p; + USHORT mask_odd[]={0x8888,0x2222}; + USHORT mask_even[]={0xaaaa,0x5555}; + PUSHORT pmask; + + ENTER_FUNC(); + + pmask = (line&1)?mask_odd:mask_even; + + for(j=0;j<8;j++,_line++) + { + p=(PUSHORT)( pVgaOffset[_line&3] + (90*(_line>>2)) ); + for(i=0;i<(GLOBAL_SCREEN_WIDTH/sizeof(USHORT));i++) + { + cc = p[i]; + + p[i]=(p[i]^pmask[j&1])|cc; + } + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// ClrLineHercules() +// +// clear a line on the screen +//************************************************************************* +void ClrLineHercules(ULONG line) +{ + ULONG j; + BOOLEAN bTemplateLine=( (USHORT)line==wWindow[DATA_WINDOW].y-1 || + (USHORT)line==wWindow[SOURCE_WINDOW].y-1 || + (USHORT)line==wWindow[OUTPUT_WINDOW].y-1 || + 0); + ULONG _line = line<<3; + ULONG cc=0; + PUCHAR p; + +// ENTER_FUNC(); + + if(line > GLOBAL_SCREEN_HEIGHT ) + { + DPRINT((0,"ClrLineHercules(): line %u is out of screen\n",line)); + //LEAVE_FUNC(); + return; + } + + if(attr.u.bits.bkcol == COLOR_CAPTION && attr.u.bits.fgcol == COLOR_TEXT ) + cc=~cc; + + if(bTemplateLine) + { + for(j=0;j<8;j++,_line++) + { + p = (PUCHAR)(pVgaOffset[_line&3] + (90*(_line>>2)) ); + +/* + if(j==2 || j==5)cc=0xFF; + else if(j==3)cc=0xaa; + else if(j==4)cc=0x55; + else cc = 0;*/ + if(j==2 || j==5)cc=0xFF; + else cc = 0; + + PICE_memset(p,(UCHAR)cc,GLOBAL_SCREEN_WIDTH); + } + } + else + { + for(j=0;j<8;j++,_line++) + { + p = (PUCHAR)(pVgaOffset[_line&3] + (90*(_line>>2)) ); + + PICE_memset(p,(UCHAR)cc,GLOBAL_SCREEN_WIDTH); + } + } + //LEAVE_FUNC(); +} + +//************************************************************************* +// PrintLogoHercules() +// +//************************************************************************* +void PrintLogoHercules(BOOLEAN bShow) +{ + LONG x,y; + PUCHAR p; + + p=(PUCHAR)pScreenBufferHercules; + for(y=0;y<24;y++) + { + for(x=0;x<8;x++) + { + p[ ( 0x2000* (( y + 8 ) & 0x3) )+ + ( 90* ( (y + 8 ) >> 2) )+ + (81+x)] = cLogo[y*8+x]; + } + } +} + +//************************************************************************* +// PrintCursorHercules() +// +// emulate a blinking cursor block +//************************************************************************* +void PrintCursorHercules(BOOLEAN bForce) +{ + static ULONG count=0; + + if( (bForce) || ((count++>100) && bCursorEnabled) ) + { + ULONG i; + ULONG x,y; + ULONG _line; + + x=wWindow[OUTPUT_WINDOW].usCurX; + y=wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].usCurY; + + _line = y<<3; + for(i=0;i<8;i++,_line++) + { + *(PUCHAR)(pVgaOffset[_line & 0x3] + ( 90* (_line >> 2) ) + x) ^= 0xFF ; + } + bRev=!bRev; + count=0; + } + + KeStallExecutionProcessor(2500); +} + +//************************************************************************* +// SaveGraphicsHercules() +// +//************************************************************************* +void SaveGraphicsStateHercules(void) +{ + // not implemented +} + +//************************************************************************* +// RestoreGraphicsStateHercules() +// +//************************************************************************* +void RestoreGraphicsStateHercules(void) +{ + // not implemented +} + +//************************************************************************* +// ConsoleInitHercules() +// +// init terminal screen +//************************************************************************* +BOOLEAN ConsoleInitHercules(void) +{ + BOOLEAN bResult = FALSE; + PUCHAR pMGATable = MGATable43; + UCHAR i,reg,data; + PHYSICAL_ADDRESS FrameBuffer; + + ENTER_FUNC(); + + ohandlers.CopyLineTo = CopyLineToHercules; + ohandlers.PrintGraf = PrintGrafHercules; + ohandlers.Flush = FlushHercules; + ohandlers.ClrLine = ClrLineHercules; + ohandlers.InvertLine = InvertLineHercules; + ohandlers.HatchLine = HatchLineHercules; + ohandlers.PrintLogo = PrintLogoHercules; + ohandlers.PrintCursor = PrintCursorHercules; + ohandlers.SaveGraphicsState = SaveGraphicsStateHercules; + ohandlers.RestoreGraphicsState = RestoreGraphicsStateHercules; + ohandlers.ShowCursor = ShowCursorHercules; + ohandlers.HideCursor = HideCursorHercules; + ohandlers.SetForegroundColor = SetForegroundColorHercules; + ohandlers.SetBackgroundColor = SetBackgroundColorHercules; + + ihandlers.GetKeyPolled = KeyboardGetKeyPolled; + ihandlers.FlushKeyboardQueue = KeyboardFlushKeyboardQueue; + + // init HERCULES adapter + outb_p(0,0x3b8); + outb_p(0x03,0x3bf); + for(i=0;i>16)&0x0000FFFF)))+dwInt; + + oldidt=*pidt; + + // set new handler address + pidt->HiOffset=(USHORT)(((ULONG)NewIntHandler)>>16); + pidt->LoOffset=(USHORT)(((ULONG)NewIntHandler)&0x0000FFFF); + + DPRINT((0,"new INT(%0.2x) handler = %0.4x:%x\n",dwInt,pidt->SegSel,(pidt->HiOffset<<16)|(pidt->LoOffset&0x0000FFFF))); + + OldIntHandler=(oldidt.HiOffset<<16)|(oldidt.LoOffset&0x0000FFFF); + + DPRINT((0,"old INT(%0.2x) handler = %0.4x:%x\n",dwInt,pidt->SegSel,OldIntHandler)); + + LEAVE_FUNC(); + + return OldIntHandler; +} + +//************************************************************************* +// TakeIdtSnapshot() +// +//************************************************************************* +void TakeIdtSnapshot(void) +{ + ULONG idt[2],i; + struct IdtEntry* pidt; + + __asm__("sidt %0":"=m" (idt)); + + // get pointer to idte for int 3 + pidt=((struct IdtEntry*)((idt[1]<<16)|((idt[0]>>16)&0x0000FFFF))); + + for(i=0;i<256;i++) + { + DPRINT((11,"TakeIdtSnapShot(): saving vector %u\n",i)); + if(IsRangeValid((ULONG)pidt,sizeof(*pidt)) ) + { + DPRINT((11,"TakeIdtSnapShot(): vector %u valid\n",i)); + idt_snapshot[i] = *pidt++; + } + } +} + +//************************************************************************* +// RestoreIdt() +// +//************************************************************************* +void RestoreIdt(void) +{ + ULONG idt[2],i; + struct IdtEntry* pidt; + + __asm__("sidt %0":"=m" (idt)); + + // get pointer to idte for int 3 + pidt=((struct IdtEntry*)((idt[1]<<16)|((idt[0]>>16)&0x0000FFFF))); + + for(i=0;i<256;i++) + { + DPRINT((11,"TakeIdtSnapShot(): restoring vector %u\n",i)); + if(IsRangeValid((ULONG)pidt,sizeof(*pidt)) ) + { + DPRINT((11,"TakeIdtSnapShot(): vector %u valid\n",i)); + *pidt++ = idt_snapshot[i]; + } + } +} + +// EOF diff --git a/rosapps/sysutils/utils/pice/module/hooks.h b/rosapps/sysutils/utils/pice/module/hooks.h new file mode 100644 index 00000000000..91210bafaf8 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/hooks.h @@ -0,0 +1,49 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + hooks.h + +Abstract: + + HEADER for hooks.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void DeinstallHooks(void); +//ULONG HookInt(ULONG dwInt,ULONG NewIntHandler); +//void UnhookInt(ULONG dwInt); +void MaskIrqs(void); +void UnmaskIrqs(void); +ULONG SetGlobalInt(ULONG dwInt,ULONG NewIntHandler); +ULONG GetIRQVector(ULONG dwInt); +void TakeIdtSnapshot(void); +void RestoreIdt(void); + +// structure of an IDT entry +typedef struct IdtEntry +{ + USHORT LoOffset; + USHORT SegSel; + USHORT Flags; + USHORT HiOffset; +}IDTENTRY,*PIDTENTRY; + diff --git a/rosapps/sysutils/utils/pice/module/init.c b/rosapps/sysutils/utils/pice/module/init.c new file mode 100644 index 00000000000..f3ba200b0b5 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/init.c @@ -0,0 +1,379 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + init.c + +Abstract: + + initialisation and cleanup of debugger kernel module + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 25-Jan-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//////////////////////////////////////////////////// +// GLOBALS +ULONG ulDoInitialBreak=1; +char szBootParams[1024]=""; +char tempInit[256]; + +PDIRECTORY_OBJECT *pNameSpaceRoot = NULL; +PDEBUG_MODULE pdebug_module_tail = NULL; +PDEBUG_MODULE pdebug_module_head = NULL; +PMADDRESS_SPACE mm_init_mm; +extern LIST_ENTRY *pModuleListHead; + +ULONG KeyboardIRQL; + +extern void NewInt31Handler(void); +//************************************************************************* +// InitPICE() +// +//************************************************************************* +BOOLEAN InitPICE(void) +{ + ULONG ulHandleScancode=0,ulHandleKbdEvent=0; + ARGS Args; + KIRQL Dirql; + KAFFINITY Affinity; + ULONG ulAddr; + + ENTER_FUNC(); + + DPRINT((0,"InitPICE(): trace step 0.5\n")); + KeyboardIRQL = HalGetInterruptVector(Internal, + 0, + 0, + KEYBOARD_IRQ, + &Dirql, + &Affinity); + DPRINT((0,"KeyboardIRQL: %x\n", KeyboardIRQL)); + + DPRINT((0,"InitPICE(): trace step 1\n")); + // enable monochrome passthrough on BX type chipset + EnablePassThrough(); + + DPRINT((0,"InitPICE(): trace step 2\n")); + // now load all symbol files described in /etc/pice.conf + if(!LoadSymbolsFromConfig(FALSE)) + { + DPRINT((0,"InitPICE: LoadSymbolsFromConfig() failed\n")); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 3\n")); + // init the output console + // this might be one of the following depending setup + // a) monochrome card + // b) serial terminal (TODO) + if(!ConsoleInit()) + { + DPRINT((0,"InitPICE: ConsoleInit() failed\n")); + UnloadSymbols(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 4\n")); + // print the initial screen template + PrintTemplate(); +/* + DPRINT((0,"InitPICE(): trace step 5\n")); + // ask the user if he wants to abort the debugger load + if(!CheckLoadAbort()) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (abort by user)\n"); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } +*/ + + DPRINT((0,"InitPICE(): trace step 6\n")); + // load the file /boot/System.map. + // !!! It must be consistent with the current kernel at all cost!!! + if(!LoadExports()) + { + Print(OUTPUT_WINDOW,"pICE: failed to load exports\n"); + Print(OUTPUT_WINDOW,"press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 7\n")); + ScanExports("_KernelAddressSpace", &ulAddr); + my_init_mm = (PMADDRESS_SPACE) ulAddr; + DPRINT((0,"init_mm %x @ %x\n",&my_init_mm,my_init_mm)); + if(!my_init_mm) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (initial memory map not found)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + DbgPrint("pICE: ABORT (initial memory map not found)\n"); + DbgPrint("pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 7.1\n")); + ScanExports("_ModuleListHead",&ulAddr); + pModuleListHead = (LIST_ENTRY*)ulAddr; + DPRINT((0,"pModuleListHead @ %X\n",pModuleListHead)); + if(!pModuleListHead) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (pModuleListHead not found)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 7.2\n")); + ScanExports("_PsProcessListHead",&ulAddr); + pPsProcessListHead = (LIST_ENTRY*)ulAddr; + DPRINT((0,"pPsProcessListHead @ %X\n",pPsProcessListHead)); + if(!pPsProcessListHead) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (PsProcessListHead not found)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 8\n")); + // end of the kernel + /* + ScanExports("_end",(PULONG)&kernel_end); + if(!kernel_end) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (kernel size is unknown)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadExports(); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + */ + + DPRINT((0,"InitPICE(): trace step 9\n")); + + // the loaded module list + ScanExports("_NameSpaceRoot", &ulAddr); + pNameSpaceRoot = (PDIRECTORY_OBJECT *)ulAddr; + DPRINT((0,"pNameSpaceRoot @ %X\n",pNameSpaceRoot)); + if(!pNameSpaceRoot) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (couldn't retreive name space root)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadExports(); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 10\n")); + // setup a linked list for use in module parsing routines. + if(!InitModuleList(&pdebug_module_head, 100)) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (couldn't initialize kernel module list)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + FreeModuleList( pdebug_module_head ); + while(!GetKeyPolled()); + UnloadExports(); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + pdebug_module_tail = pdebug_module_head; + + DPRINT((0,"InitPICE(): trace step 11\n")); + // do a sanity check on exports + if(!SanityCheckExports()) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (exports are conflicting with kernel symbols)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadExports(); + UnloadSymbols(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 12\n")); + + + DPRINT((0,"InitPICE(): trace step 13\n")); + // patch the keyboard driver + + if(!PatchKeyboardDriver()) + { + Print(OUTPUT_WINDOW,"pICE: ABORT (couldn't patch keyboard driver)\n"); + Print(OUTPUT_WINDOW,"pICE: press any key to continue...\n"); + while(!GetKeyPolled()); + UnloadSymbols(); + UnloadExports(); + ConsoleShutdown(); + LEAVE_FUNC(); + return FALSE; + } + + DPRINT((0,"InitPICE(): trace step 14\n")); + // partial init of shadow registers + CurrentCS = GLOBAL_CODE_SEGMENT; + CurrentEIP = (ULONG)RealIsr; + + CurrentDS = CurrentSS = GLOBAL_DATA_SEGMENT; + __asm__("\n\t \ + mov %%esp,%%eax\n\t \ + mov %%eax,_CurrentESP\n\t \ + ":::"eax"); + + + // display version and symbol information + Ver(NULL); + + // disable HW breakpoints + __asm__("\n\t \ + xorl %%eax,%%eax\n\t \ + mov %%eax,%%dr6\n\t \ + mov %%eax,%%dr7\n\t \ + mov %%dr0,%%eax\n\t \ + mov %%dr1,%%eax\n\t \ + mov %%dr2,%%eax\n\t \ + mov %%dr3,%%eax" + :::"eax" + ); + + DPRINT((0,"InitPICE(): trace step 15\n")); + TakeIdtSnapshot(); + + DPRINT((0,"InitPICE(): trace step 16\n")); + // install all hooks + InstallTraceHook(); + InstallGlobalKeyboardHook(); + InstallSyscallHook(); + InstallInt3Hook(); + InstallDblFltHook(); + InstallGPFaultHook(); + InstallIntEHook(); + InstallPrintkHook(); + + DPRINT((0,"InitPICE(): trace step 16\n")); + if(ulDoInitialBreak) + { + DPRINT((0,"about to do initial break...\n")); + + // simulate an initial break + __asm__("\n\t \ + pushfl\n\t \ + pushl %cs\n\t \ + pushl $initialreturnpoint\n\t \ + pushl $" STR(REASON_CTRLF) "\n\t \ + jmp NewInt31Handler\n\t \ +initialreturnpoint:"); + } + else + { + // display register contents + DisplayRegs(); + + // display data window + Args.Value[0]=CurrentDS; + Args.Value[1]=CurrentEIP; + Args.Count=2; + DisplayMemory(&Args); + + // disassembly from current address + Args.Value[0]=CurrentCS; + Args.Value[1]=CurrentEIP; + Args.Count=2; + Unassemble(&Args); + } + + DPRINT((0,"InitPICE(): trace step 17\n")); + InitPiceRunningTimer(); + + LEAVE_FUNC(); + return TRUE; +} + +//************************************************************************* +// CleanUpPICE() +// +//************************************************************************* +void CleanUpPICE(void) +{ + DPRINT((0,"CleanUpPICE(): trace step 1\n")); + RemovePiceRunningTimer(); + + DPRINT((0,"CleanUpPICE(): trace step 2\n")); + // de-install all hooks + DeInstallGlobalKeyboardHook(); + DeInstallSyscallHook(); + DeInstallInt3Hook(); + DeInstallPrintkHook(); + DeInstallDblFltHook(); + DeInstallGPFaultHook(); + DeInstallIntEHook(); + DeInstallTraceHook(); + + DPRINT((0,"CleanUpPICE(): trace step 3\n")); + RestoreIdt(); + + DPRINT((0,"CleanUpPICE(): trace step 4\n")); + UnloadExports(); // don't use ScanExports() after this + UnloadSymbols(); + + DPRINT((0,"CleanUpPICE(): trace step 5\n")); + // restore patch of keyboard driver + RestoreKeyboardDriver(); + + DPRINT((0,"CleanUpPICE(): trace step 6\n")); + Print(OUTPUT_WINDOW,"pICE: shutting down...\n"); + + DPRINT((0,"CleanUpPICE(): trace step 7\n")); + // cleanup the console + ConsoleShutdown(); +} diff --git a/rosapps/sysutils/utils/pice/module/init.h b/rosapps/sysutils/utils/pice/module/init.h new file mode 100644 index 00000000000..a1227683479 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/init.h @@ -0,0 +1,35 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + init.h + +Abstract: + + HEADER for init.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +BOOLEAN InitPICE(void); +void CleanUpPICE(void); + +extern char szBootParams[1024]; diff --git a/rosapps/sysutils/utils/pice/module/ldrsym.h b/rosapps/sysutils/utils/pice/module/ldrsym.h new file mode 100644 index 00000000000..817ccb37c4e --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/ldrsym.h @@ -0,0 +1,38 @@ +// start of +// structure of symbol file +/////////////////////////////////////////////////// +typedef struct tagLoaderSymbolHeader +{ + ULONG dwMagic,dwSize; + char Copyright[256]; + char ModuleName[256]; + ULONG NumberOfSymbols; + ULONG Reserved; // for future extension +}LOADERSYMBOLHEADER,*PLOADERSYMBOLHEADER; + +typedef struct tagLoaderSymbolRecord +{ + ULONG ModuleNameLength; + ULONG NameLength; + ULONG Address; + ULONG Type; + ULONG Class; +}LOADERSYMBOLRECORD,*PLOADERSYMBOLRECORD; + +typedef struct tagLoaderSymbolFile +{ + LOADERSYMBOLHEADER LoaderSymbolHeader; // file header + LOADERSYMBOLRECORD LoaderSymbolRecord[1]; // symbol records (symbol + source file) +}LOADERSYMBOLFILE,*PLOADERSYMBOLFILE; + +typedef struct tagLoaderSymbolPool +{ + ULONG NumberOfFiles; + ULONG SizeOfThisHeap; + LOADERSYMBOLHEADER LoaderSymbolHeader; // file header + LOADERSYMBOLRECORD LoaderSymbolRecord[1]; // symbol records (symbol + source file) +}LOADERSYMBOLPOOL,*PLOADERSYMBOLPOOL; + +// end of +// structure of symbol file +/////////////////////////////////////////////////// diff --git a/rosapps/sysutils/utils/pice/module/logo.h b/rosapps/sysutils/utils/pice/module/logo.h new file mode 100644 index 00000000000..3dea529cb2a --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/logo.h @@ -0,0 +1,100 @@ +// this file is dynamically generated: DON'T TOUCH + +UCHAR cLogo[96]={ +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +0xab, +0xeb, +0xfb, +0xaf, +0xbf, +0xbf, +0xab, +0xab, +0x81, +0xe0, +0x78, +0x37, +0x9c, +0x1c, +0x03, +0x01, +0x88, +0xe2, +0x3c, +0x63, +0x9e, +0x3f, +0x8f, +0x1f, +0x9c, +0x67, +0x1c, +0x71, +0x1c, +0x1f, +0x1f, +0x1f, +0x98, +0xe2, +0x3c, +0x73, +0x3c, +0x9f, +0x9f, +0x03, +0x81, +0xe0, +0x7c, +0x71, +0x3d, +0xdf, +0x1f, +0x17, +0x83, +0xe0, +0x7c, +0x78, +0x38, +0x0f, +0x9f, +0x3f, +0x9f, +0xe7, +0x3c, +0x7c, +0x70, +0x07, +0x1f, +0x1f, +0x8f, +0xe3, +0x38, +0x38, +0x79, +0xcf, +0x9f, +0x03, +0x9f, +0xe7, +0x18, +0x3c, +0x71, +0xc7, +0x1f, +0x01, +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +0xff, +}; diff --git a/rosapps/sysutils/utils/pice/module/output.c b/rosapps/sysutils/utils/pice/module/output.c new file mode 100644 index 00000000000..60ed8303971 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/output.c @@ -0,0 +1,290 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + output.c + +Abstract: + + catch debugging outputs + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 14-Nov-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" +/* +#include +#include +#include +#include +#include +#include +#include +#include +*/ + +char tempOutput[1024],tempOutput2[1024]; + +//ULONG ulPrintk=0; + +ULONG (*ulPrintk) (PANSI_STRING String); + +BOOLEAN bInPrintk = FALSE; +BOOLEAN bIsDebugPrint = FALSE; +BOOLEAN bIsPrintkPatched = FALSE; + +ULONG ulCountTimerEvents = 0; + +#ifdef __cplusplus +#define CPP_ASMLINKAGE extern "C" +#else +#define CPP_ASMLINKAGE +#endif +#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) + +asmlinkage int printk(const char *fmt, ...); + +//EXPORT_SYMBOL(printk); + +//************************************************************************* +// printk() +// +// this function overrides printk() in the kernel +//************************************************************************* +asmlinkage int printk(const char *fmt, ...) +{ + ULONG len,ulRingBufferLock; + static LONGLONG ulOldJiffies = 0; + LARGE_INTEGER jiffies; + + va_list args; + va_start(args, fmt); + + if((len = PICE_strlen((LPSTR)fmt)) ) + { + save_flags(ulRingBufferLock); + cli(); + + PICE_vsprintf(tempOutput, fmt, args); + bIsDebugPrint = TRUE; + // if the last debug print was longer than 50 ms ago + // directly print it, else just add it to the ring buffer + // and let the timer process it. + KeQuerySystemTime(&jiffies); + if( (jiffies.QuadPart-ulOldJiffies) > 10000*(1*wWindow[OUTPUT_WINDOW].cy)/2) + { + ulOldJiffies = jiffies.QuadPart; + Print(OUTPUT_WINDOW,tempOutput); + } + else + { + AddToRingBuffer(tempOutput); + } + + bIsDebugPrint = FALSE; + restore_flags(ulRingBufferLock); + } + va_end(args); + + return 0; +} + +//************************************************************************* +// CountArgs() +// +// count occurrence of '%' in format string (except %%) +// validity of whole format string must have been enforced +//************************************************************************* +ULONG CountArgs(LPSTR fmt) +{ + ULONG count=0; + + while(*fmt) + { + if(*fmt=='%' && *(fmt+1)!='%') + count++; + fmt++; + } + return count; +} + +//*********************************************************************************** +// Our replacement of kernel function. +// Must not make any calls to KdpPrintString (e.g. by calling DbgPrint). +//*********************************************************************************** +ULONG PICE_KdpPrintString(PANSI_STRING String) +{ + ULONG ulRingBufferLock; + + save_flags(ulRingBufferLock); + cli(); + + /* CH: What is bIsDebugPrint used for? */ + bIsDebugPrint = FALSE; + + DPRINT((0,"PICE_KdpPrintString\n\n\n")); + AddToRingBuffer(String->Buffer); + restore_flags(ulRingBufferLock); +} +//************************************************************************* +// PrintkCallback() +// +// called from RealIsr() when processing INT3 placed +// Must not make any calls to KdpPrintString (e.g. by calling DbgPrint). +//************************************************************************* +void PrintkCallback(void) +{ + LPSTR fmt,args; + ULONG ulAddress; + ULONG countArgs,i,len; + PANSI_STRING temp; + CHAR buf[128]; + + DPRINT((0,"In PrintkCallback\n")); + + bInPrintk = TRUE; + + // get the linear address of stack where string resides + ulAddress = GetLinearAddress(CurrentSS,CurrentESP); + if(ulAddress) + { + DPRINT((0,"In PrintkCallback: ulAddress: %x\n", ulAddress)); + if(IsAddressValid(ulAddress+sizeof(char *)) ) + { + //KdpPrintString has PANSI_STRING as a parameter + temp = (PANSI_STRING)*(PULONG)(ulAddress+sizeof(char *)); + DPRINT((0,"PrintkCallback: %s\n", temp->Buffer)); + /* Call our version of KdpPrintString() */ + CurrentEIP = (ULONG_PTR)PICE_KdpPrintString; + } + } + bInPrintk = FALSE; +} + +//************************************************************************* +// PiceRunningTimer() +// +//************************************************************************* + +KTIMER PiceTimer; +KDPC PiceTimerDPC; + +// do I need it here? Have to keep DPC memory resident #pragma code_seg() +VOID PiceRunningTimer(IN PKDPC Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2) +{ + CheckRingBuffer(); + + if(ulCountTimerEvents++ > 10) + { + LARGE_INTEGER jiffies; + + ulCountTimerEvents = 0; + + KeQuerySystemTime(&jiffies); + SetForegroundColor(COLOR_TEXT); + SetBackgroundColor(COLOR_CAPTION); + PICE_sprintf(tempOutput,"jiffies = %.8X\n",jiffies.u.LowPart); + PutChar(tempOutput,GLOBAL_SCREEN_WIDTH-strlen(tempOutput),GLOBAL_SCREEN_HEIGHT-1); + ResetColor(); + } +} + +//************************************************************************* +// InitPiceRunningTimer() +// +//************************************************************************* +void InitPiceRunningTimer(void) +{ + LARGE_INTEGER Interval; + + ENTER_FUNC(); +#if 0 //won't work. we have to intercept timer interrupt so dpc will never fire while we are in pice + KeInitializeTimer( &PiceTimer ); + KeInitializeDpc( &PiceTimerDPC, PiceRunningTimer, NULL ); + + Interval.QuadPart=-1000000L; // 100 millisec. (unit is 100 nanosec.) + + KeSetTimerEx(&PiceTimer, + Interval, 1000000L, + &PiceTimerDpc); +#endif + LEAVE_FUNC(); +} + +//************************************************************************* +// RemovePiceRunningTimer() +// +//************************************************************************* +void RemovePiceRunningTimer(void) +{ + KeCancelTimer( &PiceTimer ); +} + +//************************************************************************* +// InstallPrintkHook() +// +//************************************************************************* +void InstallPrintkHook(void) +{ + + ENTER_FUNC(); + + if( bIsPrintkPatched ) + return; + + DPRINT((0,"installing PrintString hook\n")); + ScanExports("_KdpPrintString",(PULONG)&ulPrintk); + + DPRINT((0,"_KdpPrintString @ %x\n", ulPrintk)); + ASSERT( ulPrintk ); // temporary + if(ulPrintk) + { + bIsPrintkPatched = InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback); + DPRINT((0,"KdpPrintStringTest breakpoint installed? %d\n", bIsPrintkPatched)); + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// DeInstallPrintkHook() +// +//************************************************************************* +void DeInstallPrintkHook(void) +{ + ENTER_FUNC(); + + DPRINT((0,"enter DeInstallPrintkHook()\n")); + if(bIsPrintkPatched && ulPrintk) + { + // will be done on exit debugger + if (DeInstallSWBreakpoint(ulPrintk)) + bIsPrintkPatched = FALSE; + } + LEAVE_FUNC(); +} diff --git a/rosapps/sysutils/utils/pice/module/output.h b/rosapps/sysutils/utils/pice/module/output.h new file mode 100644 index 00000000000..023635d21d5 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/output.h @@ -0,0 +1,42 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + output.h + +Abstract: + + HEADER for output.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void InstallPrintkHook(void); +void DeInstallPrintkHook(void); + +//extern ULONG ulPrintk; + +extern ULONG (*ulPrintk) (PANSI_STRING String); + +extern BOOLEAN bInPrintk; +extern BOOLEAN bIsDebugPrint; + +void InitPiceRunningTimer(void); +void RemovePiceRunningTimer(void); diff --git a/rosapps/sysutils/utils/pice/module/parse.c b/rosapps/sysutils/utils/pice/module/parse.c new file mode 100644 index 00000000000..66e449c9a9a --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/parse.c @@ -0,0 +1,4102 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + parse.c + +Abstract: + + execution of debugger commands + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 19-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" +#include "pci_ids.h" + +/////////////////////////////////////////////////// +// GLOBALS + +ULONG ValueTrue=1,ValueFalse=0; +ULONG ulLastDisassStartAddress=0,ulLastDisassEndAddress=0,ulLastInvertedAddress=0; +USHORT gCurrentSelector=0; +ULONG gCurrentOffset=0; +LONG ulCurrentlyDisplayedLineNumber=0; +USHORT usOldDisasmSegment = 0; +ULONG ulOldDisasmOffset = 0; +static ULONG ulCountForWaitKey = 0; + +extern PDEBUG_MODULE pdebug_module_head; +extern PDEBUG_MODULE pdebug_module_tail; + +//extern unsigned long sys_call_table[]; + +BOOLEAN (*DisplayMemory)(PARGS) = DisplayMemoryDword; + +char szCurrentFile[256]=""; +PDEBUG_MODULE pCurrentMod=NULL; +PICE_SYMBOLFILE_HEADER* pCurrentSymbols=NULL; + +// suppresses passing on of function keys while stepping code +BOOLEAN bStepping = FALSE; +BOOLEAN bInt3Here = TRUE; +BOOLEAN bInt1Here = TRUE; + +KEYWORDS RegKeyWords[]={ + {"eax",&CurrentEAX,sizeof(ULONG)}, + {"ebx",&CurrentEBX,sizeof(ULONG)}, + {"ecx",&CurrentECX,sizeof(ULONG)}, + {"edx",&CurrentEDX,sizeof(ULONG)}, + {"edi",&CurrentEDI,sizeof(ULONG)}, + {"esi",&CurrentESI,sizeof(ULONG)}, + {"ebp",&CurrentEBP,sizeof(ULONG)}, + {"esp",&CurrentESP,sizeof(ULONG)}, + {"eip",&CurrentEIP,sizeof(ULONG)}, + {NULL,0,0} +}; + +KEYWORDS SelectorRegKeyWords[]={ + {"cs",&CurrentCS,sizeof(USHORT)}, + {"ds",&CurrentDS,sizeof(USHORT)}, + {"es",&CurrentES,sizeof(USHORT)}, + {"fs",&CurrentFS,sizeof(USHORT)}, + {"gs",&CurrentGS,sizeof(USHORT)}, + {"ss",&CurrentSS,sizeof(USHORT)}, + {NULL,0,0} +}; + +KEYWORDS OnOffKeyWords[]={ + {"on",&ValueTrue,sizeof(ULONG)}, + {"off",&ValueFalse,sizeof(ULONG)}, + {NULL,0,0} +}; + +KEYWORDS SpecialKeyWords[]={ + {"process",&CurrentProcess,sizeof(ULONG)}, + {NULL,0,0} +}; + +LPSTR LocalVarRegs[]= +{ + "EAX", + "ECX", + "EDX", + "EBX", + "ESP", + "EBP", + "ESI", + "EDI", + "EIP", + "EFL", + "CS", + "SS", + "DS", + "ES", + "FS", + "GS" +}; + + +#define COMMAND_HAS_NO_PARAMS (0) +#define COMMAND_HAS_PARAMS (1<<0) +#define COMMAND_HAS_SWITCHES (1<<1) +// +#define PARAM_CAN_BE_SYMBOLIC (1<<0) +#define PARAM_CAN_BE_SEG_OFFSET (1<<1) +#define PARAM_CAN_BE_MODULE (1<<2) +#define PARAM_CAN_BE_PRNAME (1<<3) +#define PARAM_CAN_BE_PID (1<<4) +#define PARAM_CAN_BE_SRC_FILE (1<<5) +#define PARAM_CAN_BE_NUMERIC (1<<6) +#define PARAM_CAN_BE_REG_KEYWORD (1<<7) +#define PARAM_CAN_BE_ONOFF_KEYWORD (1<<8) +#define PARAM_CAN_BE_SPECIAL_KEYWORD (1<<9) +#define PARAM_CAN_BE_ASTERISK (1<<10) +#define PARAM_CAN_BE_ONOFF (1<<11) +#define PARAM_CAN_BE_VIRTUAL_SYMBOLIC (1<<12) +#define PARAM_CAN_BE_SRCLINE (1<<13) +#define PARAM_CAN_BE_PARTIAL_SYM_NAME (1<<14) +#define PARAM_CAN_BE_ANY_STRING (1<<15) +#define PARAM_CAN_BE_DECIMAL (1<<16) +#define PARAM_CAN_BE_SIZE_DESC (1<<17) +#define PARAM_CAN_BE_LETTER (1<<18) +// +#define COMMAND_GROUP_HELP (0) +#define COMMAND_GROUP_FLOW (1) +#define COMMAND_GROUP_STRUCT (2) +#define COMMAND_GROUP_OS (3) +#define COMMAND_GROUP_MEM (4) +#define COMMAND_GROUP_BREAKPOINT (5) +#define COMMAND_GROUP_WINDOW (6) +#define COMMAND_GROUP_DEBUG (7) +#define COMMAND_GROUP_INFO (8) +#define COMMAND_GROUP_STATE (9) +#define COMMAND_GROUP_HELP_ONLY (10) +#define COMMAND_GROUP_LAST (11) + +LPSTR CommandGroups[]= +{ + "HELP", + "FLOW CONTROL", + "STRUCTURES", + "OS SPECIFIC", + "MEMORY", + "BREAKPOINTS", + "WINDOW", + "DEBUGGING", + "INFORMATION", + "STATE", + "EDITOR", + NULL +}; +// table of command handlers +CMDTABLE CmdTable[]={ + {"gdt",ShowGdt,"display current global descriptor table" ,0,{0,0,0,0,0},"",COMMAND_GROUP_STRUCT}, + {"idt",ShowIdt,"display current interrupt descriptor table" ,0,{0,0,0,0,0},"",COMMAND_GROUP_STRUCT}, + {"x",LeaveIce,"return to Reactos" ,0,{0,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"t",SingleStep,"single step one instruction" ,0,{0,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"vma",ShowVirtualMemory,"displays VMAs" ,0,{0,0,0,0,0},"",COMMAND_GROUP_OS}, + {"h",ShowHelp,"list help on commands" ,0,{0,0,0,0,0},"",COMMAND_GROUP_HELP}, + {"page",ShowPageDirs,"dump page directories" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC|PARAM_CAN_BE_REG_KEYWORD,0,0,0,0},"",COMMAND_GROUP_STRUCT}, + {"proc",ShowProcesses,"list all processes" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_PRNAME|PARAM_CAN_BE_PID,0,0,0,0},"",COMMAND_GROUP_OS}, + {"dd",DisplayMemoryDword,"display dword memory" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC|PARAM_CAN_BE_SYMBOLIC|PARAM_CAN_BE_REG_KEYWORD,0,0,0,0},"",COMMAND_GROUP_MEM}, + {"db",DisplayMemoryByte,"display byte memory " ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC|PARAM_CAN_BE_SYMBOLIC|PARAM_CAN_BE_REG_KEYWORD,0,0,0,0},"",COMMAND_GROUP_MEM}, + {"dpd",DisplayPhysMemDword,"display dword physical memory" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC,0,0,0,0},"",COMMAND_GROUP_MEM}, + {"u",Unassemble,"disassemble at address" ,COMMAND_HAS_PARAMS|COMMAND_HAS_SWITCHES,{PARAM_CAN_BE_NUMERIC|PARAM_CAN_BE_SYMBOLIC|PARAM_CAN_BE_REG_KEYWORD|PARAM_CAN_BE_SRCLINE,0,0,0,0},"f",COMMAND_GROUP_MEM}, + {"mod",ShowModules,"displays all modules" ,0,{0,0,0,0,0},"",COMMAND_GROUP_OS}, + {"bpx",SetBreakpoint,"set code breakpoint" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC|PARAM_CAN_BE_VIRTUAL_SYMBOLIC|PARAM_CAN_BE_SYMBOLIC|PARAM_CAN_BE_SRCLINE|PARAM_CAN_BE_REG_KEYWORD,0,0,0,0},"",COMMAND_GROUP_BREAKPOINT}, + {"bl",ListBreakpoints,"list breakpoints" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC,0,0,0,0},"",COMMAND_GROUP_BREAKPOINT}, + {"bc",ClearBreakpoints,"clear breakpoints" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC|PARAM_CAN_BE_ASTERISK,0,0,0,0},"",COMMAND_GROUP_BREAKPOINT}, + {"ver",Ver,"display pICE version and state information" ,0,{0,0,0,0,0},"",COMMAND_GROUP_INFO}, + {"hboot",Hboot,"hard boot the system" ,0,{0,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"code",SetCodeDisplay,"toggle code display" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_ONOFF,0,0,0,0},"",COMMAND_GROUP_STATE}, + {"cpu",ShowCPU,"display CPU special registers" ,0,{0,0,0,0,0},"",COMMAND_GROUP_STRUCT}, + {"stack",WalkStack,"display call stack" ,0,{0,0,0,0,0},"",COMMAND_GROUP_STRUCT}, + {"peek",PeekMemory,"peek at physical memory" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_SIZE_DESC,PARAM_CAN_BE_NUMERIC,0,0,0},"",COMMAND_GROUP_MEM}, + {"poke",PokeMemory,"poke to physical memory" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_SIZE_DESC,PARAM_CAN_BE_NUMERIC,PARAM_CAN_BE_NUMERIC,0,0},"",COMMAND_GROUP_MEM}, + {".",UnassembleAtCurrentEip,"unassemble at current instruction" ,0,{0,0,0,0,0},"",COMMAND_GROUP_MEM}, + {"p",StepOver,"single step over call" ,0,{0,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"i",StepInto,"single step into call" ,0,{0,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"locals",ShowLocals,"display local symbols" ,0,{0,0,0,0,0},"",COMMAND_GROUP_MEM}, + {"table",SwitchTables,"display loaded symbol tables" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_MODULE,0,0,0,0},"",COMMAND_GROUP_DEBUG}, + {"file",SwitchFiles,"display source files in symbol table" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_SRC_FILE,0,0,0,0},"",COMMAND_GROUP_DEBUG}, + {"sym",ShowSymbols,"list known symbol information" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_PARTIAL_SYM_NAME,0,0,0,0},"",COMMAND_GROUP_DEBUG}, + {"?",EvaluateExpression,"evaluate an expression" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_ANY_STRING,0,0,0,0},"",COMMAND_GROUP_DEBUG}, + {"src",SetSrcDisplay,"sets disassembly mode" ,0,{0,0,0,0,0},"",COMMAND_GROUP_DEBUG}, + {"wc",SizeCodeWindow,"change size of code window" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_DECIMAL,0,0,0,0},"",COMMAND_GROUP_WINDOW}, + {"wd",SizeDataWindow,"change size of data window" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_DECIMAL,0,0,0,0},"",COMMAND_GROUP_WINDOW}, + {"r",SetGetRegisters,"sets or displays registers" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_REG_KEYWORD,PARAM_CAN_BE_NUMERIC,0,0,0},"",COMMAND_GROUP_STRUCT}, + {"cls",ClearScreen,"clear output window" ,0,{0,0,0,0,0},"",COMMAND_GROUP_WINDOW}, + {"phys",ShowMappings,"show all mappings for linear address" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_NUMERIC,0,0,0,0},"",COMMAND_GROUP_MEM}, + {"timers",ShowTimers,"show all active timers" ,0,{0,0,0,0,0},"",COMMAND_GROUP_OS}, + {"pci",ShowPCI,"show PCI devices" ,COMMAND_HAS_PARAMS|COMMAND_HAS_SWITCHES,{PARAM_CAN_BE_DECIMAL,PARAM_CAN_BE_DECIMAL,0,0,0},"a",COMMAND_GROUP_INFO}, + {"next",NextInstr,"advance EIP to next instruction" ,0,{0,0,0,0,0},""}, + {"i3here",I3here,"catch INT 3s" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_ONOFF,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"layout",SetKeyboardLayout,"sets keyboard layout" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_ANY_STRING,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"syscall",ShowSysCallTable,"displays syscall (table)" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_DECIMAL,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"altkey",SetAltKey,"set alternate break key" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_LETTER,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"addr",ShowContext,"show/set address contexts" ,COMMAND_HAS_PARAMS,{PARAM_CAN_BE_PRNAME,0,0,0,0},"",COMMAND_GROUP_FLOW}, + {"arrow up",NULL,"" ,0,{0,0,0,0,0},"",COMMAND_GROUP_HELP_ONLY}, + {NULL,0,NULL} +}; + +char tempCmd[1024]; + +char HexDigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + + +CPUINFO CPUInfo[]={ + {"DR0",&CurrentDR0}, + {"DR1",&CurrentDR1}, + {"DR2",&CurrentDR2}, + {"DR3",&CurrentDR3}, + {"DR6",&CurrentDR6}, + {"DR7",&CurrentDR7}, + {"EFLAGS",&CurrentEFL}, + {"CR0",&CurrentCR0}, + {"CR2",&CurrentCR2}, + {"CR3",&CurrentCR3}, + {"",NULL}, +}; + +BP Bp[4]={ + {0,0,0,FALSE,FALSE,FALSE,"",""}, + {0,0,0,FALSE,FALSE,FALSE,"",""}, + {0,0,0,FALSE,FALSE,FALSE,"",""}, + {0,0,0,FALSE,FALSE,FALSE,"",""} +}; + +BOOLEAN bShowSrc = TRUE; +BOOLEAN bCodeOn = FALSE; +BOOLEAN bNeedToFillBuffer = TRUE; + +char *NonSystemSegmentTypes[]= +{ + "Data RO", + "Data RO accessed", + "Data RW", + "Data RW accessed", + "Data RO expand-dwon", + "Data RO expand-down, accessed", + "Data RW expand-dwon", + "Data RW expand-down, accessed", + "Code EO", + "Code EO accessed", + "Code ER", + "Code ER accessed", + "Code EO conforming", + "Code EO conforming, accessed", + "Code ER conforming", + "Code ER conforming, accessed" +}; + +char *SystemSegmentTypes[]= +{ + "reserved0", + "16-bit TSS (available)", + "LDT", + "16-bit TSS (busy)", + "16-bit call gate", + "task gate", + "16-bit interrupt gate", + "16-bit trap gate", + "reserved1", + "32-bit TSS (available)", + "reserved2", + "32-bit TSS (busy)", + "32-bit call gate", + "reserved3", + "32-bit interrupt gate", + "32-bit trap gate" +}; + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// RepaintSource() +// +//************************************************************************* +void RepaintSource(void) +{ + ARGS Args; + + ENTER_FUNC(); + + // disassembly from current address + PICE_memset(&Args,0,sizeof(ARGS)); + // make unassembler refresh all again + ulLastDisassStartAddress=ulLastDisassEndAddress=0; + Args.Count=0; + Unassemble(&Args); + + LEAVE_FUNC(); +} + +//************************************************************************* +// RepaintDesktop() +// +//************************************************************************* +void RepaintDesktop(void) +{ + ARGS Args; + + ENTER_FUNC(); + + PrintTemplate(); + + DisplayRegs(); + + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + + // disassembly from current address + PICE_memset(&Args,0,sizeof(ARGS)); + // make unassembler refresh all again + ulLastDisassStartAddress=ulLastDisassEndAddress=0; + Args.Count=0; + Unassemble(&Args); + + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + Print(OUTPUT_WINDOW,""); + + ShowStoppedMsg(); + ShowStatusLine(); + + LEAVE_FUNC(); +} + +//************************************************************************* +// PutStatusText() +// +//************************************************************************* +void PutStatusText(LPSTR p) +{ + ENTER_FUNC(); + + ClrLine(wWindow[OUTPUT_WINDOW].y-1); + PutChar(p,1,wWindow[OUTPUT_WINDOW].y-1); + + LEAVE_FUNC(); +} + +//************************************************************************* +// WaitForKey() +// +//************************************************************************* +BOOLEAN WaitForKey(void) +{ + BOOLEAN result=TRUE; + + if(ulCountForWaitKey == 0) + SuspendPrintRingBuffer(TRUE); + + ulCountForWaitKey++; + + if(ulCountForWaitKey == (wWindow[OUTPUT_WINDOW].cy-1)) + { + SuspendPrintRingBuffer(FALSE); + + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + + ulCountForWaitKey = 0; + + SetBackgroundColor(WHITE); + ClrLine(wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + PutChar(" Press any key to continue listing or press ESC to stop... ",1,wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + ucKeyPressedWhileIdle=0; + while(!(ucKeyPressedWhileIdle=GetKeyPolled())) + { + PrintCursor(FALSE); + } + SetBackgroundColor(BLACK); + // if ESCAPE then indicate retreat + if(ucKeyPressedWhileIdle==SCANCODE_ESC) + { + result=FALSE; + } + ucKeyPressedWhileIdle=0; + } + + + return result; +} + +///////////////////////////////////////////////////////////// +// command handlers +///////////////////////////////////////////////////////////// + +//************************************************************************* +// SingleStep() +// +//************************************************************************* +COMMAND_PROTOTYPE(SingleStep) +{ + ULONG ulLineNumber; + LPSTR pSrcStart,pSrcEnd,pFilename; + + ENTER_FUNC(); + + if(FindSourceLineForAddress(GetLinearAddress(CurrentCS,CurrentEIP),&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename)) + { + DPRINT((0,"SingleStep(): stepping into source\n")); + StepInto(NULL); + } + else + { + // modify trace flag + CurrentEFL|=0x100; // set trace flag (TF) + + bSingleStep=TRUE; + bNotifyToExit=TRUE; + } + + bStepping = TRUE; + + LEAVE_FUNC(); + + return TRUE; +} + + +//************************************************************************* +// StepOver() +// +// step over calls +//************************************************************************* +COMMAND_PROTOTYPE(StepOver) +{ + char tempDisasm[256]; + ULONG dwBreakAddress; + ULONG ulLineNumber; + LPSTR pSrcStart,pSrcEnd,pFilename; + + ENTER_FUNC(); + + DPRINT((0,"StepOver():\n")); + + // only no arguments supplied + // when we have source and current disassembly mod is SOURCE + // we have to analyse the code block for the source line + if(FindSourceLineForAddress(GetLinearAddress(CurrentCS,CurrentEIP),&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename)) + { + DPRINT((0,"StepOver(): we have source here!\n")); + DPRINT((0,"StepOver(): line #%u in file = %s!\n",ulLineNumber,pFilename)); + + g_ulLineNumberStart = ulLineNumber; + bStepThroughSource = TRUE; + + // deinstall the INT3 in kernel's printk() + DeInstallPrintkHook(); + + goto proceed_as_normal; + } + else + { + DPRINT((0,"StepOver(): no source here!\n")); + +proceed_as_normal: + // if there is some form of call instruction at EIP we need to find + // the return address + if(IsCallInstrAtEIP()) + { + // get address of next instruction + dwBreakAddress=GetLinearAddress(CurrentCS,CurrentEIP); + + Disasm(&dwBreakAddress,tempDisasm); + + DPRINT((0,"address of break = %.4X:%.8X\n",CurrentCS,dwBreakAddress)); + + dwBreakAddress=GetLinearAddress(CurrentCS,dwBreakAddress); + + DPRINT((0,"linear address of break = %.8X\n",dwBreakAddress)); + + DPRINT((0,"setting DR0=%.8X\n",dwBreakAddress)); + + SetHardwareBreakPoint(dwBreakAddress,0); + + bSingleStep = FALSE; + bNotifyToExit = TRUE; + } + else + { + DPRINT((0,"no call at breakpoint\n")); + // modify trace flag + CurrentEFL|=0x100; // set trace flag (TF) + + bSingleStep=TRUE; + bNotifyToExit=TRUE; + } + } + + bStepInto = FALSE; + + bStepping = TRUE; + + LEAVE_FUNC(); + + return TRUE; +} + +//************************************************************************* +// StepInto() +// +// step into calls +//************************************************************************* +COMMAND_PROTOTYPE(StepInto) +{ + ULONG ulLineNumber; + LPSTR pSrcStart,pSrcEnd,pFilename; + + ENTER_FUNC(); + + // only no arguments supplied + // when we have source and current disassembly mod is SOURCE + // we have to analyse the code block for the source line + if(FindSourceLineForAddress(GetLinearAddress(CurrentCS,CurrentEIP),&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename)) + { + DPRINT((0,"StepOver(): we have source here!\n")); + DPRINT((0,"StepOver(): line #%u in file = %s!\n",ulLineNumber,pFilename)); + + g_ulLineNumberStart = ulLineNumber; + bStepThroughSource = TRUE; + + // deinstall the INT3 in kernel's printk() + DeInstallPrintkHook(); + + goto proceed_as_normal_into; + } + else + { + DPRINT((0,"StepInto(): no source here!\n")); + +proceed_as_normal_into: + + // modify trace flag + CurrentEFL|=0x100; // set trace flag (TF) + + bSingleStep=TRUE; + bNotifyToExit=TRUE; + } + + bStepInto = TRUE; + + bStepping = TRUE; + + LEAVE_FUNC(); + + return TRUE; +} + +//************************************************************************* +// SetBreakpoint() +// +//************************************************************************* +COMMAND_PROTOTYPE(SetBreakpoint) +{ + ULONG addr,addrorg; + USHORT segment; + + if(pArgs->Count<=2) + { + if(pArgs->bNotTranslated[0]==FALSE) + { + if(gCurrentSelector) + { + addr=pArgs->Value[0]; + addrorg=gCurrentOffset; + segment=gCurrentSelector; + } + else + { + addrorg=addr=pArgs->Value[0]; + segment=CurrentCS; + } + + if(InstallSWBreakpoint(GetLinearAddress(segment,addr),FALSE,NULL) ) + { + PICE_sprintf(tempCmd,"BP #%u set to %.4X:%.8X\n",0,segment,addr); + } + else + { + PICE_sprintf(tempCmd,"BP #%u NOT set (either page not valid OR already used)\n",0); + } + Print(OUTPUT_WINDOW,tempCmd); + } + else + { + if(InstallVirtualSWBreakpoint((LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]) ) + { + PICE_sprintf(tempCmd,"BP #%u virtually set to %s!%s\n",0,(LPSTR)pArgs->Value[0],(LPSTR)pArgs->Value[1]); + } + else + { + PICE_sprintf(tempCmd,"BP #%u NOT set (maybe no symbols loaded)\n",0); + } + Print(OUTPUT_WINDOW,tempCmd); + } + + RepaintSource(); + + } + return TRUE; +} + +//************************************************************************* +// ListBreakpoints() +// +//************************************************************************* +COMMAND_PROTOTYPE(ListBreakpoints) +{ + ULONG i; + + ListSWBreakpoints(); + + for(i=0;i<4;i++) + { + if(Bp[i].Used) + { + PICE_sprintf(tempCmd,"(%u) %s %.4X:%.8X(linear %.8X)\n",i,Bp[i].Active?"*":" ",Bp[i].Segment,Bp[i].Offset,Bp[i].LinearAddress); + Print(OUTPUT_WINDOW,tempCmd); + } + } + return TRUE; +} + +//************************************************************************* +// ClearBreakpoints() +// +//************************************************************************* +COMMAND_PROTOTYPE(ClearBreakpoints) +{ + if(pArgs->Count) + { + if(pArgs->Value[0]<4) + { + Bp[pArgs->Value[0]].Used=Bp[pArgs->Value[0]].Active=FALSE; + } + RepaintSource(); + } + else + { + ULONG i; + + RemoveAllSWBreakpoints(FALSE); + + for(i=0;i<4;i++)Bp[i].Used=Bp[i].Active=FALSE; + RepaintSource(); + } + return TRUE; +} + +//************************************************************************* +// LeaveIce() +// +//************************************************************************* +COMMAND_PROTOTYPE(LeaveIce) +{ + // SetHardwareBreakPoints(); + + bSingleStep=FALSE; + bNotifyToExit=TRUE; + return TRUE; +} + +//************************************************************************* +// ShowGdt() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowGdt) +{ + ULONG gdtr[2]; + USHORT i; + PGDT pGdt; + static ULONG addr=0; + LPSTR pVerbose; + + // get GDT register + __asm__ ("sgdt %0\n" + :"=m" (gdtr)); + + // info out + PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(gdtr[1]<<16)|(gdtr[0]>>16),gdtr[0]&0xFFFF); + Print(OUTPUT_WINDOW,tempCmd); + WaitForKey(); + + // make pointer to GDT + pGdt=(PGDT)(((ULONG)(gdtr[1]<<16))|((ULONG)(gdtr[0]>>16))); + if(pArgs->Count==1) + { + ULONG limit=((pGdt[addr].Limit_19_16<<16)|pGdt[addr].Limit_15_0); + + addr=pArgs->Value[0]; + addr&=(~0x7); + if(pGdt[addr>>3].Gran)limit=(limit*4096)|0xfff; + + if(!pGdt[addr>>3].DescType) + pVerbose = SystemSegmentTypes[pGdt[addr>>3].SegType]; + else + pVerbose = NonSystemSegmentTypes[pGdt[addr>>3].SegType]; + + PICE_sprintf(tempCmd,"%.4X %.8X %.8X %s %u %s\n", + addr, + (pGdt[addr>>3].Base_31_24<<24)|(pGdt[addr>>3].Base_23_16<<16)|(pGdt[addr>>3].Base_15_0), + limit, + pGdt[addr>>3].Present?" P":"NP", + pGdt[addr>>3].Dpl, + pVerbose); + Print(OUTPUT_WINDOW,tempCmd); + } + else if(pArgs->Count==0) + { + for(i=0;i<((gdtr[0]&0xFFFF)>>3);i++) + { + ULONG limit=((pGdt[i].Limit_19_16<<16)|pGdt[i].Limit_15_0); + + if(!pGdt[i].DescType) + pVerbose = SystemSegmentTypes[pGdt[i].SegType]; + else + pVerbose = NonSystemSegmentTypes[pGdt[i].SegType]; + + if(pGdt[i].Gran)limit=(limit*4096)|0xfff; + + PICE_sprintf(tempCmd,"%.4X %.8X %.8X %s %u %s\n", + i<<3, + (pGdt[i].Base_31_24<<24)|(pGdt[i].Base_23_16<<16)|(pGdt[i].Base_15_0), + limit, + pGdt[i].Present?" P":"NP", + pGdt[i].Dpl, + pVerbose); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + } + return TRUE; +} + +//************************************************************************* +// OutputIdtEntry() +// +//************************************************************************* +void OutputIdtEntry(PIDT pIdt,ULONG i) +{ + USHORT seg; + ULONG offset; + LPSTR pSym; + + seg = (USHORT)pIdt[i].Selector; + offset = (pIdt[i].Offset_31_16<<16)|(pIdt[i].Offset_15_0); + + switch(pIdt[i].DescType) + { + // task gate + case 0x5: + PICE_sprintf(tempCmd,"(%0.4X) %0.4X:%0.8X %u [task]\n",i, + seg, + GetLinearAddress((USHORT)seg,0), + pIdt[i].Dpl); + break; + // interrupt gate + case 0x6: + case 0xE: + if(ScanExportsByAddress(&pSym,GetLinearAddress((USHORT)seg,offset))) + { + PICE_sprintf(tempCmd,"(%0.4X) %0.4X:%0.8X %u [int] (%s)\n",i, + seg, + offset, + pIdt[i].Dpl, + pSym); + } + else + { + PICE_sprintf(tempCmd,"(%0.4X) %0.4X:%0.8X %u [int]\n",i, + seg, + offset, + pIdt[i].Dpl); + } + break; + // trap gate + case 0x7: + case 0xF: + if(ScanExportsByAddress(&pSym,GetLinearAddress((USHORT)seg,offset))) + { + PICE_sprintf(tempCmd,"(%0.4X) %0.4X:%0.8X %u [trap] (%s)\n",i, + seg, + offset, + pIdt[i].Dpl, + pSym); + } + else + { + PICE_sprintf(tempCmd,"(%0.4X) %0.4X:%0.8X %u [trap]\n",i, + seg, + offset, + pIdt[i].Dpl); + } + break; + default: + PICE_sprintf(tempCmd,"(%0.4X) INVALID\n",i); + break; + } + Print(OUTPUT_WINDOW,tempCmd); +} + +//************************************************************************* +// ShowIdt() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowIdt) +{ + ULONG idtr[2]; + USHORT i; + PIDT pIdt; + ULONG addr=0; + + ENTER_FUNC(); + + // get GDT register + __asm__ ("sidt %0\n" + :"=m" (idtr)); + // info out + PICE_sprintf(tempCmd,"Address=%.8X Limit=%.4X\n",(idtr[1]<<16)|(idtr[0]>>16),idtr[0]&0xFFFF); + Print(OUTPUT_WINDOW,tempCmd); + WaitForKey(); + // make pointer to GDT + pIdt=(PIDT)(((ULONG)(idtr[1]<<16))|((ULONG)(idtr[0]>>16))); + if(pArgs->Count==1) + { + addr=pArgs->Value[0]; + addr&=(~0x7); + + } + else if(pArgs->Count==0) + { + for(i=0;i<((idtr[0]&0xFFFF)>>3);i++) + { + OutputIdtEntry(pIdt,i); + if(WaitForKey()==FALSE)break; + } + } + LEAVE_FUNC(); + return TRUE; +} + +//************************************************************************* +// ShowHelp() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowHelp) +{ + ULONG i,j; + + PutStatusText("COMMAND KEYWORD DESCRIPTION"); + for(j=0;j show all page directories + if(!pArgs->Count) + { + PutStatusText("Linear Physical Attributes"); + // there are 1024 page directories each mapping 1024*4k of address space + for(i=0;i<1024;i++) + { + ULONG ulAddress = i<<22; + // from the mm_struct get pointer to page directory for this address + pPGD = ADDR_TO_PDE(ulAddress); + // create a structurized pointer from PGD + pPageDir = (PPAGEDIR)pPGD; + + if(pPageDir->PTBase) + { + + PICE_sprintf(tempCmd,"%.8X-%.8X %.8X %s %s %s\n", + ulAddress, ulAddress + 0x400000, + (pPageDir->PTBase<<12), + pPageDir->P?"P ":"NP", + pPageDir->RW?"RW":"R ", + pPageDir->US?"U":"S"); + Print(OUTPUT_WINDOW,tempCmd); + + if(WaitForKey()==FALSE)break; + } + } + } + + // one arg supplied -> show individual page + else if(pArgs->Count == 1) + { + pPGD = ADDR_TO_PDE((ULONG)pArgs->Value[0]); + + DPRINT((0,"ShowPageDirs(): VA = %.8X\n",pArgs->Value[0])); + DPRINT((0,"ShowPageDirs(): pPGD = %.8X\n",(ULONG)pPGD)); + + if(pPGD && ((*pPGD)&_PAGE_PRESENT)) + { + // 4M page + if((*pPGD)&_PAGE_4M) + { + PPAGEDIR pPage = (PPAGEDIR)pPGD; + + PutStatusText("Linear Physical Attributes"); + + PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (LARGE PAGE PTE @ %.8X)\n", + pArgs->Value[0], + (pPage->PTBase<<12)|(pArgs->Value[0]&0x7FFFFF), + pPage->P?"P ":"NP", + pPage->RW?"RW":"R ", + pPage->US?"U":"S", + (ULONG)pPGD); + } + else + { + pPTE = ADDR_TO_PTE(pArgs->Value[0]); + DPRINT((0,"ShowPageDirs(): pPTE = %.8X\n",(ULONG)pPTE)); + if(pPTE) + { + PPAGEDIR pPage = (PPAGEDIR)pPTE; + DPRINT((0,"ShowPageDirs(): pPage->PTBase = %.8X\n",(ULONG)pPage->PTBase)); + + PutStatusText("Linear Physical Attributes"); + + PICE_sprintf(tempCmd,"%.8X %.8X %s %s %s (PTE @ %.8X)\n", + pArgs->Value[0], + (pPage->PTBase<<12)|(pArgs->Value[0]&(_PAGE_SIZE-1)), + (pPage->P==1)?"P ":"NP", + pPage->RW?"RW":"R ", + pPage->US?"U":"S", + (ULONG)pPTE); + } + + } + Print(OUTPUT_WINDOW,tempCmd); + } + else + { + PICE_sprintf(tempCmd,"page at %.8X not present.\n",pArgs->Value[0]); + Print(OUTPUT_WINDOW,tempCmd); + } + + } + } + return TRUE; +} + +//************************************************************************* +// ShowProcesses() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowProcesses) +{ + PEPROCESS my_current = IoGetCurrentProcess(); + PLIST_ENTRY current_entry; + PEPROCESS currentps; + + ENTER_FUNC(); + + current_entry = pPsProcessListHead->Flink; + + if( current_entry ){ + + PutStatusText("NAME TASK PID"); + + while( current_entry != pPsProcessListHead ){ + currentps = CONTAINING_RECORD(current_entry, + EPROCESS, + ProcessListEntry); + DPRINT((0,"currentps = %x\n",currentps)); + //ei would be nice to mark current process! + PICE_sprintf(tempCmd,"%-16.16s %-12x %x\n",currentps->ImageFileName, + (ULONG)currentps,currentps->UniqueProcessId); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE) + break; + current_entry = current_entry->Flink; + } + } + LEAVE_FUNC(); + return TRUE; +} + +//************************************************************************* +// DisplayMemoryDword() +// +//************************************************************************* +COMMAND_PROTOTYPE(DisplayMemoryDword) +{ + ULONG i,j,k; + static ULONG addr=0,addrorg; + static USHORT segment; + char temp[8]; + LPSTR pSymbolName; + + ENTER_FUNC(); + DPRINT((0,"DisplayMemoryDword()\n")); + if(pArgs->Count==2) + { + segment=(USHORT)pArgs->Value[0]; + if(!segment)segment=GLOBAL_DATA_SEGMENT; + addr=pArgs->Value[1]; + OldSelector = segment; + OldOffset = addr; + addrorg=addr; + addr=GetLinearAddress(segment,addr); + } + else if(pArgs->Count==1) + { + segment=CurrentDS; + addr=pArgs->Value[0]; + OldOffset = addr; + addrorg=addr; + addr=GetLinearAddress(segment,addr); + } + else if(pArgs->Count==0) + { + addr += sizeof(ULONG)*4*4; + OldOffset = addr; + } + + if(ScanExportsByAddress(&pSymbolName,addr)) + { + PICE_sprintf(tempCmd," %s ",pSymbolName); + SetForegroundColor(COLOR_TEXT); + SetBackgroundColor(COLOR_CAPTION); + PutChar(tempCmd,GLOBAL_SCREEN_WIDTH-1-PICE_strlen(tempCmd),wWindow[DATA_WINDOW].y-1); + ResetColor(); + } + + DisableScroll(DATA_WINDOW); + + if(DisplayMemory != DisplayMemoryDword) + { + Clear(DATA_WINDOW); + DisplayMemory = DisplayMemoryDword; + } + else + Home(DATA_WINDOW); + + for(k=0;kCount==2) + { + segment=(USHORT)pArgs->Value[0]; + if(!segment)segment=GLOBAL_DATA_SEGMENT; + addr=pArgs->Value[1]; + OldSelector = segment; + OldOffset = addr; + addrorg=addr; + addr=GetLinearAddress(segment,addr); + } + else if(pArgs->Count==1) + { + segment=CurrentDS; + addr=pArgs->Value[0]; + OldOffset = addr; + addrorg=addr; + addr=GetLinearAddress(segment,addr); + } + else if(pArgs->Count==0) + { + addr += sizeof(ULONG)*4*4; + OldOffset = addr; + } + + if(DisplayMemory != DisplayMemoryByte) + { + Clear(DATA_WINDOW); + DisplayMemory = DisplayMemoryByte; + } + else + Home(DATA_WINDOW); + + if(ScanExportsByAddress(&pSymbolName,addr)) + { + PICE_sprintf(tempCmd," %s ",pSymbolName); + SetForegroundColor(COLOR_TEXT); + SetBackgroundColor(COLOR_CAPTION); + PutChar(tempCmd,GLOBAL_SCREEN_WIDTH-1-PICE_strlen(tempCmd),wWindow[DATA_WINDOW].y-1); + ResetColor(); + } + + DisableScroll(DATA_WINDOW); + for(k=0;kCount==1) + { + segment=CurrentDS; + addr=pArgs->Value[0]; + OldOffset = addr; + addrorg=addr; + addr=GetLinearAddress(segment,addr); + } + else if(pArgs->Count==0) + { + addr += sizeof(ULONG)*4*4; + OldOffset = addr; + } + + DisableScroll(DATA_WINDOW); + + if(DisplayMemory != DisplayPhysMemDword) + { + Clear(DATA_WINDOW); + DisplayMemory = DisplayPhysMemDword; + } + else + Home(DATA_WINDOW); + + for(k=0;kGLOBAL_SCREEN_WIDTH-1) + { + tempCmd[GLOBAL_SCREEN_WIDTH-2]='\n'; + tempCmd[GLOBAL_SCREEN_WIDTH-1]=0; + } + + if( (ulLineNumberToInvert!=-1) && + ((int)(ulLineNumberToInvert-ulLineNumber)>=0) && + ((ulLineNumberToInvert-ulLineNumber)=0) && + ((ulLineNumberToInvert-ulLineNumber)CountSwitches, pArgs->Count)); + if(pArgs->CountSwitches>1) + return TRUE; + + if(pArgs->CountSwitches==1) + { + if(pArgs->Switch[0] == 'f') + bForceDisassembly = TRUE; + } + + // we have args + if(pArgs->Count==2) + { + addr=pArgs->Value[1]; + segment=(USHORT)pArgs->Value[0]; + addrorg=addrstart=addr; + addr=GetLinearAddress(segment,addr); + + usOldDisasmSegment = segment; + ulOldDisasmOffset = addr; + } + else if(pArgs->Count==1) + { + addr=pArgs->Value[0]; + segment=CurrentCS; + addrorg=addrstart=addr; + addr=GetLinearAddress(segment,addr); + + usOldDisasmSegment = segment; + ulOldDisasmOffset = addr; + } + else if(pArgs->Count==0) + { + segment = usOldDisasmSegment; + addrorg=addrstart=addr; + addr = GetLinearAddress(usOldDisasmSegment,ulOldDisasmOffset); + } + else + return TRUE; + + + DPRINT((0,"Unassemble(%0.4X:%0.8X), lastst: %x, lastend:%x\n",segment,addr,ulLastDisassStartAddress,ulLastDisassEndAddress)); + + // + // unassemble + // + DisableScroll(SOURCE_WINDOW); + + // if we're inside last disassembly range we only need to move to highlight + if(ulLastDisassStartAddress && ulLastDisassEndAddress && addr>=ulLastDisassStartAddress && + addrname = %S\n",pCurrentMod->name)); + mod_addr = (ULONG)pCurrentMod->BaseAddress; + + pCurrentSymbols = FindModuleSymbols(mod_addr); + DPRINT((0,"Unassemble(): pCurrentSymbols = %x\n",(ULONG)pCurrentSymbols)); + } + DPRINT((0,"Unassemble(): pCurrentMod = %x, showsrc: %d\n",pCurrentMod, bShowSrc)); + + ulCurrentlyDisplayedLineNumber = 0; + + if(bShowSrc && bForceDisassembly == FALSE && (pSrc = FindSourceLineForAddress(addr,&ulLineNumber,&pSrcStart,&pSrcEnd,&pFilename)) ) + { + DPRINT((0,"FoundSourceLineForAddress: file: %s line: %d\n", pFilename, ulLineNumber)); + PICE_strcpy(szCurrentFile,pFilename); + + ulCurrentlyDisplayedLineNumber = ulLineNumber; + + Clear(SOURCE_WINDOW); + + // display file name + SetForegroundColor(COLOR_TEXT); + SetBackgroundColor(COLOR_CAPTION); + + if(PICE_strlen(pFilename)(wWindow[SOURCE_WINDOW].cy/2) ) + { + DisplaySourceFile(pSrcStart,pSrcEnd,ulLineNumber-(wWindow[SOURCE_WINDOW].cy/2),ulLineNumber); + } + else + { + DisplaySourceFile(pSrcStart,pSrcEnd,ulLineNumber,ulLineNumber); + } + } + else + { + *szCurrentFile = 0; + DPRINT((0,"Couldn't find source for file\n")); + Home(SOURCE_WINDOW); + // for each line in the disassembly window + for(i=0;i>4)]; + tempCmd[j*2+1]=HexDigit[((*(PUCHAR)(addrbefore+j)&0xF))]; + } + else + { + tempCmd[j*2]='?'; + tempCmd[j*2+1]='?'; + } + } + else + { + tempCmd[j*2]=' '; + tempCmd[j*2+1]=' '; + } + } + } + PICE_strcat(tempCmd,"\n"); + + if(ulWindowOffset) + { + LONG len = PICE_strlen(tempCmd); + if(ulWindowOffset < len) + PICE_memcpy(tempCmd,&tempCmd[ulWindowOffset],len-ulWindowOffset); + else + tempCmd[0]='\n'; + } + + Print(SOURCE_WINDOW,tempCmd); + + if(addrbefore==CurrentEIP) + { + ResetColor(); + } + + // if potential SW breakpoint, undo marked text + if(IsSwBpAtAddress(addrbefore)) + { + HatchLine(wWindow[SOURCE_WINDOW].y+i); + } + + // if breakpoint was installed before disassembly, put it back + if(bSWBpAtAddr) + { + ReInstallSWBreakpoint(addrbefore); + } + + } + + if(ulLastDisassStartAddress==0 && ulLastDisassEndAddress==0) + { + ulLastDisassStartAddress=addrstart; + ulLastDisassEndAddress=addr; + } + + if(!IsAddressValid(addrstart)) + { + ulLastDisassStartAddress=0; + ulLastDisassEndAddress=0; + } + + } + + EnableScroll(SOURCE_WINDOW); + + return TRUE; +} + +//************************************************************************* +// ShowModules() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowModules) +{ + PDEBUG_MODULE pMod; + DPRINT((0,"ShowModules()\n")); + + if(BuildModuleList()) + { + pMod = pdebug_module_head; + do + { + if(pMod->size) + { + if(pMod == pCurrentMod) + { + PICE_sprintf(tempCmd,"%.8X - %.8X *%-32S\n", + (unsigned int)pMod->BaseAddress, + (unsigned int) ((unsigned int)pMod->BaseAddress+pMod->size),pMod->name); + } + else + { + PICE_sprintf(tempCmd,"%.8X - %.8X %-32S\n", + (unsigned int)pMod->BaseAddress, + (unsigned int) ((unsigned int)pMod->BaseAddress+pMod->size), + pMod->name); + } + } + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE) + break; + }while((pMod = pMod->next)!=pdebug_module_tail); + } + return TRUE; +} + +//************************************************************************* +// DecodeVmFlags() +// +//************************************************************************* +//ei FIX THIS!!!!!!!!!!!!!!!!!! +LPSTR DecodeVmFlags(ULONG flags) +{ + ULONG i; +/* +#define VM_READ 0x0001 +#define VM_WRITE 0x0002 +#define VM_EXEC 0x0004 +#define VM_SHARED 0x0008 + +#define VM_MAYREAD 0x0010 +#define VM_MAYWRITE 0x0020 +#define VM_MAYEXEC 0x0040 +#define VM_MAYSHARE 0x0080 + +#define VM_GROWSDOWN 0x0100 +#define VM_GROWSUP 0x0200 +#define VM_SHM 0x0400 +#define VM_DENYWRITE 0x0800 + +#define VM_EXECUTABLE 0x1000 +#define VM_LOCKED 0x2000 +#define VM_IO 0x4000 + +#define VM_STACK_FLAGS 0x0177 +*/ + static LPSTR flags_syms_on[]={"R","W","X","S","MR","MW","MX","MS","GD","GU","SHM","exe","LOCK","IO",""}; + static char temp[256]; + + // terminate string + *temp = 0; +//ei fix fix fix +#if 0 + + if(flags == VM_STACK_FLAGS) + { + PICE_strcpy(temp," (STACK)"); + } + else + { + for(i=0;i<15;i++) + { + if(flags&0x1) + { + PICE_strcat(temp," "); + PICE_strcat(temp,flags_syms_on[i]); + } + flags >>= 1; + } + } +#endif + return temp; +} + +//************************************************************************* +// ShowVirtualMemory() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowVirtualMemory) +{ + PEPROCESS my_current = IoGetCurrentProcess(); + PLIST_ENTRY current_entry; + PMADDRESS_SPACE vma = NULL; + MEMORY_AREA* current; + char filename[64]; + + DPRINT((0,"ShowVirtualMemory()\n")); + if( my_current ) + vma = &(my_current->AddressSpace); + if( !vma ) + vma = my_init_mm; + while( vma ) + { + if(pArgs->Count == 0) + { + PutStatusText("START END LENGTH VMA TYPE ATTR"); + current_entry = vma->MAreaListHead.Flink; + while (current_entry != &vma->MAreaListHead) + { + *filename = 0; + + current = CONTAINING_RECORD(current_entry, + MEMORY_AREA, + Entry); + // find the filename + if(((current->Type == MEMORY_AREA_SECTION_VIEW) ) && + current->Data.SectionData.Section->FileObject) + { + if(IsAddressValid((ULONG)current->Data.SectionData.Section->FileObject->FileName.Buffer) ) + PICE_sprintf(filename,"%.64S",current->Data.SectionData.Section->FileObject->FileName.Buffer); + } + + PICE_sprintf(tempCmd,"%.8X %.8X %.8X %.8X %x %x %s\n", + (ULONG)current->BaseAddress, + (ULONG)current->BaseAddress+current->Length, + current->Length, + (ULONG)current, + current->Type, current->Attributes,//DecodeVmFlags(current->Type, current->Attributes), + filename); + Print(OUTPUT_WINDOW,tempCmd); + + if(WaitForKey()==FALSE) + break; + current_entry = current_entry->Flink; + } + } + if( vma == &(my_current->AddressSpace) ) + vma = my_init_mm; // switch to kernel memory area + else vma = 0; // if we already did kernel, end loop + } + return TRUE; +} + +//************************************************************************* +// Ver() +// +//************************************************************************* +COMMAND_PROTOTYPE(Ver) +{ + //ei add kernel version info??!! + PICE_sprintf(tempCmd,"pICE: version %u.%u (build %u) for Reactos\n", + PICE_MAJOR_VERSION, + PICE_MINOR_VERSION, + PICE_BUILD); + + Print(OUTPUT_WINDOW,tempCmd); + +/* PICE_sprintf(tempCmd,"pICE: loaded on %s kernel release %s\n", + system_utsname.sysname, + system_utsname.release); + */ + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,"pICE: written by Klaus P. Gerlicher and Goran Devic.\n"); + Print(OUTPUT_WINDOW,"pICE: ported to Reactos by Eugene Ingerman.\n"); + + return TRUE; +} + +//************************************************************************* +// Hboot() +// +//************************************************************************* +COMMAND_PROTOTYPE(Hboot) +{ + // nudge the reset line through keyboard controller + __asm__("\n\t \ + movb $0xFE,%al\n\t \ + outb %al,$0x64"); + // never gets here + return TRUE; +} + +//************************************************************************* +// SetSrcDisplay() +// +//************************************************************************* +COMMAND_PROTOTYPE(SetSrcDisplay) +{ + ARGS Args; + + if(pArgs->Count==0) + { + bShowSrc=bShowSrc?FALSE:TRUE; + PICE_memset(&Args,0,sizeof(ARGS)); + // make unassembler refresh all again + ulLastDisassStartAddress=ulLastDisassEndAddress=0; + Args.Count=0; + Unassemble(&Args); + } + return TRUE; +} + +//************************************************************************* +// I3here() +// +//************************************************************************* +COMMAND_PROTOTYPE(I3here) +{ + if(pArgs->Count==1) + { + if(pArgs->Value[0]==1) + { + if(!bInt3Here) + { + bInt3Here=TRUE; + Print(OUTPUT_WINDOW,"I3HERE is now ON\n"); + } + else + Print(OUTPUT_WINDOW,"I3HERE is already ON\n"); + } + else if(pArgs->Value[0]==0) + { + if(bInt3Here) + { + bInt3Here=FALSE; + Print(OUTPUT_WINDOW,"I3HERE is now OFF\n"); + } + else + Print(OUTPUT_WINDOW,"I3HERE is already OFF\n"); + } + } + else if(pArgs->Count==0) + { + if(bInt3Here) + { + Print(OUTPUT_WINDOW,"I3HERE is ON\n"); + } + else + { + Print(OUTPUT_WINDOW,"I3HERE is OFF\n"); + } + } + // never gets here + return TRUE; +} + +COMMAND_PROTOTYPE(I1here) +{ + if(pArgs->Count==1) + { + if(pArgs->Value[0]==1) + { + if(!bInt1Here) + { + bInt1Here=TRUE; + Print(OUTPUT_WINDOW,"I1HERE is now ON\n"); + } + else + Print(OUTPUT_WINDOW,"I1HERE is already ON\n"); + } + else if(pArgs->Value[0]==0) + { + if(bInt1Here) + { + bInt1Here=FALSE; + Print(OUTPUT_WINDOW,"I1HERE is now OFF\n"); + } + else + Print(OUTPUT_WINDOW,"I1HERE is already OFF\n"); + } + } + else if(pArgs->Count==0) + { + if(bInt1Here) + { + Print(OUTPUT_WINDOW,"I1HERE is ON\n"); + } + else + { + Print(OUTPUT_WINDOW,"I1HERE is OFF\n"); + } + } + // never gets here + return TRUE; +} + +COMMAND_PROTOTYPE(NextInstr) +{ + static char tempDisasm[256]; + ULONG addr,addrbefore; + + bNeedToFillBuffer=FALSE; + + if(!pArgs->Count) + { + addr=addrbefore=GetLinearAddress(CurrentCS,CurrentEIP); + DPRINT((0,"addr before %.8X\n",addrbefore)); + Disasm(&addr,tempDisasm); + DPRINT((0,"addr after %.8X\n",addr)); + CurrentEIP=CurrentEIP+(addr-addrbefore); + // display register contents + DisplayRegs(); + // unassemble + DPRINT((0,"new CS:EIP %04.x:%.8X\n",CurrentCS,CurrentEIP)); + PICE_memset(pArgs,0,sizeof(ARGS)); + // make unassembler refresh all again + ulLastDisassStartAddress=ulLastDisassEndAddress=0; + pArgs->Count=2; + pArgs->Value[0]=(ULONG)CurrentCS; + pArgs->Value[1]=CurrentEIP; + Unassemble(pArgs); + } + bNeedToFillBuffer=TRUE; + return TRUE; +} + +COMMAND_PROTOTYPE(SetGetRegisters) +{ + ULONG i; + + if(pArgs->Count==0) + { + // display whole set + for(i=0;RegKeyWords[i].pValue!=0;i++) + { + switch(RegKeyWords[i].ulSize) + { + case 1: + PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PUCHAR)(RegKeyWords[i].pValue)); + break; + case 2: + PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PUSHORT)(RegKeyWords[i].pValue)); + break; + case 4: + PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PULONG)(RegKeyWords[i].pValue)); + break; + } + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + } + else if(pArgs->Count==1) + { + // display selected register + for(i=0;RegKeyWords[i].pValue!=0;i++) + { + if(PICE_strcmpi(pArgs->pToken[0],RegKeyWords[i].KeyWord)==0) + { + switch(RegKeyWords[i].ulSize) + { + case 1: + PICE_sprintf(tempCmd,"%s = %.2X\n",RegKeyWords[i].KeyWord,*(PUCHAR)(RegKeyWords[i].pValue)); + break; + case 2: + PICE_sprintf(tempCmd,"%s = %.4X\n",RegKeyWords[i].KeyWord,*(PUSHORT)(RegKeyWords[i].pValue)); + break; + case 4: + PICE_sprintf(tempCmd,"%s = %.8X\n",RegKeyWords[i].KeyWord,*(PULONG)(RegKeyWords[i].pValue)); + break; + } + Print(OUTPUT_WINDOW,tempCmd); + break; + } + } + } + else if(pArgs->Count==2) + { + // set selected register to value + for(i=0;RegKeyWords[i].pValue!=0;i++) + { + if(PICE_strcmpi(pArgs->pToken[0],RegKeyWords[i].KeyWord)==0) + { + switch(RegKeyWords[i].ulSize) + { + case 1: + *(PUCHAR)(RegKeyWords[i].pValue)=(UCHAR)pArgs->Value[1]; + break; + case 2: + *(PUSHORT)(RegKeyWords[i].pValue)=(USHORT)pArgs->Value[1]; + break; + case 4: + *(PULONG)(RegKeyWords[i].pValue)=(ULONG)pArgs->Value[1]; + break; + } + DisplayRegs(); + RepaintSource(); + break; + } + } + } + return TRUE; +} + +//************************************************************************* +// SetCodeDisplay() +// +//************************************************************************* +COMMAND_PROTOTYPE(SetCodeDisplay) +{ + ARGS Args; + + if(pArgs->Count==0) + { + bCodeOn=bCodeOn?FALSE:TRUE; + + PICE_memset(&Args,0,sizeof(ARGS)); + Args.Count=0; + // make unassembler refresh all again + ulLastDisassStartAddress=ulLastDisassEndAddress=0; + Unassemble(&Args); + } + else if(pArgs->Count==1) + { + bCodeOn=(pArgs->Value[0]==0)?FALSE:TRUE; + + PICE_memset(&Args,0,sizeof(ARGS)); + Args.Count=0; + // make unassembler refresh all again + ulLastDisassStartAddress=ulLastDisassEndAddress=0; + Unassemble(&Args); + } + return TRUE; +} + +//************************************************************************* +// ShowCPU() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowCPU) +{ +ULONG i; + + for(i=0;CPUInfo[i].pValue!=NULL;i++) + { + PICE_sprintf(tempCmd,"%s = %.8X\n",CPUInfo[i].Name,*(CPUInfo[i].pValue)); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + return TRUE; +} + +//************************************************************************* +// WalkStack() +// +//************************************************************************* +COMMAND_PROTOTYPE(WalkStack) +{ + if(!pArgs->Count) + { + IntelStackWalk(CurrentEIP,CurrentEBP,CurrentESP); + } + + return TRUE; +} + +//************************************************************************* +// PokeDword() +// +//************************************************************************* +COMMAND_PROTOTYPE(PokeDword) +{ + ULONG ulData; + + // read old data + ulData = ReadPhysMem(pArgs->Value[1],sizeof(ULONG)); + PICE_sprintf(tempCmd,"value @ %.8X was %.8X\n",pArgs->Value[1],ulData); + Print(OUTPUT_WINDOW,tempCmd); + + // write new data + WritePhysMem(pArgs->Value[1],pArgs->Value[2],sizeof(ULONG)); + + // read check + ulData = ReadPhysMem(pArgs->Value[1],sizeof(ULONG)); + PICE_sprintf(tempCmd,"value @ %.8X = %.8X\n",pArgs->Value[1],ulData); + Print(OUTPUT_WINDOW,tempCmd); + + return TRUE; +} + +//************************************************************************* +// PokeMemory() +// +//************************************************************************* +COMMAND_PROTOTYPE(PokeMemory) +{ + DPRINT((0,"PokeMemory()\n")); + DPRINT((0,"PokeMemory(): value[0] = %.8X value[1] = %.8X value[3] = %.8X count = %.8X\n",pArgs->Value[0],pArgs->Value[1],pArgs->Value[2],pArgs->Count)); + + // must be three parameters + if(pArgs->Count == 3) + { + switch(pArgs->Value[0]) + { + case 4: + return PokeDword(pArgs); + default: + case 1: + case 2: + break; + } + } + else + { + Print(OUTPUT_WINDOW,"you need to supply a physical address and datum to write!\n"); + } + + return TRUE; +} + + +//************************************************************************* +// PeekDword() +// +//************************************************************************* +COMMAND_PROTOTYPE(PeekDword) +{ + ULONG ulData; + + ulData = ReadPhysMem(pArgs->Value[1],sizeof(ULONG)); + PICE_sprintf(tempCmd,"%.8X\n",ulData); + Print(OUTPUT_WINDOW,tempCmd); + + return TRUE; +} + +//************************************************************************* +// PeekWord() +// +//************************************************************************* +COMMAND_PROTOTYPE(PeekWord) +{ + USHORT usData; + + usData = (USHORT)ReadPhysMem(pArgs->Value[1],sizeof(USHORT)); + PICE_sprintf(tempCmd,"%.4X\n",usData); + Print(OUTPUT_WINDOW,tempCmd); + + return TRUE; +} + +//************************************************************************* +// PeekByte() +// +//************************************************************************* +COMMAND_PROTOTYPE(PeekByte) +{ + UCHAR ucData; + + ucData = (UCHAR)ReadPhysMem(pArgs->Value[1],sizeof(UCHAR)); + PICE_sprintf(tempCmd,"%.2X\n",ucData); + Print(OUTPUT_WINDOW,tempCmd); + + return TRUE; +} + +//************************************************************************* +// PeekMemory() +// +//************************************************************************* +COMMAND_PROTOTYPE(PeekMemory) +{ + DPRINT((0,"PeekMemory()\n")); + DPRINT((0,"PeekMemory(): value[0] = %.8X value[1] = %.8X count = %.8X\n",pArgs->Value[0],pArgs->Value[1],pArgs->Count)); + + if(pArgs->Count == 2) + { + switch(pArgs->Value[0]) + { + case 1: + return PeekByte(pArgs); + case 2: + return PeekWord(pArgs); + case 4: + return PeekDword(pArgs); + default: + break; + } + } + + return TRUE; +} + +//************************************************************************* +// UnassembleAtCurrentEip() +// +//************************************************************************* +COMMAND_PROTOTYPE(UnassembleAtCurrentEip) +{ + PICE_memset(pArgs,0,sizeof(ARGS)); + pArgs->Count = 2; + pArgs->Value[0] = CurrentCS; + pArgs->Value[1] = CurrentEIP; + Unassemble(pArgs); + return TRUE; +} + +//************************************************************************* +// SwitchTables() +// +//************************************************************************* +COMMAND_PROTOTYPE(SwitchTables) +{ + ULONG i; + + DPRINT((0,"SwitchTables()\n")); + + // no arguments -> display load symbol tables + if(!pArgs->Count) + { + for(i=0;iname,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles); + else + PICE_sprintf(tempCmd," %-32S @ %.8X (%5u source files)\n",apSymbols[i]->name,(ULONG)apSymbols[i],apSymbols[i]->ulNumberOfSrcFiles); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + } + } + // 1 argument -> set new current symbols + else if(pArgs->Count == 1) + { + PDEBUG_MODULE pTempMod; + char temp[DEBUG_MODULE_NAME_LEN]; + + pCurrentSymbols = (PICE_SYMBOLFILE_HEADER*)pArgs->Value[0]; + CopyWideToAnsi( temp, pCurrentSymbols->name ); + + DPRINT((0,"TableSwitchSym: pCurrentSymbols: %x, Name: %s\n", pCurrentSymbols, temp)); + + pTempMod = IsModuleLoaded(temp); + if( pTempMod ) + pCurrentMod = pTempMod; + } + + return TRUE; +} + +//************************************************************************* +// SwitchFiles() +// +//************************************************************************* +COMMAND_PROTOTYPE(SwitchFiles) +{ + PICE_SYMBOLFILE_SOURCE* pSrc; + ULONG i; + LPSTR p; + + DPRINT((0,"SwitchFiles()\n")); + // no arguments -> show files for current symbols + if(!pArgs->Count) + { + if(pCurrentSymbols && pCurrentSymbols->ulNumberOfSrcFiles) + { + LPSTR pCurrentFile=NULL; + + // find out the current file name + if(*szCurrentFile!=0) + { + if((pCurrentFile = strrchr(szCurrentFile,'/')) ) + { + pCurrentFile++; + } + else + { + pCurrentFile = szCurrentFile; + } + } + + pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pCurrentSymbols + pCurrentSymbols->ulOffsetToSrcFiles); + + for(i=0;iulNumberOfSrcFiles;i++) + { + if(pCurrentFile) + { + if((p = strrchr(pSrc->filename,'/')) ) + { + if(PICE_strcmpi(p+1,pCurrentFile)==0) + PICE_sprintf(tempCmd,"*%-32s @ %.8X\n",p+1,(ULONG)pSrc); + else + PICE_sprintf(tempCmd," %-32s @ %.8X\n",p+1,(ULONG)pSrc); + } + else + { + if(PICE_strcmpi(pSrc->filename,pCurrentFile)==0) + PICE_sprintf(tempCmd,"*%-32s @ %.8X\n",pSrc->filename,(ULONG)pSrc); + else + PICE_sprintf(tempCmd," %-32s @ %.8X\n",pSrc->filename,(ULONG)pSrc); + } + } + else + { + if((p = strrchr(pSrc->filename,'/')) ) + { + PICE_sprintf(tempCmd,"%-32s @ %.8X\n",p+1,(ULONG)pSrc); + } + else + { + PICE_sprintf(tempCmd,"%-32s @ %.8X\n",pSrc->filename,(ULONG)pSrc); + } + } + Print(OUTPUT_WINDOW,tempCmd); + + if(WaitForKey()==FALSE)break; + (LPSTR)pSrc += pSrc->ulOffsetToNext; + } + } + else + Print(OUTPUT_WINDOW,"No source files available!\n"); + } + // 1 argument -> argument is pointer PICE_SYMBOLFILE_SOURCE struct -> + // set current file and show it + else if(pArgs->Count == 1) + { + PICE_SYMBOLFILE_SOURCE* pSrc = (PICE_SYMBOLFILE_SOURCE*)pArgs->Value[0]; + LPSTR pFilename = pSrc->filename; + + ClrLine(wWindow[SOURCE_WINDOW].y-1); + + if(PICE_strlen(pFilename)ulOffsetToNext, + 1, + -1); + } + + return TRUE; +} + +//************************************************************************* +// ShowLocals() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowLocals) +{ + PLOCAL_VARIABLE p; + + if(pArgs->Count==0) + { + p = FindLocalsByAddress(GetLinearAddress(CurrentCS,CurrentEIP)); + DPRINT((0,"ShowLocals: %x\n", p)); + if(p) + { + DPRINT((0,"ShowLocals: name %s, type_name %s\n", p->name, p->type_name)); + while(PICE_strlen(p->name)) + { + if(!p->bRegister) + { + PICE_sprintf(tempCmd,"[EBP%.4d / #%u] %x %s %s \n",p->offset,p->line,p->value,p->type_name,p->name); + } + else + { + PICE_sprintf(tempCmd,"[%-8s / #%u] %x %s %s #%u\n",LocalVarRegs[p->offset],p->line,p->value,p->type_name,p->name); + } + Print(OUTPUT_WINDOW,tempCmd); + p++; + } + } + } + return TRUE; +} + +//************************************************************************* +// ShowSymbols() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowSymbols) +{ + PICE_SYMBOLFILE_HEADER* pSymbols; + ULONG index,addr; + LPSTR pSearchString,pName,pFind; + + // no args -> list full symbols for current module + if(!pArgs->Count) + { + // have current module ? + if(pCurrentMod) + { + DPRINT((0,"ShowSymbols(): full listing of symbols for %S\n",pCurrentMod->name)); + addr = (ULONG)pCurrentMod->BaseAddress; + + if((pSymbols = FindModuleSymbols(addr)) ) + { + PICE_sprintf(tempCmd,"symbols for module \"%S\"\n",pCurrentMod->name); + Print(OUTPUT_WINDOW,tempCmd); + + index = 0; + while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd))) + { + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + } + } + } + // partial name + else if(pArgs->Count == 1) + { + if(pCurrentMod) + { + addr = (ULONG)pCurrentMod->BaseAddress; + + if((pSymbols = FindModuleSymbols(addr))) + { + pSearchString = (LPSTR)pArgs->Value[0]; + + PICE_sprintf(tempCmd,"symbols for module \"%S\" (searching for \"%s\")\n",pCurrentMod->name,pSearchString); + Print(OUTPUT_WINDOW,tempCmd); + + if(pSearchString) + { + if(*pSearchString=='*' && pSearchString[PICE_strlen(pSearchString)-1]=='*') + { + pSearchString[PICE_strlen(pSearchString)-1] = 0; + pSearchString++; + index = 0; + while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd))) + { + pName = strrchr(tempCmd,' '); + pName++; + pFind = strstr(pName,pSearchString); + if(pFind) + { + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + } + // TODO + } + else if(pSearchString[PICE_strlen(pSearchString)-1]=='*') + { + pSearchString[PICE_strlen(pSearchString)-1] = 0; + index = 0; + + index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd); + if(index) + { + do + { + pName = strrchr(tempCmd,' '); + pName++; + pFind = strstr(pName,pSearchString); + if(pFind && (((ULONG)pName-(ULONG)pFind)==0) ) + { + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)break; + } + }while((index = ListSymbolStartingAt(pCurrentMod,pSymbols,index,tempCmd))); + } + } + } + } + } + } + + return TRUE; +} + +//************************************************************************* +// EvaluateExpression() +// +//************************************************************************* +COMMAND_PROTOTYPE(EvaluateExpression) +{ + PICE_SYMBOLFILE_HEADER* pSymbols; + ULONG addr; + + if(pArgs->Count == 1) + { + if(pCurrentMod) + { + addr = (ULONG)pCurrentMod->BaseAddress; + + if( (pSymbols = FindModuleSymbols(addr) ) ) + { + DPRINT((0,"EvaluateExpression: %s\n", (LPSTR)pArgs->Value[0])); + Evaluate(pSymbols,(LPSTR)pArgs->Value[0]); + } + } + } + return TRUE; +} + +//************************************************************************* +// SizeCodeWindow() +// +//************************************************************************* +COMMAND_PROTOTYPE(SizeCodeWindow) +{ + ULONG NewHeight,TotalHeight; + + if(pArgs->Count == 1) + { + NewHeight = pArgs->Value[0]; + + TotalHeight = wWindow[SOURCE_WINDOW].cy + + wWindow[OUTPUT_WINDOW].cy; + + if(NewHeight < TotalHeight) + { + if(wWindow[SOURCE_WINDOW].cy != NewHeight) + { + wWindow[SOURCE_WINDOW].cy = NewHeight; + wWindow[OUTPUT_WINDOW].y = wWindow[SOURCE_WINDOW].y + wWindow[SOURCE_WINDOW].cy + 1; + wWindow[OUTPUT_WINDOW].cy = TotalHeight - NewHeight; + + RepaintDesktop(); + } + } + } + else + { + PICE_sprintf(tempCmd,"code window at position %u has %u lines \n",wWindow[SOURCE_WINDOW].y,wWindow[SOURCE_WINDOW].cy); + Print(OUTPUT_WINDOW,tempCmd); + } + + return TRUE; +} + +//************************************************************************* +// SizeDataWindow() +// +//************************************************************************* +COMMAND_PROTOTYPE(SizeDataWindow) +{ + ULONG NewHeight,TotalHeight; + + if(pArgs->Count) + { + NewHeight = pArgs->Value[0]; + + TotalHeight = wWindow[DATA_WINDOW].cy + + wWindow[SOURCE_WINDOW].cy; + + if(NewHeight < TotalHeight) + { + if(wWindow[DATA_WINDOW].cy != NewHeight) + { + wWindow[DATA_WINDOW].cy = NewHeight; + wWindow[SOURCE_WINDOW].y = wWindow[DATA_WINDOW].y + wWindow[DATA_WINDOW].cy + 1; + wWindow[SOURCE_WINDOW].cy = TotalHeight - NewHeight; + + RepaintDesktop(); + } + } + } + else + { + PICE_sprintf(tempCmd,"data window has %u lines \n",wWindow[DATA_WINDOW].cy); + Print(OUTPUT_WINDOW,tempCmd); + } + + return TRUE; +} + +//************************************************************************* +// ClearScreen() +// +//************************************************************************* +COMMAND_PROTOTYPE(ClearScreen) +{ + EmptyRingBuffer(); + + Clear(OUTPUT_WINDOW); + CheckRingBuffer(); + + return TRUE; +} + +//************************************************************************* +// ShowMappings() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowMappings) +{ +#if 0 + ULONG ulPageDir; + ULONG ulPageTable; + ULONG address; + ULONG phys_addr; + pgd_t * pPGD; + pmd_t * pPMD; + pte_t * pPTE; + struct mm_struct* p = NULL; + struct task_struct* my_current = (struct task_struct*)0xFFFFE000; + + DPRINT((0,"ShowMappings()\n")); + + if(pArgs->Count == 1) + { + // We're in DebuggerShell(), so we live on a different stack + (ULONG)my_current &= ulRealStackPtr; + + // in case we have a user context we use it's mm_struct + if(my_current->mm) + { + p = my_current->mm; + } + // no user context -> use kernel's context + else + { + p = my_init_mm; + } + + // get the requested address from arguments + phys_addr = pArgs->Value[0]; + + DPRINT((0,"ShowMappings(): p = %X phys_addr = %X\n",(ULONG)p,phys_addr)); + + // for every page directory + for(ulPageDir=0;ulPageDir<1024;ulPageDir++) + { + address = (ulPageDir<<22); + + // get the page directory for the address + pPGD = pgd_offset(p,address); + // if page dir present + if(pPGD && pgd_val(*pPGD)&_PAGE_PRESENT) + { + DPRINT((0,"ShowMappings(): page directory present for %x\n",address)); + // not large page + if(!(pgd_val(*pPGD)&_PAGE_4M)) + { + DPRINT((0,"ShowMappings(): page directory for 4k pages\n")); + for(ulPageTable=0;ulPageTable<1024;ulPageTable++) + { + address = (ulPageDir<<22)|(ulPageTable<<12); + + pPMD = pmd_offset(pPGD,address); + if(pPMD) + { + pPTE = pte_offset(pPMD,address); + if(pPTE) + { + if(*(PULONG)pPTE & _PAGE_PRESENT) + { + ULONG ulPte = *(PULONG)pPTE & 0xFFFFF000; + + if(ulPte == (phys_addr & 0xFFFFF000)) + { + PICE_sprintf(tempCmd,"%.8X\n",address+(phys_addr&0xFFF)); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)return TRUE; + } + } + } + } + } + } + // large page + else + { + address = (ulPageDir<<22); + if((pgd_val(*pPGD)&0xFFC00000) == (phys_addr & 0xFFC00000) ) + { + if( ((address|(phys_addr&0x7FFFFF))&~TASK_SIZE) == phys_addr) + PICE_sprintf(tempCmd,"%.8X (identity map %.8X+%.8X)\n",address|(phys_addr&0x7FFFFF),TASK_SIZE,phys_addr); + else + PICE_sprintf(tempCmd,"%.8X\n",address|(phys_addr&0x7FFFFF)); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)return TRUE; + } + } + } + } + } +#endif + PICE_sprintf(tempCmd,"Not implemented yet!\n"); + Print(OUTPUT_WINDOW,tempCmd); + return TRUE; +} + +//************************************************************************* +// ShowTimers() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowTimers) +{ + + return TRUE; +} + +//************************************************************************* +// FindPCIVendorName() +// +//************************************************************************* +LPSTR FindPCIVendorName(USHORT vendorid) +{ + ULONG i; + + for(i=0;iCountSwitches>1) + return TRUE; + + if(pArgs->CountSwitches==1) + { + if(pArgs->Switch[0] == 'a') + bShowAll = TRUE; + } + + if(pArgs->Count < 3) + { + if(pArgs->Count > 0) + { + bUseBus = FALSE; + bus_req = pArgs->Value[0]; + } + if(pArgs->Count > 1) + { + bUseDev = FALSE; + dev_req = pArgs->Value[1]; + } + + // save old config space selector + oldCF8 = inl((PULONG)0xcf8); + + for(bus=0;bus<256;bus++) + { + for(dev=0;dev<32;dev++) + { + if(!((bUseDev || dev == dev_req) && + (bUseBus || bus == bus_req) )) + continue; + + pciNumber.u.AsUlong = 0; + pciNumber.u.bits.dev = dev; + pciNumber.u.bits.bus = bus; + pciNumber.u.bits.func = 0; + pciNumber.u.bits.ce = 1; + outl(pciNumber.u.AsUlong,(PULONG)0xcf8); + data = inl((PULONG)0xcfc); + + if(data != 0xFFFFFFFF) // valid device + { + if((pVendorName = FindPCIVendorName((USHORT)data)) ) + { + PICE_sprintf(tempCmd,"Bus%-8uDev%-8u === %.4X %.4X %s ====\n",bus,dev,(USHORT)data,(USHORT)(data>>16),pVendorName); + } + else + { + PICE_sprintf(tempCmd,"Bus%-8uDev%-8u === %.4X %.4X N/A ====\n",bus,dev,(USHORT)data,(USHORT)(data>>16)); + } + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE)goto CommonShowPCIExit; + + p = (PULONG)&pciConfig; + for(reg=0;regCount == 1) + { + } + + return TRUE; +} + +//************************************************************************* +// SetKeyboardLayout() +// +//************************************************************************* +COMMAND_PROTOTYPE(SetKeyboardLayout) +{ + PKEYBOARD_LAYOUT layout; + + ENTER_FUNC(); + + layout = GetKeyboardLayout(); + + switch(pArgs->Count) + { + case 0: + PICE_sprintf(tempCmd,"current layout = %s\n", layout->name); + Print(OUTPUT_WINDOW,tempCmd); + break; + case 1: + layout = SetKeyboardLayoutByName((LPSTR)pArgs->Value[0]); + PICE_sprintf(tempCmd,"current layout = %s\n", layout->name); + Print(OUTPUT_WINDOW,tempCmd); + break; + } + + LEAVE_FUNC(); + + return TRUE; +} + +//************************************************************************* +// ShowSysCallTable() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowSysCallTable) +{ +#if 0 + LPSTR pName; + ULONG i; + + ENTER_FUNC(); + + if(pArgs->Count == 0) + { + PICE_sprintf(tempCmd,"%u system calls\n",190); + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()!=FALSE) + for(i=0;i<190;i++) + { + if((pName = FindFunctionByAddress(sys_call_table[i],NULL,NULL)) ) + { + PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName); + } + else + { + PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName); + } + Print(OUTPUT_WINDOW,tempCmd); + if(WaitForKey()==FALSE) + break; + } + } + else if(pArgs->Count == 1) + { + i = pArgs->Value[0]; + if(i<190) + { + if((pName = FindFunctionByAddress(sys_call_table[i],NULL,NULL)) ) + { + PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName); + } + else + { + PICE_sprintf(tempCmd,"%-.3u: %.8X (%s)\n",i,sys_call_table[i],pName); + } + Print(OUTPUT_WINDOW,tempCmd); + } + } + + LEAVE_FUNC(); +#endif + PICE_sprintf(tempCmd,"Not implemented yet!\n"); + Print(OUTPUT_WINDOW,tempCmd); + return TRUE; +} + +//************************************************************************* +// SetAltKey() +// +//************************************************************************* +COMMAND_PROTOTYPE(SetAltKey) +{ + if(pArgs->Count == 1) + { + ucBreakKey = (UCHAR)pArgs->Value[0]; + + PICE_sprintf(tempCmd,"new break key is CTRL-%c\n",ucBreakKey); + Print(OUTPUT_WINDOW,tempCmd); + } + else if(pArgs->Count == 0) + { + PICE_sprintf(tempCmd,"current break key is CTRL-%c\n",ucBreakKey); + Print(OUTPUT_WINDOW,tempCmd); + } + + + COMMAND_RET; +} + +//************************************************************************* +// ShowContext() +// +//************************************************************************* +COMMAND_PROTOTYPE(ShowContext) +{ + COMMAND_RET; +} + +//************************************************************************* +// +// utility functions for parsing +// +//************************************************************************* + + +//************************************************************************* +// FindCommand() +// +//************************************************************************* +LPSTR FindCommand(LPSTR p) +{ + ULONG i,j,k=0; + LPSTR result=NULL; + + tempCmd[0]=0; + for(j=0,i=0;CmdTable[i].Cmd!=NULL;i++) + { + if(PICE_strncmpi(CmdTable[i].Cmd,p,PICE_strlen(p)) == 0 && + CmdTable[i].CommandGroup != COMMAND_GROUP_HELP_ONLY) + { + if(PICE_strlen(tempCmd)) + PICE_strcat(tempCmd,", "); + PICE_strcat(tempCmd,CmdTable[i].Cmd); + j++; + k=i; + } + } + if(PICE_strlen(tempCmd)) + { + SetBackgroundColor(COLOR_CAPTION); + SetForegroundColor(COLOR_TEXT); + ClrLine(wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + PutChar(tempCmd,1,wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + if(j==1) + { + PICE_sprintf(tempCmd,"%s",CmdTable[k].Help); + PutChar(tempCmd,40,wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + result=CmdTable[k].Cmd; + } + ResetColor(); + } + return result; +} + + +//************************************************************************* +// CompactString() +// +//************************************************************************* +void CompactString(LPSTR p) +{ +ULONG i; + + for(i=1;i='0' && p[i]<='9') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'0'); + } + else if(p[i]>='A' && p[i]<='F') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'A'+10); + } + else if(p[i]>='a' && p[i]<='f') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'a'+10); + } + else + return FALSE; + } + p+=(i+1); + if(p[i]==':') + { + ULONG ulSelector=result; + if(ulSelector>0xFFFF) + return FALSE; + for(i=0;i<8 && p[i]!=0 && p[i]!=' ' && p[i]!=':';i++) + { + if(p[i]>='0' && p[i]<='9') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'0'); + } + else if(p[i]>='A' && p[i]<='F') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'A'+10); + } + else if(p[i]>='a' && p[i]<='f') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'a'+10); + } + else + return FALSE; + } + gCurrentSelector=(USHORT)ulSelector; + gCurrentOffset=result; + result = GetLinearAddress((USHORT)ulSelector,result); + } + *pValue=result; + return TRUE; +} + +//************************************************************************* +// ConvertTokenToDec() +// +//************************************************************************* +BOOLEAN ConvertTokenToDec(LPSTR p,PULONG pValue) +{ + ULONG result=0; + char c; + + while((c = *p)) + { + if(c >= '0' && c <= '9') + { + result *= 10; + result += (ULONG)(c - '0'); + } + else + return FALSE; + + p++; + } + *pValue = result; + return TRUE; +} + +//************************************************************************* +// ConvertTokenToSymbol() +// +//************************************************************************* +BOOLEAN ConvertTokenToSymbol(LPSTR pToken,PULONG pValue) +{ + LPSTR pEx; + char temp[64]; + LPSTR p; + PDEBUG_MODULE pModFound; + + DPRINT((0,"ConvertTokenToSymbol()\n")); + + PICE_strcpy(temp,pToken); + p = temp; + + // test for module!symbol string + pEx = PICE_strchr(p,'!'); + if(pEx) + { + DPRINT((0,"ConvertTokenToSymbol(): module!symbol syntax detected\n")); + // terminate module name + *pEx = 0; + // now we have two pointers + pEx++; + DPRINT((0,"ConvertTokenToSymbol(): module = %s symbol = %s\n",p,pEx)); + + if( pModFound=IsModuleLoaded(p) ) + { + if((*pValue = FindFunctionInModuleByName(pEx,pModFound))) + return TRUE; + } + } + else + { + if(pCurrentMod) + { + if((*pValue = FindFunctionInModuleByName(p,pCurrentMod))) + return TRUE; + } + return ScanExports(p,pValue); + } + return FALSE; +} + +//************************************************************************* +// ConvertTokenToModuleAndName() +// +//************************************************************************* +BOOLEAN ConvertTokenToModuleAndName(LPSTR pToken,PULONG pulModuleName,PULONG pulFunctionName) +{ + LPSTR pEx; + char temp[64]; + LPSTR p; + static char module_name[128]; + static char function_name[128]; + + // test for module!symbol string + PICE_strcpy(temp,pToken); + p = temp; + + DPRINT((0,"ConvertTokenToModuleAndName(%s)\n",p)); + + pEx = PICE_strchr(p,'!'); + if(pEx) + { + DPRINT((0,"ConvertTokenToModuleAndName(): module!symbol syntax detected\n")); + // terminate module name + *pEx = 0; + // now we have two pointers + pEx++; + DPRINT((0,"ConvertTokenToModuleAndName(): module = %s symbol = %s\n",p,pEx)); + PICE_strcpy(module_name,p); + PICE_strcpy(function_name,pEx); + *pulModuleName = (ULONG)module_name; + *pulFunctionName = (ULONG)function_name; + return TRUE; + + } + return FALSE; +} + +//************************************************************************* +// ConvertTokenToModule() +// +// convert an argument module name to a pointer to the module's symbols +//************************************************************************* +BOOLEAN ConvertTokenToModule(LPSTR p,PULONG pValue) +{ + ULONG i; + char temp[DEBUG_MODULE_NAME_LEN]; + + for(i=0;iname); + if(PICE_strcmpi(p,temp)==0) + { + *pValue = (ULONG)apSymbols[i]; + return TRUE; + } + } + } + + for(i=0;iname); + if(PICE_strncmpi(temp,p,PICE_strlen(p))==0) + { + *pValue = (ULONG)apSymbols[i]; + return TRUE; + } + } + } + + return FALSE; +} + +//************************************************************************* +// ConvertTokenToProcess() +// +//************************************************************************* +BOOLEAN ConvertTokenToProcess(LPSTR p,PULONG pValue) +{ + return FALSE; +} + +//************************************************************************* +// ReplaceKeywordWithValue() +// +//************************************************************************* +BOOLEAN ReplaceKeywordWithValue(LPSTR p,PULONG pValue,KEYWORDS* pKeyWords) +{ + ULONG i; + + for(i=0;pKeyWords[i].KeyWord!=NULL;i++) + { + if(PICE_strcmpi(p,pKeyWords[i].KeyWord)==0) + { + switch(pKeyWords[i].ulSize) + { + case sizeof(USHORT): + *pValue=(ULONG)*(PUSHORT)(pKeyWords[i].pValue); + break; + case sizeof(ULONG): + *pValue=*(PULONG)(pKeyWords[i].pValue); + break; + } + return TRUE; + } + } + return FALSE; +} + +//************************************************************************* +// ConvertTokenToKeyword() +// +//************************************************************************* +BOOLEAN ConvertTokenToKeyword(LPSTR p,PULONG pValue) +{ + char Name[256]; + ULONG count; + + DPRINT((0,"ConvertTokenToKeyword()\n")); + count=StrLenUpToWhiteChar(p," "); + PICE_strncpy(Name,p,count); + Name[count]=0; + if(ReplaceKeywordWithValue(Name,pValue,RegKeyWords)) + { + DPRINT((0,"ConvertTokenToKeyword(): success\n")); + return TRUE; + } + return FALSE; +} + +//************************************************************************* +// ConvertTokenToSpecialKeyword() +// +//************************************************************************* +BOOLEAN ConvertTokenToSpecialKeyword(LPSTR p,PULONG pValue) +{ + char Name[256]; + ULONG count; + + count=StrLenUpToWhiteChar(p," "); + PICE_strncpy(Name,p,count); + Name[count]=0; + if(ReplaceKeywordWithValue(Name,pValue,SpecialKeyWords)) + { + return TRUE; + } + return FALSE; +} + +//************************************************************************* +// ConvertTokenToOnOff() +// +//************************************************************************* +BOOLEAN ConvertTokenToOnOff(LPSTR p,PULONG pValue) +{ + char Name[256]; + ULONG count; + + count=StrLenUpToWhiteChar(p," "); + PICE_strncpy(Name,p,count); + Name[count]=0; + if(ReplaceKeywordWithValue(Name,pValue,OnOffKeyWords)) + { + return TRUE; + } + return FALSE; +} + +//************************************************************************* +// ConvertSizeToKeyword() +// +//************************************************************************* +BOOLEAN ConvertSizeToKeyword(LPSTR p,PULONG pValue) +{ + ULONG count; + + count=StrLenUpToWhiteChar(p," "); + if(count > 1) + return FALSE; + + switch(*p) + { + // BYTE + case 'b': + case 'B': + *pValue = 1; + break; + // WORD + case 'w': + case 'W': + *pValue = 2; + break; + // DWORD + case 'd': + case 'D': + *pValue = 4; + break; + // QWORD + case 'q': + case 'Q': + *pValue = 4; + break; + default: + return FALSE; + } + + return TRUE; +} + + +//************************************************************************* +// ConvertTokenToSrcFile() +// +//************************************************************************* +BOOLEAN ConvertTokenToSrcFile(LPSTR p,PULONG pValue) +{ + PICE_SYMBOLFILE_SOURCE* pSrc; + LPSTR pFilename,pFilenameSrc; + ULONG i; + + DPRINT((0,"ConvertTokenToSrcFile(%s)\n",p)); + + if(pCurrentSymbols && pCurrentSymbols->ulNumberOfSrcFiles) + { + DPRINT((0,"ConvertTokenToSrcFile(): current symbols for %S\n",pCurrentSymbols->name)); + + pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pCurrentSymbols + pCurrentSymbols->ulOffsetToSrcFiles); + + for(i=0;iulNumberOfSrcFiles;i++) + { + pFilename = strrchr(pSrc->filename,'/'); + if(!pFilename) + pFilename = pSrc->filename; + else + pFilename++; + + pFilenameSrc = strrchr(p,'/'); + if(!pFilenameSrc ) + pFilenameSrc = p; + else + pFilenameSrc++; + + DPRINT((0,"ConvertTokenToSrcFile(): %s\n",pFilename)); + + if(PICE_strcmpi(pFilename,pFilenameSrc) == 0) + { + DPRINT((0,"ConvertTokenToSrcFile(): found %s\n",pFilename)); + + *pValue = (ULONG)pSrc; + return TRUE; + } + + // go to next file + (LPSTR)pSrc += pSrc->ulOffsetToNext; + } + + pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pCurrentSymbols + pCurrentSymbols->ulOffsetToSrcFiles); + + // if not found now do a lookup for partials + for(i=0;iulNumberOfSrcFiles;i++) + { + pFilename = strrchr(pSrc->filename,'/'); + if(!pFilename) + pFilename = pSrc->filename; + else + pFilename++; + + DPRINT((0,"ConvertTokenToSrcFile(): %s\n",pFilename)); + + if(PICE_strncmpi(pFilename,p,PICE_strlen(p)) == 0) + { + DPRINT((0,"ConvertTokenToSrcFile(): found %s\n",pFilename)); + + *pValue = (ULONG)pSrc; + return TRUE; + } + + // go to next file + (LPSTR)pSrc += pSrc->ulOffsetToNext; + } + + } + return FALSE; +} + +//************************************************************************* +// ConvertTokenToLineNumber() +// +//************************************************************************* +BOOLEAN ConvertTokenToLineNumber(LPSTR p,PULONG pValue) +{ + ULONG ulDecimal; + + DPRINT((0,"ConvertTokenToLineNumber()\n")); + if(*p++ == '.') + { + ulDecimal = ExtractNumber(p); + DPRINT((0,"ConvertTokenToLineNumber(): ulDecimal = %u\n",ulDecimal)); + if(ulDecimal) + { + DPRINT((0,"ConvertTokenToLineNumber(): current file = %s\n",szCurrentFile)); + if(pCurrentMod && PICE_strlen(szCurrentFile)) + { + DPRINT((0,"ConvertTokenToLineNumber(): current file %S\n",pCurrentMod->name)); + if(FindAddressForSourceLine(ulDecimal,szCurrentFile,pCurrentMod,pValue)) + { + DPRINT((0,"ConvertTokenToLineNumber(): value = %x\n",*pValue)); + return TRUE; + } + } + } + } + + return FALSE; +} + + +//************************************************************************* +// IsWhiteChar() +// +//************************************************************************* +BOOLEAN IsWhiteChar(char c,LPSTR WhiteChars) +{ + USHORT lenWhiteChar = PICE_strlen(WhiteChars); + USHORT i; + for(i=0;iFlags & COMMAND_HAS_SWITCHES) + { + // token starts with '-' and is 2 chars long + // must be a switch + if(PICE_strchr(pCurrentCommand->pszRecognizedSwitches,*(pToken+1)) ) + { + DPRINT((0,"is a switch!\n")); + Arguments.Switch[j++]=*(pToken+1); + continue; + } + // not a valid switch + else + { + PICE_sprintf(tempCmd," <-- %s is not a valid switch\n",pToken); + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,":"); + goto CommonParseReturnPoint; + } + } + else + { + PICE_sprintf(tempCmd," <-- %s can't have any switches\n",pCurrentCommand->Cmd); + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,":"); + goto CommonParseReturnPoint; + } + } + + if(pCurrentCommand->Flags & COMMAND_HAS_PARAMS) + { + if(!pCurrentCommand->ParamFlags[i]) + { + PICE_sprintf(tempCmd," <-- %s can't have more than %u parameters\n",pCurrentCommand->Cmd,i); + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,":"); + goto CommonParseReturnPoint; + } + DPRINT((0,"Parse(): PARAM_CAN_BE_SRCLINE\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_SRCLINE) + { + if(ConvertTokenToLineNumber(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + if(*pToken == '.') + { + PICE_sprintf(tempCmd," <-- no line number %s found\n",pToken); + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,":"); + goto CommonParseReturnPoint; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_NUMERIC\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_NUMERIC) + { + if(ConvertTokenToHex(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_DECIMAL\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_DECIMAL) + { + if(ConvertTokenToDec(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_REG_KEYWORD\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_REG_KEYWORD) + { + if(ConvertTokenToKeyword(pToken,&Arguments.Value[i])) + { + Arguments.pToken[i] = pToken; + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_SYMBOLIC\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_SYMBOLIC) + { + if(ConvertTokenToSymbol(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_VIRTUAL_SYMBOLIC\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_VIRTUAL_SYMBOLIC) + { + DPRINT((0,"might be a virtual modname!symbol syntax!\n")); + if(ConvertTokenToModuleAndName(pToken,&Arguments.Value[i],&Arguments.Value[i+1])) + { + Arguments.bNotTranslated[i]=TRUE; + Arguments.bNotTranslated[i+1]=TRUE; + i+=2; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_MODULE\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_MODULE) + { + if(ConvertTokenToModule(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_PRNAME\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_PRNAME) + { + if(ConvertTokenToProcess(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_SRC_FILE\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_SRC_FILE) + { + if(ConvertTokenToSrcFile(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_ASTERISK\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_ASTERISK) + { + if(PICE_strlen(pToken)==1 && pToken[0]=='*') + { + Arguments.Value[i]=-1; + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_LETTER\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_LETTER) + { + if(PICE_strlen(pToken)==1 && PICE_isprint(pToken[0])) + { + Arguments.Value[i]=(ULONG)pToken[0]; + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_ONOFF\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_ONOFF) + { + if(ConvertTokenToOnOff(pToken,&Arguments.Value[i])) + { + i++; + continue; + } + } + DPRINT((0,"Parse(): PARAM_CAN_BE_PARTIAL_SYM_NAME\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_PARTIAL_SYM_NAME) + { + Arguments.Value[i] = (ULONG)pToken; + i++; + continue; + } + DPRINT((0,"Parse(): PARAM_CAN_BE_ANY_STRING\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_ANY_STRING) + { + Arguments.Value[i] = (ULONG)pToken; + i++; + continue; + } + DPRINT((0,"Parse(): PARAM_CAN_BE_SIZE_DESC\n")); + if(pCurrentCommand->ParamFlags[i] & PARAM_CAN_BE_SIZE_DESC) + { + if(ConvertSizeToKeyword(pToken,&Arguments.Value[i])) + { + Arguments.pToken[i] = pToken; + i++; + continue; + } + } + PICE_sprintf(tempCmd," <-- syntax error in parameter %u!\n",i); + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,":"); + goto CommonParseReturnPoint; + } + else + { + PICE_sprintf(tempCmd," <-- %s has no parameters\n",pCurrentCommand->Cmd); + Print(OUTPUT_WINDOW,tempCmd); + Print(OUTPUT_WINDOW,":"); + goto CommonParseReturnPoint; + } + // next token + i++; + } + }while(pToken && iCmd,Arguments.CountSwitches)); + + if(!bInvokedByFkey) + { + DPRINT((0,"Parse(): adding new line\n")); + Print(OUTPUT_WINDOW,"\n"); + } + + // call the command handler + result=pCurrentCommand->Handler(&Arguments); + + if(result && !bInvokedByFkey && pCurrentCommand->Handler!=LeaveIce && pCurrentCommand->Handler!=SingleStep ) + { + DPRINT((0,"Parse(): adding colon\n")); + Print(OUTPUT_WINDOW,":"); + } + } + +CommonParseReturnPoint: + SuspendPrintRingBuffer(FALSE); + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + + ShowStatusLine(); +} diff --git a/rosapps/sysutils/utils/pice/module/parse.h b/rosapps/sysutils/utils/pice/module/parse.h new file mode 100644 index 00000000000..432c6660d9a --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/parse.h @@ -0,0 +1,182 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + parse.h + +Abstract: + + HEADER for parse.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +typedef struct TagArgs +{ + ULONG Value[16]; + ULONG Count; + UCHAR Switch[16]; + ULONG CountSwitches; + BOOLEAN bNotTranslated[16]; + LPSTR pToken[16]; +}ARGS,*PARGS; + +typedef struct tagCPUInfo +{ + char *Name; + PULONG pValue; +}CPUINFO; + +typedef BOOLEAN (*PFN)(PARGS); + +#define MAX_ARGS (5) + +typedef struct _CMDTABLE +{ + char * Cmd; + PFN Handler; + char * Help; + ULONG Flags; + ULONG ParamFlags[MAX_ARGS]; + LPSTR pszRecognizedSwitches; + ULONG CommandGroup; +}CMDTABLE,*PCMDTABLE; + +typedef struct tagKeyWords +{ + char* KeyWord; + PVOID pValue; + ULONG ulSize; +}KEYWORDS; + +typedef struct tagSETGETREGS +{ + char *RegName; + PULONG RegAddr; +}SETGETREGS; + +typedef struct tag_BP +{ + ULONG LinearAddress; + ULONG Segment,Offset; + BOOLEAN Used; + BOOLEAN Active; + BOOLEAN Virtual; + char ModName[256]; + char SymName[256]; +}BP; + +extern BOOLEAN bNeedToFillBuffer; + +extern BOOLEAN bCodeOn; +extern BOOLEAN bShowSrc; +extern BP Bp[]; +extern BOOLEAN bInt3Here; +extern BOOLEAN bInt1Here; + +extern BOOLEAN bStepping; + +extern char szCurrentFile[256]; +extern PDEBUG_MODULE pCurrentMod; +extern PICE_SYMBOLFILE_HEADER* pCurrentSymbols; +extern LONG ulCurrentlyDisplayedLineNumber; +extern LIST_ENTRY* pPsProcessListHead; + +BOOLEAN AsciiToHex(LPSTR p,PULONG pValue); +void Parse(LPSTR pCmdLine,BOOLEAN bInvokedByFkey); +LPSTR FindCommand(LPSTR p); +ULONG StrLenUpToWhiteChar(LPSTR p,LPSTR lpszWhiteChars); +BOOLEAN WaitForKey(void); +BOOLEAN ConvertTokenToHex(LPSTR p,PULONG pValue); +void DisplaySourceFile(LPSTR pSrcLine,LPSTR pSrcEnd,ULONG ulLineNumber,ULONG ulLineNumberToInvert); +BOOLEAN ConvertTokenToSrcFile(LPSTR p,PULONG pValue); +void RepaintDesktop(void); +void PutStatusText(LPSTR p); +void UnassembleOneLineDown(void); +void UnassembleOnePageDown(ULONG page); +void UnassembleOneLineUp(void); +void UnassembleOnePageUp(ULONG page); + +extern BOOLEAN (*DisplayMemory)(PARGS pArgs); + +#define COMMAND_PROTOTYPE(arg) BOOLEAN arg(PARGS pArgs) +#define COMMAND_RET return TRUE + +// available commands +COMMAND_PROTOTYPE(ShowGdt); +COMMAND_PROTOTYPE(LeaveIce); +COMMAND_PROTOTYPE(SingleStep); +COMMAND_PROTOTYPE(ShowHelp); +COMMAND_PROTOTYPE(ShowPageDirs); +COMMAND_PROTOTYPE(ShowProcesses); +COMMAND_PROTOTYPE(DisplayMemoryDword); +COMMAND_PROTOTYPE(DisplayMemoryByte); +COMMAND_PROTOTYPE(DisplayPhysMemDword); +COMMAND_PROTOTYPE(Unassemble); +COMMAND_PROTOTYPE(ShowSymbols); +COMMAND_PROTOTYPE(ShowModules); +COMMAND_PROTOTYPE(SetBreakpoint); +COMMAND_PROTOTYPE(ListBreakpoints); +COMMAND_PROTOTYPE(ClearBreakpoints); +COMMAND_PROTOTYPE(Ver); +COMMAND_PROTOTYPE(Hboot); +COMMAND_PROTOTYPE(I3here); +COMMAND_PROTOTYPE(I1here); +COMMAND_PROTOTYPE(SetSrcDisplay); +COMMAND_PROTOTYPE(ShowIdt); +COMMAND_PROTOTYPE(StepOver); +COMMAND_PROTOTYPE(StepInto); +COMMAND_PROTOTYPE(SetGetRegisters); +COMMAND_PROTOTYPE(SetCodeDisplay); +COMMAND_PROTOTYPE(NextInstr); +COMMAND_PROTOTYPE(ShowCPU); +COMMAND_PROTOTYPE(ShowTables); +COMMAND_PROTOTYPE(WalkStack); +COMMAND_PROTOTYPE(ShowVirtualMemory); +COMMAND_PROTOTYPE(UnassembleAtCurrentEip); +COMMAND_PROTOTYPE(PokeMemory); +COMMAND_PROTOTYPE(PeekMemory); +COMMAND_PROTOTYPE(ShowLocals); +COMMAND_PROTOTYPE(SwitchTables); +COMMAND_PROTOTYPE(SwitchFiles); +COMMAND_PROTOTYPE(EvaluateExpression); +COMMAND_PROTOTYPE(SizeCodeWindow); +COMMAND_PROTOTYPE(SizeDataWindow); +COMMAND_PROTOTYPE(ClearScreen); +COMMAND_PROTOTYPE(ShowMappings); +COMMAND_PROTOTYPE(ShowTimers); +COMMAND_PROTOTYPE(ShowPCI); +COMMAND_PROTOTYPE(SetKeyboardLayout); +COMMAND_PROTOTYPE(ShowSysCallTable); +COMMAND_PROTOTYPE(SetAltKey); +COMMAND_PROTOTYPE(ShowContext); + +//ei - make sure the following correspond to ntoskrnl/mm/i386/page.c +//sedwards - Dont use them if you dont need them. Use DDK headers instead. +#define PAGETABLE_MAP (0xf0000000) +#define PAGEDIRECTORY_MAP (0xf0000000 + (PAGETABLE_MAP / (1024))) +//#define PAGE_SHIFT 12 +#define PTRS_PER_PTE 1024 +//#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define ADDR_TO_PAGE_TABLE(v) (((ULONG)(v)) / (4 * 1024 * 1024)) +#define ADDR_TO_PDE(v) (PULONG)(PAGEDIRECTORY_MAP + \ + (((ULONG)v / (1024 * 1024))&(~0x3))) +#define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)v / 1024))&(~0x3))) +#define ADDR_TO_PDE_OFFSET(v) (((ULONG)v / (4 * 1024 * 1024))) diff --git a/rosapps/sysutils/utils/pice/module/patch.c b/rosapps/sysutils/utils/pice/module/patch.c new file mode 100644 index 00000000000..8c56c1a5bdb --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/patch.c @@ -0,0 +1,235 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + patch.c + +Abstract: + + hooking of kernel internal keyboard interrupt handler + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + Reactos Port: Eugene Ingerman + +Revision History: + + 10-Jul-1999: created + 15-Nov-2000: general cleanup of source files + 12/1/2001 reactos port + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//#include + +#include +#include +#include + +//////////////////////////////////////////////////// +// GLOBALS +//// + +static PUCHAR pPatchAddress; +static ULONG ulOldOffset = 0; +static ULONG ulKeyPatchFlags; + +void (*old_handle_scancode)(UCHAR,int); +char tempPatch[256]; +UCHAR ucBreakKey = 'd'; // key that will break into debugger in combination with CTRL + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//*********************************************************************************** +// PiceKbdIsr - keyboard isr hook routine. +// IsrContext - context that we passed to keyboard driver in internal iocontrol +// pCurrentInput, pCurrentOutput - not implemented yet +// StatusByte - keyboard status register +// pByte - pointer to the byte read from keyboard data port. can be changed. +// pContinueProcessing - should keyboard driver continue processing this byte. +//*********************************************************************************** +BOOLEAN PiceKbdIsr ( + PVOID IsrContext, + PKEYBOARD_INPUT_DATA pCurrentInput, + POUTPUT_PACKET pCurrentOutput, + UCHAR StatusByte, + PUCHAR pByte, + PBOOLEAN pContinueProcessing, + PKEYBOARD_SCAN_STATE pScanState + ) +{ + static BOOLEAN bControl = FALSE; + BOOLEAN bForward=TRUE; // should we let keyboard driver process this keystroke + BOOLEAN isDown=!(*pByte & 0x80); + UCHAR ucKey = *pByte & 0x7f; + + ENTER_FUNC(); + + // BUG?? should protect with spinlock since bControl is static. + DPRINT((0,"PiceKbdIsr(pByte: %x, val: %x,%u)\n",pByte,*pByte,isDown)); + DPRINT((0,"PiceKbdIsr(1): bControl = %u bForward = %u bEnterNow = %u\n",bControl,bForward,bEnterNow)); + + if(isDown) + { + DPRINT((0,"bControl: %x, ucKey: %x, breakkey: %x\n", bControl, ucKey, AsciiToScan(ucBreakKey))); + // CTRL pressed + if(ucKey==0x1d) + { + bControl=TRUE; + } + else if(bControl==TRUE && ucKey==AsciiToScan(ucBreakKey)) // CTRL-D + { + // fake a CTRL-D release call + bEnterNow=TRUE; + bControl=FALSE; + // simulate an initial break + __asm__("\n\t \ + pushfl\n\t \ + pushl %cs\n\t \ + pushl $returnpoint\n\t \ + pushl $" STR(REASON_CTRLF) "\n\t \ + jmp NewInt31Handler\n\t \ + returnpoint:"); + *pByte = 0x1d | 0x80 | 0x7f; + bForward=TRUE; + } + else if((ucKey == 66|| ucKey == 68) && bStepping) + { + bForward=FALSE; + } + + } + else + { + // CTRL released + if(ucKey==0x1d) + { + bControl=FALSE; + } + else if((ucKey == 66|| ucKey == 68) && bStepping) + { + bForward=FALSE; + } + } + *pContinueProcessing = bForward; + DPRINT((5,"*pContinueProcessing: %d\n", *pContinueProcessing)); + LEAVE_FUNC(); + return TRUE; +} + +//*********************************************************************************** +// PiceSendIoctl - send internal_io_control to the driver +// Target - Device Object that receives control request +// Ioctl - request +// InputBuffer - Type3Buffer will be pointing here +// InputBufferLength - length of inputbuffer +//*********************************************************************************** +NTSTATUS PiceSendIoctl(PDEVICE_OBJECT Target, ULONG Ioctl, + PVOID InputBuffer, ULONG InputBufferLength) +{ + KEVENT event; + NTSTATUS status = STATUS_SUCCESS; + IO_STATUS_BLOCK iosb; + PIRP irp; + + KeInitializeEvent(&event, + NotificationEvent, + FALSE + ); + + if (NULL == (irp = IoBuildDeviceIoControlRequest(Ioctl, + Target, + InputBuffer, + InputBufferLength, + 0, + 0, + TRUE, + &event, + &iosb))) { + DPRINT((0,"PiceSendIoctl: STATUS_INSUFFICIENT_RESOURCES\n")); + return STATUS_INSUFFICIENT_RESOURCES; + } + + status = IoCallDriver(Target, irp); + + if (STATUS_PENDING == status) { + + status = KeWaitForSingleObject(&event, + Executive, + KernelMode, + FALSE, + NULL); + + ASSERT(STATUS_SUCCESS == status); + status = iosb.Status; + } + DPRINT((0,"PiceSendIoctl: status: %d\n",NT_SUCCESS(status))); + return status; +} + +//************************************************** +// PatchKeyboardDriver - set keyboard driver hook. +// We use interface supported by standard keyboard drivers. +//************************************************** +BOOLEAN PatchKeyboardDriver(void) +{ + PINTERNAL_I8042_HOOK_KEYBOARD phkData; + //When we have i8042 driver this should be changed!!!!!!! + UNICODE_STRING DevName = ROS_STRING_INITIALIZER(L"\\Device\\Keyboard"); + PDEVICE_OBJECT kbdDevice = NULL; + PFILE_OBJECT FO = NULL; + NTSTATUS status; + + ENTER_FUNC(); + + //Get pointer to keyboard device + if( !NT_SUCCESS( status = IoGetDeviceObjectPointer( &DevName, FILE_READ_ACCESS, &FO, &kbdDevice ) ) ) + { + DPRINT((0,"PatchKeyboardDriver: IoGetDeviceObjectPointer status: %x\n", status)); + return FALSE; + } + phkData = ExAllocatePool( PagedPool, sizeof( INTERNAL_I8042_HOOK_KEYBOARD ) ); + RtlZeroMemory( phkData, sizeof( INTERNAL_I8042_HOOK_KEYBOARD ) ); + + phkData->IsrRoutine = (PI8042_KEYBOARD_ISR) PiceKbdIsr; + phkData->Context = (PVOID) NULL; //DeviceObject; + + //call keyboard device internal io control to hook keyboard input stream + status = PiceSendIoctl( kbdDevice, IOCTL_INTERNAL_I8042_HOOK_KEYBOARD, + phkData, sizeof( INTERNAL_I8042_HOOK_KEYBOARD ) ); + DPRINT((0,"PatchKeyboardDriver: PiceSendIoctl status: %x\n", status)); + + + ObDereferenceObject(FO); + ExFreePool(phkData); + + LEAVE_FUNC(); + + return NT_SUCCESS(status); +} + +void RestoreKeyboardDriver(void) +{ + ENTER_FUNC(); + DbgPrint("RestoreKeyboardDriver: Not Implemented yet!!!\n"); + LEAVE_FUNC(); +} diff --git a/rosapps/sysutils/utils/pice/module/patch.h b/rosapps/sysutils/utils/pice/module/patch.h new file mode 100644 index 00000000000..cdb265335eb --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/patch.h @@ -0,0 +1,34 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + patch.h + +Abstract: + + HEADER for patch.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +BOOLEAN PatchKeyboardDriver(void); +void RestoreKeyboardDriver(void); + +extern UCHAR ucBreakKey; diff --git a/rosapps/sysutils/utils/pice/module/pci_ids.h b/rosapps/sysutils/utils/pice/module/pci_ids.h new file mode 100644 index 00000000000..b98e0008164 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/pci_ids.h @@ -0,0 +1,905 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + pci_ids.h + +Abstract: + + HEADER, PCI vendor IDs + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +struct _PCI_VENDOR_IDS +{ + USHORT vendorid; + char* vendor_name; +}PCIVendorIDs[]= +{ + {0x0033 ,"PARADYNE CORP."}, + {0x003D ,"REAL 3D"}, + {0x0100 ,"NCIPHER CORP. LTD"}, + {0x0A89 ,"BREA TECHNOLOGIES INC"}, + {0x0E11 ,"COMPAQ COMPUTER CORP."}, + {0x1000 ,"SYMBIOS LOGIC INC/LSI LOGIC"}, + {0x1001 ,"KOLTER ELECTRONIC"}, + {0x1002 ,"ATI TECHNOLOGIES INC"}, + {0x1004 ,"VLSI TECHNOLOGY INC"}, + {0x100B ,"NATIONAL SEMICONDUCTOR CORPORATION"}, + {0x1010 ,"VIDEO LOGIC LTD"}, + {0x1014 ,"IBM"}, + {0x1018 ,"UNISYS CORPORATION"}, + {0x1019 ,"ELITEGROUP COMPUTER SYS"}, + {0x101A ,"NCR"}, + {0x101E ,"AMERICAN MEGATRENDS"}, + {0x1020 ,"HITACHI COMPUTER PRODUCTS"}, + {0x1021 ,"OKI ELECTRIC INDUSTRY CO. LTD."}, + {0x1022 ,"ADVANCED MICRO DEVICES"}, + {0x1023 ,"TRIDENT MICROSYSTEMS"}, + {0x1028 ,"DELL COMPUTER CORPORATION"}, + {0x102A ,"LSI LOGIC CORPORATION"}, + {0x102B ,"MATROX GRAPHICS, INC."}, + {0x102F ,"TOSHIBA AMERICA, ELEC. COMPANY"}, + {0x1033 ,"NEC CORPORATION"}, + {0x1038 ,"AMP, INC"}, + {0x1039 ,"SILICON INTEGRATED SYSTEMS"}, + {0x103C ,"HEWLETT PACKARD"}, + {0x103F ,"SYNOPSYS/LOGIC MODELING GROUP"}, + {0x1042 ,"MICRON ELECTRONICS, INC."}, + {0x1043 ,"ASUSTEK COMPUTER, INC."}, + {0x1044 ,"DISTRIBUTED PROCESSING TECHNOLOGY"}, + {0x1045 ,"OPTI INC."}, + {0x1048 ,"ELSA AG"}, + {0x1049 ,"FOUNTAIN TECHNOLOGIES, INC."}, + {0x104C ,"TEXAS INSTRUMENTS"}, + {0x104D ,"SONY CORPORATION"}, + {0x1050 ,"WINBOND ELECTRONICS CORP"}, + {0x1054 ,"HITACHI, LTD"}, + {0x1055 ,"STANDARD MICROSYSTEMS CORP."}, + {0x1057 ,"MOTOROLA"}, + {0x1058 ,"ETRI"}, + {0x1059 ,"TEKNOR INDUSTRIAL COMPUTERS INC"}, + {0x105A ,"PROMISE TECHNOLOGY, INC."}, + {0x105B ,"FOXCONN INTERNATIONAL INC"}, + {0x105D ,"NUMBER 9 VISUAL TECHNOLOGY"}, + {0x105F ,"INFOTRONIC AMERICA INC"}, + {0x1063 ,"OCEAN MANUFACTURING LTD"}, + {0x1064 ,"ALCATEL"}, + {0x1067 ,"MITSUBISHI ELECTRIC AMERICA"}, + {0x1068 ,"DIVERSIFIED TECHNOLOGY"}, + {0x1069 ,"MYLEX CORPORATION"}, + {0x106B ,"APPLE COMPUTER INC."}, + {0x106D ,"SEQUENT COMPUTER SYSTEMS"}, + {0x1070 ,"DAEWOO TELECOM LTD"}, + {0x1071 ,"MITAC"}, + {0x1073 ,"YAMAHA CORPORATION"}, + {0x1077 ,"QLOGIC"}, + {0x1079 ,"I-BUS"}, + {0x107B ,"GATEWAY 2000"}, + {0x107E ,"INTERPHASE CORPORATION"}, + {0x108D ,"OLICOM"}, + {0x1095 ,"CMD TECHNOLOGY INC"}, + {0x1096 ,"ALACRON"}, + {0x1097 ,"APPIAN/ETMA"}, + {0x109A ,"PACKARD BELL NEC"}, + {0x109E ,"BROOKTREE CORPORATION"}, + {0x109F ,"TRIGEM COMPUTER INC."}, + {0x10A0 ,"MEIDENSHA CORPORATION"}, + {0x10A2 ,"QUANTUM EFFECT DESIGN"}, + {0x10A9 ,"SILICON GRAPHICS"}, + {0x10AC ,"HONEYWELL IAC"}, + {0x10AF ,"MICRO COMPUTER SYSTEMS INC"}, + {0x10B5 ,"PLX TECHNOLOGY, INC."}, + {0x10B6 ,"MADGE NETWORKS"}, + {0x10B7 ,"3COM CORPORATION"}, + {0x10B9 ,"ACER LABS INC."}, + {0x10BA ,"MITSUBISHI ELECTRIC CORP."}, + {0x10C2 ,"AUSPEX SYSTEMS INC."}, + {0x10C8 ,"NEOMAGIC CORPORATION"}, + {0x10CA ,"FUJITSU MICROELECTRONIC., INC."}, + {0x10CB ,"OMRON CORPORATION"}, + {0x10CD ,"ADVANCED SYSTEM PRODUCTS, INC"}, + {0x10CF ,"FUJITSU LIMITED"}, + {0x10D1 ,"FUTUREPLUS SYSTEMS CORP."}, + {0x10D2 ,"MOLEX INCORPORATED"}, + {0x10DB ,"ROHM LSI SYSTEMS"}, + {0x10DD ,"EVANS & SUTHERLAND"}, + {0x10DE ,"NVIDIA CORPORATION"}, + {0x10DF ,"EMULEX CORPORATION"}, + {0x10E1 ,"TEKRAM TECHNOLOGY CO.,LTD."}, + {0x10E3 ,"TUNDRA SEMICONDUCTOR CORP."}, + {0x10E5 ,"MICRO INDUSTRIES CORPORATION"}, + {0x10EC ,"REALTEK SEMICONDUCTOR CORP."}, + {0x10EE ,"XILINX, INC."}, + {0x10F1 ,"TYAN COMPUTER"}, + {0x10F5 ,"NKK CORPORATION"}, + {0x10F6 ,"CREATIVE ELECTRONIC SYSTEMS SA"}, + {0x10FC ,"I-O DATA DEVICE, INC."}, + {0x10FE ,"FAST MULTIMEDIA AG"}, + {0x1101 ,"INITIO CORPORATION"}, + {0x1102 ,"CREATIVE LABS"}, + {0x1105 ,"SIGMA DESIGNS, INC"}, + {0x1106 ,"VIA TECHNOLOGIES, INC."}, + {0x1107 ,"ASCEND COMMUNICATIONS, INC."}, + {0x1109 ,"ADAPTEC/COGENT DATA TECHNOLOGIES INC"}, + {0x110A ,"SIEMENS PC SYSTEME GMBH"}, + {0x1111 ,"SANTA CRUZ OPERATION"}, + {0x1113 ,"ACCTON TECHNOLOGY CORPORATION"}, + {0x1116 ,"MEDIA 100, INC"}, + {0x1117 ,"DATACUBE, INC"}, + {0x1118 ,"FCI ELECTRONICS"}, + {0x1119 ,"ICP-VORTEX COMPUTERSYSTEM GMBH"}, + {0x111A ,"EFFICIENT NETWORKS, INC"}, + {0x111D ,"INTEGRATED DEVICE TECH"}, + {0x1120 ,"EMC CORPORATION"}, + {0x1127 ,"FORE SYSTEMS INC"}, + {0x112A ,"HERMES ELECTRONICS COMPANY, LTD."}, + {0x112F ,"IMAGING TECHNOLOGY, INC"}, + {0x1131 ,"PHILIPS SEMICONDUCTORS"}, + {0x1132 ,"MITEL CORP."}, + {0x1133 ,"EICON TECHNOLOGY CORPORATION"}, + {0x1134 ,"MERCURY COMPUTER SYSTEMS"}, + {0x1135 ,"FUJI XEROX CO LTD"}, + {0x1136 ,"MOMENTUM DATA SYSTEMS"}, + {0x1137 ,"CISCO SYSTEMS INC"}, + {0x1138 ,"ZIATECH CORPORATION"}, + {0x113C ,"CYCLONE MICROSYSTEMS, INC."}, + {0x113E ,"SANYO ELECTRIC CO - INFORMATION SYSTEMS DIVISION"}, + {0x1141 ,"CREST MICROSYSTEM INC."}, + {0x1145 ,"WORKBIT CORPORATION"}, + {0x1146 ,"FORCE COMPUTERS GMBH"}, + {0x1148 ,"SYSKONNECT"}, + {0x114C ,"ANNABOOKS"}, + {0x114F ,"DIGI INTERNATIONAL"}, + {0x1154 ,"MELCO INC"}, + {0x115C ,"PHOTRON LTD."}, + {0x115D ,"XIRCOM"}, + {0x1161 ,"PFU LIMITED"}, + {0x1163 ,"RENDITION, A DIVISION OF MICRON"}, + {0x1166 ,"RELIANCE COMPUTER"}, + {0x116E ,"ELECTRONICS FOR IMAGING"}, + {0x1170 ,"INVENTEC CORPORATION"}, + {0x1171 ,"BLUE WAVE SYSTEMS"}, + {0x1172 ,"ALTERA CORPORATION"}, + {0x1179 ,"TOSHIBA AMERICA INFO SYSTEMS"}, + {0x1180 ,"RICOH CO LTD"}, + {0x1186 ,"D-LINK SYSTEM INC"}, + {0x1187 ,"ADVANCED TECHNOLOGY LABORATORIES, INC."}, + {0x1189 ,"MATSUSHITA ELECTIC INDUSTRIAL CO LTD"}, + {0x118B ,"PLATYPUS TECHNOLOGY PTY LTD"}, + {0x118C ,"COROLLARY, INC"}, + {0x1191 ,"ACARD TECHNOLOGY CORP"}, + {0x1195 ,"RATOC SYSTEMS INC"}, + {0x119A ,"MINDSHARE, INC."}, + {0x119D ,"BUG, INC."}, + {0x119E ,"FUJITSU MICROELECTRONICS LTD."}, + {0x119F ,"BULL HN INFORMATION SYSTEMS"}, + {0x11A1 ,"HAMAMATSU PHOTONICS K.K."}, + {0x11A9 ,"INNOSYS"}, + {0x11AA ,"ACTEL"}, + {0x11AB ,"GALILEO TECHNOLOGY LTD."}, + {0x11AD ,"LITE-ON COMMUNICATIONS INC"}, + {0x11AE ,"SCITEX CORPORATION"}, + {0x11AF ,"AVID TECHNOLOGY INC"}, + {0x11B0 ,"V3 SEMICONDUCTOR INC."}, + {0x11B2 ,"EASTMAN KODAK"}, + {0x11B3 ,"BARR SYSTEMS INC."}, + {0x11BF ,"ASTRODESIGN, INC."}, + {0x11C6 ,"DAINIPPON SCREEN MFG. CO. LTD"}, + {0x11C8 ,"DOLPHIN INTERCONNECT SOLUTIONS AS"}, + {0x11C9 ,"MAGMA"}, + {0x11CA ,"LSI SYSTEMS, INC"}, + {0x11CB ,"SPECIALIX INTERNATIONAL LTD"}, + {0x11CE ,"NETACCESS"}, + {0x11D0 ,"LOCKHEED MARTIN - ELECTRONISS & COMMUNICATIONS"}, + {0x11D1 ,"AURAVISION"}, + {0x11D2 ,"INTERCOM INC."}, + {0x11D4 ,"ANALOG DEVICES"}, + {0x11D5 ,"IKON CORPORATION"}, + {0x11D9 ,"TOSHIBA TEC CORPORATION"}, + {0x11DA ,"NOVELL"}, + {0x11DF ,"NEW WAVE PDG"}, + {0x11E3 ,"QUICKLOGIC CORPORATION"}, + {0x11EC ,"CORECO INC"}, + {0x11EE ,"DOME IMAGING SYSTEMS INC"}, + {0x11F8 ,"PMC-SIERRA INC"}, + {0x1203 ,"AGFA CORPORATION"}, + {0x1206 ,"AMDAHL CORPORATION"}, + {0x120F ,"ESSENTIAL COMMUNICATIONS"}, + {0x1214 ,"PERFORMANCE TECHNOLOGIES, INC."}, + {0x1216 ,"PURUP - ESKOFOT A/S"}, + {0x1217 ,"O2MICRO, INC."}, + {0x121A ,"3DFX INTERACTIVE, INC."}, + {0x121B ,"VIRATA LTD"}, + {0x1221 ,"CONTEC CO., LTD"}, + {0x1223 ,"ARTESYN COMMUNICATIONS PRODUCTS INC"}, + {0x1227 ,"TECH-SOURCE"}, + {0x122C ,"SICAN GMBH"}, + {0x1232 ,"MARCONI COMMUNICATIONS LTD"}, + {0x123C ,"CENTURY SYSTEMS, INC."}, + {0x123D ,"ENGINEERING DESIGN TEAM, INC."}, + {0x123F ,"C-CUBE MICROSYSTEMS"}, + {0x1242 ,"JAYCOR NETWORKS INC."}, + {0x1244 ,"AVM AUDIOVISUELLES MKTG & COMPUTER SYSTEM GMBH"}, + {0x124B ,"SBS TECHNOLOGIES"}, + {0x1250 ,"HITACHI ULSI SYSTEMS CO LTD"}, + {0x1253 ,"GUZIK TECHNICAL ENTERPRISES"}, + {0x1255 ,"OPTIBASE LTD"}, + {0x1259 ,"ALLIED TELESYN INTERNATIONAL"}, + {0x125C ,"AURORA TECHNOLOGIES, INC."}, + {0x125F ,"CONCURRENT TECHNOLOGIES"}, + {0x1260 ,"INTERSIL CORP"}, + {0x1261 ,"MATSUSHITA-KOTOBUKI ELECTRONICS INDUSTRIES, LTD."}, + {0x1264 ,"AVAL NAGASAKI CORPORATION"}, + {0x1268 ,"TEKTRONIX"}, + {0x126C ,"NORTEL NETWORKS"}, + {0x126D ,"SPLASH TECHNOLOGY, INC."}, + {0x126E ,"SUMITOMO METAL INDUSTRIES, LTD."}, + {0x126F ,"SILICON MOTION, INC."}, + {0x1270 ,"OLYMPUS OPTICAL CO., LTD."}, + {0x1274 ,"CREATIVE LABS, INC. MALVERN"}, + {0x1275 ,"NETWORK APPLIANCE CORPORATION"}, + {0x1278 ,"TRANSTECH DSP LTD"}, + {0x1279 ,"TRANSMETA CORPORATION"}, + {0x127D ,"VELA RESEARCH LP"}, + {0x127F ,"FUJIFILM"}, + {0x1281 ,"YOKOGAWA ELECTRIC CORPORATION"}, + {0x1283 ,"INTEGRATED TECHNOLOGY EXPRESS, INC."}, + {0x1286 ,"MAZET GMBH"}, + {0x128B ,"TRANSWITCH CORPORATION"}, + {0x128D ,"G2 NETWORKS, INC."}, + {0x128F ,"TATENO DENNOU, INC."}, + {0x1290 ,"TOSHIBA PERSONAL COMPUTER SYSTEM CORP."}, + {0x1291 ,"NCS COMPUTER ITALIA SRL"}, + {0x1292 ,"TRITECH MICROELECTRONICS INC"}, + {0x1297 ,"SHUTTLE COMPUTER"}, + {0x1299 ,"KNOWLEDGE TECHNOLOGY LAB."}, + {0x129A ,"VMETRO, INC."}, + {0x129E ,"VICTOR COMPANY OF JAPAN, LTD."}, + {0x12A0 ,"ALLEN- BRADLEY COMPANY"}, + {0x12A3 ,"LUCENT TECHNOLOGIES"}, + {0x12A7 ,"AMO GMBH"}, + {0x12A9 ,"XIOTECH CORPORATION"}, + {0x12AB ,"YUAN YUAN ENTERPRISE CO., LTD."}, + {0x12AE ,"ALTEON WEBSYSTEMS INC"}, + {0x12B6 ,"NATURAL MICROSYSTEMS"}, + {0x12B7 ,"COGNEX MODULAR VISION SYSTEMS DIV. - ACUMEN INC."}, + {0x12B9 ,"3COM CORP."}, + {0x12BC ,"ARRAY MICROSYSTEMS"}, + {0x12BE ,"ANCHOR CHIPS INC."}, + {0x12BF ,"FUJIFILM MICRODEVICES"}, + {0x12C0 ,"INFIMED"}, + {0x12C3 ,"HOLTEK SEMICONDUCTOR INC"}, + {0x12C4 ,"CONNECT TECH INC"}, + {0x12C6 ,"MITAN CORPORATION"}, + {0x12C7 ,"DIALOGIC CORP"}, + {0x12CA ,"INTEGRATED COMPUTING ENGINES"}, + {0x12CD ,"AIMS LAB"}, + {0x12D3 ,"GE VINGMED ULTRASOUND AS"}, + {0x12D4 ,"COMVERSE NETWORKS SYSTEM & ULTICOM, INC."}, + {0x12D5 ,"EQUATOR TECHNOLOGIES"}, + {0x12D6 ,"ANALOGIC CORP"}, + {0x12D8 ,"PERICOM SEMICONDUCTOR"}, + {0x12D9 ,"ACULAB PLC"}, + {0x12DA ,"TRUE TIME INC."}, + {0x12DE ,"RAINBOW TECHNOLOGIES"}, + {0x12DF ,"SBS TECHNOLOGIES INC"}, + {0x12E0 ,"CHASE RESEARCH"}, + {0x12E2 ,"DATUM INC. BANCOMM-TIMING DIVISION"}, + {0x12E4 ,"BROOKTROUT TECHNOLOGY INC"}, + {0x12E7 ,"SEBRING SYSTEMS, INC"}, + {0x12EA ,"REAL VISION, INC"}, + {0x12EB ,"AUREAL INC."}, + {0x12EC ,"3A INTERNATIONAL, INC."}, + {0x12F0 ,"PENTEK"}, + {0x12F7 ,"COGNEX INC."}, + {0x12FB ,"SPECTRUM SIGNAL PROCESSING"}, + {0x12FC ,"CAPITAL EQUIPMENT CORP"}, + {0x12FE ,"ESD ELECTRONIC SYSTEM DESIGN GMBH"}, + {0x1304 ,"JUNIPER NETWORKS INC."}, + {0x1307 ,"COMPUTER BOARDS"}, + {0x1308 ,"LEVEL ONE COMMUNICATIONS INC"}, + {0x130A ,"MITSUBISHI ELECTRIC MICROCOMPUTER"}, + {0x130B ,"COLORGRAPHIC COMMUNICATIONS CORP"}, + {0x130F ,"ADVANET INC"}, + {0x1310 ,"GESPAC"}, + {0x1313 ,"YASKAWA ELECTRIC CO."}, + {0x1316 ,"TERADYNE INC."}, + {0x1317 ,"ADMTEK INC"}, + {0x1318 ,"PACKET ENGINES INC."}, + {0x1319 ,"FORTEMEDIA, INC"}, + {0x131F ,"SIIG INC"}, + {0x1325 ,"SALIX TECHNOLOGIES INC"}, + {0x1326 ,"SEACHANGE INTERNATIONAL"}, + {0x1331 ,"RADISYS CORP."}, + {0x133D ,"PRISA NETWORKS"}, + {0x133F ,"SCM MICROSYSTEMS"}, + {0x1342 ,"PROMAX SYSTEMS INC"}, + {0x1344 ,"MICRON TECHNOLOGY INC"}, + {0x134B ,"ARK RESEARCH CORP."}, + {0x134C ,"CHORI JOHO SYSTEM CO. LTD"}, + {0x134D ,"PC-TEL INC"}, + {0x135A ,"BRAIN BOXES LIMITED"}, + {0x135C ,"QUATECH INC"}, + {0x135E ,"SEALEVEL SYSTEMS INC"}, + {0x135F ,"I-DATA INTERNATIONAL A-S"}, + {0x1360 ,"MEINBERG FUNKUHREN"}, + {0x1361 ,"SOLITON SYSTEMS K.K."}, + {0x1363 ,"PHOENIX TECHNOLOGIES LTD"}, + {0x1367 ,"HITACHI ZOSEN CORPORATION"}, + {0x1368 ,"SKYWARE CORPORATION"}, + {0x1369 ,"DIGIGRAM"}, + {0x136B ,"KAWASAKI STEEL CORPORATION"}, + {0x136C ,"ADTEK SYSTEM SCIENCE CO LTD"}, + {0x1375 ,"BOEING - SUNNYVALE"}, + {0x1377 ,"ELECTRONIC EQUIPMENT PRODUUTION & DISTRIBUTION GMBH"}, + {0x137A ,"MARK OF THE UNICORN INC"}, + {0x137B ,"PPT VISION"}, + {0x137C ,"IWATSU ELECTRIC CO LTD"}, + {0x137D ,"DYNACHIP CORPORATION"}, + {0x1380 ,"SANRITZ AUTOMATION CO LTC"}, + {0x1381 ,"BRAINS CO. LTD"}, + {0x1383 ,"CONTROLNET INC"}, + {0x1384 ,"STELLAR SEMICONDUCTOR INC"}, + {0x1385 ,"NETGEAR"}, + {0x1387 ,"SYSTRAN CORP"}, + {0x1388 ,"HITACHI INFORMATION TECHNOLOGY CO LTD"}, + {0x1389 ,"APPLICOM INTERNATIONAL"}, + {0x138A ,"SITERA"}, + {0x138B ,"TOKIMEC INC"}, + {0x138E ,"BASLER GMBH"}, + {0x138F ,"PATAPSCO DESIGNS INC"}, + {0x1393 ,"MOXA TECHNOLOGIES CO LTD"}, + {0x1394 ,"LEVEL ONE COMMUNICATIONS"}, + {0x1395 ,"AMBICOM INC"}, + {0x1396 ,"CIPHER SYSTEMS INC"}, + {0x1397 ,"COLOGNE CHIP DESIGNS GMBH"}, + {0x1398 ,"CLARION CO. LTD"}, + {0x1399 ,"RIOS SYSTEMS CO LTD"}, + {0x139A ,"ALACRITECH INC"}, + {0x139C ,"QUANTUM 3D INC"}, + {0x139D ,"XSTREAMS PLC/ EPL LIMITED"}, + {0x139E ,"ECHOSTAR DATA NETWORKS"}, + {0x139F ,"AETHRA S.R.L."}, + {0x13A0 ,"CRYSTAL GROUP INC"}, + {0x13A1 ,"KAWASAKI HEAVY INDUSTRIES LTD"}, + {0x13A2 ,"OSITECH COMMUNICATIONS INC"}, + {0x13A4 ,"RASCOM INC"}, + {0x13A7 ,"TELES AG"}, + {0x13A8 ,"EXAR CORP."}, + {0x13A9 ,"SIEMENS MEDICAL SYSTEMS, ULTRASOUND GROUP"}, + {0x13AA ,"NORTEL NETWORKS - BWA DIVISION"}, + {0x13AF ,"T.SQWARE"}, + {0x13B1 ,"TAMURA CORPORATION"}, + {0x13B4 ,"WELLBEAN CO INC"}, + {0x13B5 ,"ARM LTD"}, + {0x13B6 ,"DLOG GMBH"}, + {0x13B8 ,"NOKIA TELECOMMUNICATIONS OY"}, + {0x13BD ,"SHARP CORPORATION"}, + {0x13BF ,"SHAREWAVE INC"}, + {0x13C1 ,"3WARE INC"}, + {0x13C2 ,"TECHNOTREND SYSTEMTECHNIK GMBH"}, + {0x13C3 ,"JANZ COMPUTER AG"}, + {0x13C6 ,"CONDOR ENGINEERING INC"}, + {0x13C7 ,"BLUE CHIP TECHNOLOGY LTD"}, + {0x13CA ,"IOMEGA CORPORATION"}, + {0x13CC ,"METHEUS CORPORATION"}, + {0x13CF ,"STUDIO AUDIO & VIDEO LTD"}, + {0x13D0 ,"B2C2, INC"}, + {0x13D1 ,"ABOCOM SYSTEMS INC"}, + {0x13D2 ,"SHARK MULTIMEDIA INC"}, + {0x13D3 ,"IMC NETWORKS"}, + {0x13D4 ,"GRAPHICS MICROSYSTEMS INC"}, + {0x13D6 ,"K.I. TECHNOLOGY CO LTD"}, + {0x13D7 ,"TOSHIBA ENGINEERING CORPORATION"}, + {0x13D8 ,"PHOBOS CORPORATION"}, + {0x13D9 ,"APEX INC"}, + {0x13DC ,"NETBOOST CORPORATION"}, + {0x13DE ,"ABB ROBOTICS PRODUCTS AB"}, + {0x13DF ,"E-TECH INC"}, + {0x13E0 ,"GVC CORPORATION"}, + {0x13E3 ,"NEST INC"}, + {0x13E4 ,"CALCULEX INC"}, + {0x13E5 ,"TELESOFT DESIGN LTD"}, + {0x13E9 ,"INTRASERVER TECHNOLOGY INC"}, + {0x13EA ,"DALLAS SEMICONDUCTOR"}, + {0x13F0 ,"SUNDANCE TECHNOLOGY INC"}, + {0x13F1 ,"OCE' - TECHNOLOGIES B.V."}, + {0x13F2 ,"FORD MICROELECTRONICS INC"}, + {0x13F4 ,"TROIKA NETWORKS INC"}, + {0x13F6 ,"C-MEDIA ELECTRONICS INC"}, + {0x13F9 ,"NTT ADVANCED TECHNOLOGY CORP."}, + {0x13FB ,"AYDIN CORP"}, + {0x13FD ,"MICRO SCIENCE INC"}, + {0x1400 ,"ARTX INC"}, + {0x1402 ,"MEILHAUS ELECTRONIC GMBH"}, + {0x1404 ,"FUNDAMENTAL SOFTWARE INC"}, + {0x1406 ,"OCE' PRINTING SYSTEMS GMBH"}, + {0x1407 ,"LAVA COMPUTER MFG INC"}, + {0x1408 ,"ALOKA CO. LTD"}, + {0x140A ,"DSP RESEARCH INC"}, + {0x140B ,"RAMIX INC"}, + {0x140D ,"MATSUSHITA ELECTRIC WORKS LTD"}, + {0x1413 ,"ADDONICS"}, + {0x1415 ,"OXFORD SEMICONDUCTOR LTD"}, + {0x1418 ,"KYUSHU ELECTRONICS SYSTEMS INC"}, + {0x1419 ,"EXCEL SWITCHING CORP"}, + {0x141B ,"ZOOM TELEPHONICS INC"}, + {0x141E ,"FANUC LTD"}, + {0x1420 ,"PSION DACOM PLC"}, + {0x1428 ,"EDEC CO LTD"}, + {0x1429 ,"UNEX TECHNOLOGY CORP."}, + {0x142A ,"KINGMAX TECHNOLOGY INC"}, + {0x142B ,"RADIOLAN"}, + {0x142C ,"MINTON OPTIC INDUSTRY CO LTD"}, + {0x142D ,"PIXSTREAM INC"}, + {0x1430 ,"ITT AEROSPACE/COMMUNICATIONS DIVISION"}, + {0x1433 ,"ELTEC ELEKTRONIK GMBH"}, + {0x1436 ,"CIS TECHNOLOGY INC"}, + {0x1437 ,"NISSIN INC CO"}, + {0x1438 ,"ATMEL-DREAM"}, + {0x143F ,"LIGHTWELL CO LTD - ZAX DIVISION"}, + {0x1441 ,"AGIE SA."}, + {0x1445 ,"LOGICAL CO LTD"}, + {0x1446 ,"GRAPHIN CO. LTD"}, + {0x1447 ,"AIM GMBH"}, + {0x144A ,"ADLINK TECHNOLOGY"}, + {0x144B ,"LORONIX INFORMATION SYSTEMS INC"}, + {0x144D ,"SAMSUNG ELECTRONICS CO LTD"}, + {0x1450 ,"OCTAVE COMMUNICATIONS IND."}, + {0x1451 ,"SP3D CHIP DESIGN GMBH"}, + {0x1453 ,"MYCOM INC"}, + {0x1455 ,"LOGIC PLUS PLUS INC"}, + {0x1458 ,"GIGA-BYTE TECHNOLOGY"}, + {0x145C ,"CRYPTEK"}, + {0x145F ,"BALDOR ELECTRIC COMPANY"}, + {0x1460 ,"DYNARC INC"}, + {0x1462 ,"MICRO-STAR INTERNATIONAL CO LTD"}, + {0x1463 ,"FAST CORPORATION"}, + {0x1464 ,"INTERACTIVE CIRCUITS & SYSTEMS LTD"}, + {0x1465 ,"GN NETTEST TELECOM DIV."}, + {0x1468 ,"AMBIT MICROSYSTEMS CORP."}, + {0x1469 ,"CLEVELAND MOTION CONTROLS"}, + {0x146C ,"RUBY TECH CORP."}, + {0x146D ,"TACHYON, INC."}, + {0x146E ,"WILLIAMS ELECTRONICS GAMES, INC."}, + {0x1471 ,"INTEGRATED TELECOM EXPRESS INC"}, + {0x1473 ,"ZAPEX TECHNOLOGIES INC"}, + {0x1474 ,"DOUG CARSON & ASSOCIATES"}, + {0x1477 ,"NET INSIGHT"}, + {0x1478 ,"DIATREND CORPORATION"}, + {0x147B ,"ABIT COMPUTER CORP."}, + {0x147F ,"NIHON UNISYS, LTD."}, + {0x1482 ,"ISYTEC - INTEGRIERTE SYSTEMTECHNIK GMBH"}, + {0x1483 ,"LABWAY COPORATION"}, + {0x1485 ,"ERMA - ELECTRONIC GMBH"}, + {0x1489 ,"KYE SYSTEMS CORPORATION"}, + {0x148A ,"OPTO 22"}, + {0x148B ,"INNOMEDIALOGIC INC."}, + {0x148E ,"OSI PLUS CORPORATION"}, + {0x148F ,"PLANT EQUIPMENT, INC."}, + {0x1490 ,"TC LABS PTY LTD."}, + {0x1493 ,"MAKER COMMUNICATIONS"}, + {0x1495 ,"TOKAI COMMUNICATIONS INDUSTRY CO. LTD"}, + {0x1496 ,"JOYTECH COMPUTER CO., LTD."}, + {0x1497 ,"SMA REGELSYSTEME GMBH"}, + {0x1499 ,"EMTEC CO., LTD"}, + {0x149A ,"ANDOR TECHNOLOGY LTD"}, + {0x149B ,"SEIKO INSTRUMENTS INC"}, + {0x149C ,"OVISLINK CORP."}, + {0x149D ,"NEWTEK INC"}, + {0x149E ,"MAPLETREE NETWORKS INC."}, + {0x149F ,"LECTRON CO LTD"}, + {0x14A0 ,"SOFTING GMBH"}, + {0x14A1 ,"SYSTEMBASE CO LTD"}, + {0x14A2 ,"MILLENNIUM ENGINEERING INC"}, + {0x14A3 ,"MAVERICK NETWORKS"}, + {0x14A4 ,"GVC/BCM ADVANCED RESEARCH"}, + {0x14A5 ,"XIONICS DOCUMENT TECHNOLOGIES INC."}, + {0x14A6 ,"INOVA COMPUTERS GMBH & CO KG"}, + {0x14A8 ,"FEATRON TECHNOLOGIES CORPORATION"}, + {0x14A9 ,"HIVERTEC INC."}, + {0x14AB ,"MENTOR GRAPHICS CORP."}, + {0x14AC ,"NOVAWEB TECHNOLOGIES INC"}, + {0x14AD ,"TIME SPACE RADIO AB"}, + {0x14AE ,"CTI PET SYSTEMS, INC"}, + {0x14AF ,"GUILLEMOT CORPORATION"}, + {0x14B0 ,"BST COMMUNICATION TECHNOLOGY LTD"}, + {0x14B1 ,"NEXTCOM K.K."}, + {0x14B2 ,"ENNOVATE NETWORKS INC"}, + {0x14B3 ,"XPEED INC."}, + {0x14B4 ,"PHILIPS BUSINESS ELECTRONICS B.V."}, + {0x14B5 ,"CREAMWARE GMBH"}, + {0x14B6 ,"QUANTUM DATA CORP."}, + {0x14B7 ,"PROXIM INC"}, + {0x14B8 ,"TECHSOFT TECHNOLOGY CO LTD"}, + {0x14B9 ,"AIRONET WIRELESS COMMUNICATIONS"}, + {0x14BA ,"INTERNIX INC."}, + {0x14BB ,"SEMTECH CORPORATION"}, + {0x14BC ,"GLOBESPAN SEMICONDUCTOR INC."}, + {0x14BD ,"CARDIO CONTROL N.V."}, + {0x14BE ,"L3 COMMUNICATIONS"}, + {0x14BF ,"SPIDER COMMUNICATIONS INC."}, + {0x14C0 ,"COMPAL ELECTRONICS INC"}, + {0x14C1 ,"MYRICOM INC."}, + {0x14C2 ,"DTK COMPUTER"}, + {0x14C3 ,"MEDIATEK CORP."}, + {0x14C4 ,"IWASAKI INFORMATION SYSTEMS CO LTD"}, + {0x14C5 ,"ABB AUTOMATION PRODUCTS AB"}, + {0x14C6 ,"DATA RACE INC"}, + {0x14C7 ,"MODULAR TECHNOLOY HOLDINGS LTD"}, + {0x14C8 ,"TURBOCOMM TECH. INC."}, + {0x14C9 ,"ODIN TELESYSTEMS INC"}, + {0x14CA ,"PE LOGIC CORP."}, + {0x14CB ,"BILLIONTON SYSTEMS INC./CADMUS MICRO INC."}, + {0x14CC ,"NAKAYO TELECOMMUNICATIONS INC"}, + {0x14CD ,"UNIVERSAL SCIENTIFIC IND."}, + {0x14CE ,"WHISTLE COMMUNICATIONS"}, + {0x14CF ,"TEK MICROSYSTEMS INC."}, + {0x14D0 ,"ERICSSON AXE R & D"}, + {0x14D1 ,"COMPUTER HI-TECH CO LTD"}, + {0x14D2 ,"TITAN ELECTRONICS INC"}, + {0x14D3 ,"CIRTECH (UK) LTD"}, + {0x14D4 ,"PANACOM TECHNOLOGY CORP"}, + {0x14D5 ,"NITSUKO CORPORATION"}, + {0x14D6 ,"ACCUSYS INC"}, + {0x14D7 ,"HIRAKAWA HEWTECH CORP"}, + {0x14D8 ,"HOPF ELEKTRONIK GMBH"}, + {0x14D9 ,"ALPHA PROCESSOR INC"}, + {0x14DA ,"NATIONAL AEROSPACE LABORATORIES"}, + {0x14DB ,"AVLAB TECHNOLOGY INC"}, + {0x14DC ,"AMPLICON LIVELINE LTD"}, + {0x14DD ,"IMODL INC."}, + {0x14DE ,"APPLIED INTEGRATION CORPORATION"}, + {0x14DF ,"BASIS COMMUNICATIONS CORP"}, + {0x14E1 ,"INVERTEX"}, + {0x14E2 ,"INFOLIBRIA"}, + {0x14E3 ,"AMTELCO"}, + {0x14E4 ,"BROADCOM CORPORATION"}, + {0x14E5 ,"PIXELFUSION LTD"}, + {0x14E6 ,"SHINING TECHNOLOGY INC"}, + {0x14E7 ,"3CX"}, + {0x14E8 ,"RAYCER INC"}, + {0x14E9 ,"GARNETS SYSTEM CO LTD"}, + {0x14EA ,"PLANEX COMMUNICATIONS INC"}, + {0x14EB ,"SEIKO EPSON CORPORATION"}, + {0x14EC ,"ACQIRIS"}, + {0x14ED ,"DATAKINETICS LTD"}, + {0x14EE ,"MASPRO KENKOH CORP"}, + {0x14EF ,"CARRY COMPUTER ENG. CO LTD"}, + {0x14F0 ,"CANON RESEACH CENTRE FRANCE"}, + {0x14F1 ,"CONEXANT"}, + {0x14F2 ,"MOBILITY ELECTRONICS"}, + {0x14F3 ,"BROADLOGIC"}, + {0x14F4 ,"TOKYO ELECTRONIC INDUSTRY CO LTD"}, + {0x14F5 ,"SOPAC LTD"}, + {0x14F6 ,"COYOTE TECHNOLOGIES LLC"}, + {0x14F7 ,"WOLF TECHNOLOGY INC"}, + {0x14F8 ,"AUDIOCODES INC"}, + {0x14F9 ,"AG COMMUNICATIONS"}, + {0x14FA ,"WAVETEK WANDEL & GOLTERMANN"}, + {0x14FB ,"TRANSAS MARINE (UK) LTD"}, + {0x14FC ,"QUADRICS SUPERCOMPUTERS WORLD"}, + {0x14FD ,"JAPAN COMPUTER INDUSTRY INC."}, + {0x14FE ,"ARCHTEK TELECOM CORP."}, + {0x14FF ,"TWINHEAD INTERNATIONAL CORP."}, + {0x1500 ,"LANTECH COMPUTER COMPANY"}, + {0x1501 ,"BANKSOFT CANADA LTD"}, + {0x1502 ,"MITSUBISHI ELECTRIC LOGISTICS SUPPORT CO LTD"}, + {0x1503 ,"KAWASAKI LSI USA INC"}, + {0x1504 ,"KAISER ELECTRONICS"}, + {0x1505 ,"ITA INGENIEURBURO FUR TESTAUFGABEN GMBH"}, + {0x1506 ,"CHAMELEON SYSTEMS INC"}, + {0x1507 ,"HTEC LTD"}, + {0x1508 ,"HONDA CONNECTORS/MHOTRONICS INC"}, + {0x1509 ,"FIRST INTERNATIONAL COMPUTER INC"}, + {0x150A ,"FORVUS RESEARCH INC"}, + {0x150B ,"YAMASHITA SYSTEMS CORP"}, + {0x150C ,"KYOPAL CO LTD"}, + {0x150D ,"WARPSPPED INC"}, + {0x150E ,"C-PORT CORPORATION"}, + {0x150F ,"INTEC GMBH"}, + {0x1510 ,"BEHAVIOR TECH COMPUTER CORP"}, + {0x1511 ,"CENTILLIUM TECHNOLOGY CORP"}, + {0x1512 ,"ROSUN TECHNOLOGIES INC"}, + {0x1513 ,"RAYCHEM"}, + {0x1514 ,"TFL LAN INC"}, + {0x1515 ,"ICS ADVENT"}, + {0x1516 ,"MYSON TECHNOLOGY INC"}, + {0x1517 ,"ECHOTEK CORPORATION"}, + {0x1518 ,"PEP MODULAR COMPUTERS GMBH"}, + {0x1519 ,"TELEFON AKTIEBOLAGET LM ERICSSON"}, + {0x151A ,"GLOBETEK INC"}, + {0x151B ,"COMBOX LTD"}, + {0x151C ,"DIGITAL AUDIO LABS INC"}, + {0x151D ,"FUJITSU COMPUTER PRODUCTS OF AMERICA"}, + {0x151E ,"MATRIX CORP."}, + {0x151F ,"TOPIC SEMICONDUCTOR CORP"}, + {0x1520 ,"CHAPLET SYSTEM INC"}, + {0x1521 ,"BELL CORPORATION"}, + {0x1522 ,"MAINPINE LIMITED"}, + {0x1523 ,"MUSIC SEMICONDUCTORS"}, + {0x1524 ,"ENE TECHNOLOGY INC"}, + {0x1525 ,"IMPACT TECHNOLOGIES"}, + {0x1526 ,"ISS, INC"}, + {0x1527 ,"SOLECTRON"}, + {0x1528 ,"ACKSYS"}, + {0x1529 ,"AMERICAN MICROSYSTEMS INC"}, + {0x152A ,"QUICKTURN DESIGN SYSTEMS"}, + {0x152B ,"FLYTECH TECHNOLOGY CO LTD"}, + {0x152C ,"MACRAIGOR SYSTEMS LLC"}, + {0x152D ,"QUANTA COMPUTER INC"}, + {0x152E ,"MELEC INC"}, + {0x152F ,"PHILIPS - CRYPTO"}, + {0x1530 ,"ACQIS TECHNOLOGY INC"}, + {0x1531 ,"CHRYON CORP."}, + {0x1532 ,"ECHELON CORPORATION"}, + {0x1533 ,"BALTIMORE"}, + {0x1534 ,"ROAD CORPORATION"}, + {0x1535 ,"EVERGREEN TECHNOLOGIES INC"}, + {0x1537 ,"DATALEX COMMUNCATIONS"}, + {0x1538 ,"ARALION INC."}, + {0x1539 ,"ATELIER INFORMATIQUES ET ELECTRONIQUE ETUDES S.A."}, + {0x153A ,"ONO SOKKI"}, + {0x153B ,"TERRATEC ELECTRONIC GMBH"}, + {0x153C ,"ANTAL ELECTRONIC"}, + {0x153D ,"FILANET CORPORATION"}, + {0x153E ,"TECHWELL INC"}, + {0x153F ,"MIPS DENMARK"}, + {0x1540 ,"PROVIDEO MULTIMEDIA CO LTD"}, + {0x1541 ,"TELOSITY INC."}, + {0x1542 ,"VIVID TECHNOLOGY INC"}, + {0x1543 ,"SILICON LABORATORIES"}, + {0x1544 ,"DCM DATA SYSTEMS"}, + {0x1545 ,"VISIONTEK"}, + {0x1546 ,"IOI TECHNOLOGY CORP."}, + {0x1547 ,"MITUTOYO CORPORATION"}, + {0x1548 ,"JET PROPULSION LABORATORY"}, + {0x1549 ,"INTERCONNECT SYSTEMS SOLUTIONS"}, + {0x154A ,"MAX TECHNOLOGIES INC."}, + {0x154B ,"COMPUTEX CO LTD"}, + {0x154C ,"VISUAL TECHNOLOGY INC."}, + {0x154D ,"PAN INTERNATIONAL INDUSTRIAL CORP"}, + {0x154E ,"SERVOTEST LTD"}, + {0x154F ,"STRATABEAM TECHNOLOGY"}, + {0x1550 ,"OPEN NETWORK CO LTD"}, + {0x1551 ,"SMART ELECTRONIC DEVELOPMENT GMBH"}, + {0x1552 ,"RACAL AIRTECH LTD"}, + {0x1553 ,"CHICONY ELECTRONICS CO LTD"}, + {0x1554 ,"PROLINK MICROSYSTEMS CORP."}, + {0x1555 ,"GESYTEC GMBH"}, + {0x1556 ,"PLD APPLICATIONS"}, + {0x1557 ,"MEDIASTAR CO. LTD"}, + {0x1558 ,"CLEVO/KAPOK COMPUTER"}, + {0x1559 ,"SI LOGIC LTD"}, + {0x155A ,"INNOMEDIA INC"}, + {0x155B ,"PROTAC INTERNATIONAL CORP"}, + {0x155C ,"CEMAX-ICON INC"}, + {0x155D ,"MAC SYSTEM CO LTD"}, + {0x155E ,"LP ELEKTRONIK GMBH"}, + {0x155F ,"PERLE SYSTEMS LIMITED"}, + {0x1560 ,"TERAYON COMMUNICATIONS SYSTEMS"}, + {0x1561 ,"VIEWGRAPHICS INC"}, + {0x1562 ,"SYMBOL TECHNOLOGIES"}, + {0x1563 ,"A-TREND TECHNOLOGY CO LTD"}, + {0x1564 ,"YAMAKATSU ELECTRONICS INDUSTRY CO LTD"}, + {0x1565 ,"BIOSTAR MICROTECH INT'L CORP"}, + {0x1566 ,"ARDENT TECHNOLOGIES INC"}, + {0x1567 ,"JUNGSOFT"}, + {0x1568 ,"DDK ELECTRONICS INC"}, + {0x1569 ,"PALIT MICROSYSTEMS INC"}, + {0x156A ,"AVTEC SYSTEMS"}, + {0x156B ,"2WIRE, INC"}, + {0x156C ,"VIDAC ELECTRONICS GMBH"}, + {0x156D ,"ALPHA-TOP CORP"}, + {0x156E ,"ALFA INC."}, + {0x156F ,"M-SYSTEMS FLASH DISK PIONEERS LTD"}, + {0x1570 ,"LECROY CORPORATION"}, + {0x1571 ,"CONTEMPORARY CONTROLS"}, + {0x1572 ,"OTIS ELEVATOR COMPANY"}, + {0x1573 ,"LATTICE - VANTIS"}, + {0x1574 ,"FAIRCHILD SEMICONDUCTOR"}, + {0x1575 ,"VOLTAIRE ADVANCED DATA SECURITY LTD"}, + {0x1576 ,"VIEWCAST COM"}, + {0x1578 ,"HITT"}, + {0x1579 ,"DUAL TECHNOLOGY CORPORATION"}, + {0x157A ,"JAPAN ELECRONICS IND. INC"}, + {0x157B ,"STAR MULTIMEDIA CORP."}, + {0x157C ,"EUROSOFT (UK) LTD"}, + {0x157D ,"GEMFLEX NETWORKS"}, + {0x157E ,"TRANSITION NETWORKS"}, + {0x157F ,"PX INSTRUMENTS TECHNOLOGY LTD"}, + {0x1580 ,"PRIMEX AEROSPACE CO."}, + {0x1581 ,"SEH COMPUTERTECHNIK GMBH"}, + {0x1582 ,"CYTEC CORPORATION"}, + {0x1583 ,"INET TECHNOLOGIES INC"}, + {0x1584 ,"UNIWILL COMPUTER CORP."}, + {0x1585 ,"LOGITRON"}, + {0x1586 ,"LANCAST INC"}, + {0x1587 ,"KONICA CORPORATION"}, + {0x1588 ,"SOLIDUM SYSTEMS CORP"}, + {0x1589 ,"ATLANTEK MICROSYSTEMS PTY LTD"}, + {0x158A ,"DIGALOG SYSTEMS INC"}, + {0x158B ,"ALLIED DATA TECHNOLOGIES"}, + {0x158C ,"HITACHI SEMICONDUCTOR & DEVICES SALES CO LTD"}, + {0x158D ,"POINT MULTIMEDIA SYSTEMS"}, + {0x158E ,"LARA TECHNOLOGY INC"}, + {0x158F ,"DITECT COOP"}, + {0x1590 ,"3PARDATA INC."}, + {0x1591 ,"ARN"}, + {0x1592 ,"SYBA TECH LIMITED"}, + {0x1593 ,"BOPS INC"}, + {0x1594 ,"NETGAME LTD"}, + {0x1595 ,"DIVA SYSTEMS CORP."}, + {0x1596 ,"FOLSOM RESEARCH INC"}, + {0x1597 ,"MEMEC DESIGN SERVICES"}, + {0x1598 ,"GRANITE MICROSYSTEMS"}, + {0x1599 ,"DELTA ELECTRONICS INC"}, + {0x159A ,"GENERAL INSTRUMENT"}, + {0x159B ,"FARADAY TECHNOLOGY CORP"}, + {0x159C ,"STRATUS COMPUTER SYSTEMS"}, + {0x159D ,"NINGBO HARRISON ELECTRONICS CO LTD"}, + {0x159E ,"A-MAX TECHNOLOGY CO LTD"}, + {0x159F ,"GALEA NETWORK SECURITY"}, + {0x15A0 ,"COMPUMASTER SRL"}, + {0x15A1 ,"GEOCAST NETWORK SYSTEMS INC"}, + {0x15A2 ,"CATALYST ENTERPRISES INC"}, + {0x15A3 ,"ITALTEL"}, + {0x15A4 ,"X-NET OY"}, + {0x15A5 ,"TOYOTA MACS INC"}, + {0x15A6 ,"SUNLIGHT ULTRASOUND TECHNOLOGIES LTD"}, + {0x15A7 ,"SSE TELECOM INC"}, + {0x15A8 ,"SHANGHAI COMMUNICATIONS TECHNOLOGIES CENTER"}, + {0x15AA ,"MORETON BAY"}, + {0x15AB ,"BLUESTEEL NETWORKS INC"}, + {0x15AC ,"NORTH ATLANTIC INSTRUMENTS"}, + {0x15AD ,"VMWARE"}, + {0x15AE ,"AMERSHAM PHARMACIA BIOTECH"}, + {0x15B0 ,"ZOLTRIX INTERNATIONAL LIMITED"}, + {0x15B1 ,"SOURCE TECHNOLOGY INC"}, + {0x15B2 ,"MOSAID TECHNOLOGIES INC."}, + {0x15B3 ,"MELLANOX TECHNOLOGY"}, + {0x15B4 ,"CCI/TRIAD"}, + {0x15B5 ,"CIMETRICS INC"}, + {0x15B6 ,"TEXAS MEMORY SYSTEMS INC"}, + {0x15B7 ,"SANDISK CORP."}, + {0x15B8 ,"ADDI-DATA GMBH"}, + {0x15B9 ,"MAESTRO DIGITAL COMMUNICATIONS"}, + {0x15BA ,"IMPACCT TECHNOLOGY CORP"}, + {0x15BB ,"PORTWELL INC"}, + {0x15BC ,"AGILENT TECHNOLOGIES"}, + {0x15BD ,"DFI INC."}, + {0x15BE ,"SOLA ELECTRONICS"}, + {0x15BF ,"HIGH TECH COMPUTER CORP (HTC)"}, + {0x15C0 ,"BVM LIMITED"}, + {0x15C1 ,"QUANTEL"}, + {0x15C2 ,"NEWER TECHNOLOGY INC"}, + {0x15C3 ,"TAIWAN MYCOMP CO LTD"}, + {0x15C4 ,"EVSX, INC"}, + {0x15C5 ,"PROCOMP INFORMATICS LTD"}, + {0x15C6 ,"TECHNICAL UNIVERSITY OF BUDAPEST"}, + {0x15C7 ,"TATEYAMA SYSTEM LABORATORY CO LTD"}, + {0x15C8 ,"PENTA MEDIA CO. LTD"}, + {0x15C9 ,"SEROME TECHNOLOGY INC"}, + {0x15CA ,"BITBOYS OY"}, + {0x15CB ,"AG ELECTRONICS LTD"}, + {0x15CC ,"HOTRAIL INC."}, + {0x15CD ,"DREAMTECH CO LTD"}, + {0x15CE ,"GENRAD INC."}, + {0x15CF ,"HILSCHER GMBH"}, + {0x15D1 ,"INFINEON TECHNOLOGIES AG"}, + {0x15D2 ,"FIC (FIRST INTERNATIONAL COMPUTER INC)"}, + {0x15D3 ,"NDS TECHNOLOGIES ISRAEL LTD"}, + {0x15D4 ,"IWILL CORPORATION"}, + {0x15D5 ,"TATUNG CO."}, + {0x15D6 ,"ENTRIDIA CORPORATION"}, + {0x15D7 ,"ROCKWELL-COLLINS, INC"}, + {0x15D8 ,"CYBERNETICS TECHNOLOGY CO LTD"}, + {0x15D9 ,"SUPER MICRO COMPUTER INC"}, + {0x15DA ,"CYBERFIRM INC."}, + {0x15DB ,"APPLIED COMPUTING SYSTEMS INC."}, + {0x15DC ,"LITRONIC INC"}, + {0x15DD ,"SIGMATEL INC."}, + {0x15DE ,"MALLEABLE TECHNOLOGIES INC"}, + {0x15DF ,"INFINILINK CORP."}, + {0x15E0 ,"CACHEFLOW INC"}, + {0x15E1 ,"VOICE TECHNOLOGIES GROUP INC."}, + {0x15E2 ,"QUICKNET TECHNOLOGIES INC"}, + {0x15E3 ,"NETWORTH TECHNOLOGIES INC"}, + {0x15E4 ,"VSN SYSTEMEN BV"}, + {0x15E5 ,"VALLEY TECHNOLOGIES INC"}, + {0x15E6 ,"AGERE INC."}, + {0x15E7 ,"GET ENGINEERING CORP."}, + {0x15E8 ,"NATIONAL DATACOMM CORP."}, + {0x15E9 ,"PACIFIC DIGITAL CORP."}, + {0x15EA ,"TOKYO DENSHI SEKEI K.K."}, + {0x15EB ,"DRSEARCH GMBH"}, + {0x15EC ,"BECKHOFF GMBH"}, + {0x15ED ,"MACROLINK INC"}, + {0x15EE ,"IN WIN DEVELOPMENT INC."}, + {0x15EF ,"INTELLIGENT PARADIGM INC"}, + {0x15F0 ,"B-TREE SYSTEMS INC"}, + {0x15F1 ,"TIMES N SYSTEMS INC"}, + {0x15F2 ,"DIAGNOSTIC INSTRUMENTS INC"}, + {0x15F3 ,"DIGITMEDIA CORP."}, + {0x15F4 ,"VALUESOFT"}, + {0x15F5 ,"POWER MICRO RESEARCH"}, + {0x15F6 ,"EXTREME PACKET DEVICE INC"}, + {0x15F7 ,"BANCTEC"}, + {0x15F8 ,"KOGA ELECTRONICS CO"}, + {0x15F9 ,"ZENITH ELECTRONICS CORPORATION"}, + {0x15FA ,"J.P. AXZAM CORPORATION"}, + {0x15FB ,"ZILOG INC."}, + {0x15FC ,"TECHSAN ELECTRONICS CO LTD"}, + {0x15FD ,"N-CUBED.NET"}, + {0x15FE ,"KINPO ELECTRONICS INC"}, + {0x15FF ,"FASTPOINT TECHNOLOGIES INC."}, + {0x1600 ,"NORTHROP GRUMMAN - CANADA LTD"}, + {0x1601 ,"TENTA TECHNOLOGY"}, + {0x1602 ,"PROSYS-TEC INC."}, + {0x1603 ,"NOKIA WIRELESS BUSINESS COMMUNICATIONS"}, + {0x1604 ,"CENTRAL SYSTEM RESEARCH CO LTD"}, + {0x1605 ,"PAIRGAIN TECHNOLOGIES"}, + {0x1606 ,"EUROPOP AG"}, + {0x1607 ,"LAVA SEMICONDUCTOR MANUFACTURING INC."}, + {0x1608 ,"AUTOMATED WAGERING INTERNATIONAL"}, + {0x1609 ,"SCIEMETRIC INSTRUMENTS INC"}, + {0x1813 ,"AMBIENT TECHNOLOGIES INC"}, + {0x1B13 ,"JATON CORP"}, + {0x2001 ,"TEMPORAL RESEARCH LTD"}, + {0x270F ,"CHAINTECH COMPUTER CO. LTD"}, + {0x3388 ,"HINT CORP"}, + {0x3411 ,"QUANTUM DESIGNS (H.K.) INC."}, + {0x4005 ,"AVANCE LOGIC INC"}, + {0x4033 ,"DELTA NETWORKS INC"}, + {0x416C ,"ALADDIN KNOWLEDGE SYSTEMS"}, + {0x4444 ,"ICOMPRESION INC."}, + {0x4943 ,"GROWTH NETWORKS"}, + {0x4CA1 ,"SEANIX TECHNOLOGY INC"}, + {0x4D51 ,"MEDIAQ INC."}, + {0x4D54 ,"MICROTECHNICA CO LTD"}, + {0x5136 ,"S S TECHNOLOGIES"}, + {0x5333 ,"S3 INC."}, + {0x544C ,"TERALOGIC INC"}, + {0x5555 ,"GENROCO INC"}, + {0x6409 ,"LOGITEC CORP."}, + {0x6666 ,"DECISION COMPUTER INTERNATIONAL CO."}, + {0x8086 ,"INTEL CORP."}, + {0x8888 ,"SILICON MAGIC CORP."}, + {0x8E0E ,"COMPUTONE CORPORATION"}, + {0x9004 ,"ADAPTEC"}, + {0x919A ,"GIGAPIXEL CORP"}, + {0x9699 ,"OMNI MEDIA TECHNOLOGY INC."}, + {0xA0A0 ,"AOPEN INC."}, + {0xA0F1 ,"UNISYS CORPORATION"}, + {0xA259 ,"HEWLETT PACKARD"}, + {0xAC1E ,"DIGITAL RECEIVER TECHNOLOGY INC"}, + {0xC0DE ,"MOTOROLA"}, + {0xC0FE ,"MOTION ENGINEERING, INC."}, + {0xCA50 ,"VARIAN AUSTRIALIA PTY LTD"}, + {0xCAFE ,"CHRYSALIS-ITS"}, + {0xCCCC ,"CATAPULT COMMUNICATIONS"}, + {0xD4D4 ,"DY4 SYSTEMS INC"}, + {0xE4BF ,"EKF ELEKTRONIK GMBH"}, + {0xEA01 ,"EAGLE TECHNOLOGY"}, + {0xFA57 ,"FAST SEARCH & TRANSFER ASA"}, + {0xFEDA ,"EPIGRAM INC"} +}; diff --git a/rosapps/sysutils/utils/pice/module/pgflt.c b/rosapps/sysutils/utils/pice/module/pgflt.c new file mode 100644 index 00000000000..6306f4b278b --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/pgflt.c @@ -0,0 +1,402 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + pgflt.c + +Abstract: + + page fault handling on x86 + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 25-Nov-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" + +#include "precomp.h" + +//////////////////////////////////////////////////// +// GLOBALS +//// + +char tempPageFault[1024]; +extern void NewInt31Handler(void); + +ULONG OldIntEHandler=0; +ULONG error_code; +BOOLEAN bInPageFaultHandler = FALSE; +static ULONG PCR_SEL = PCR_SELECTOR; +static ULONG OLD_PCR; + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// HandleInDebuggerFault() +// +//************************************************************************* +ULONG HandleInDebuggerFault(FRAME* ptr,ULONG address) +{ + PEPROCESS tsk; + + ENTER_FUNC(); + + DPRINT((0,"HandleInDebuggerFault(): ###### page fault @ %.8X while inside debugger, eip: %x\n",address, ptr->eip)); + + // fault in this page fault handler + if(bInPageFaultHandler) + { + DPRINT((0,"HandleInDebuggerFault(): ###### page fault @ %.8X while in page fault handler\n",address)); + + DPRINT((0,"!!! machine is halted !!!\n")); + __asm__ __volatile__ ("hlt"); + + LEAVE_FUNC(); + return 0; + } + + bInPageFaultHandler = TRUE; + + // when we come here from DebuggerShell() we live on a different stack + // so the current task is different as well + tsk = IoGetCurrentProcess(); + + DPRINT((0,"%.8X (%.4X:%.8X %.8X %s %s %s task=%.8X )\n", + address, + ptr->cs, + ptr->eip, + ptr->eflags, + (ptr->error_code&1)?"PLP":"NP", + (ptr->error_code&2)?"WRITE":"READ", + (ptr->error_code&4)?"USER-MODE":"KERNEL-MODE", + (ULONG)tsk)); + + if(!bInPrintk) + { + DPRINT((0,"HandleInDebuggerFault(): unexpected pagefault in command handler!\n",address)); + } + else + { + DPRINT((0,"HandleInDebuggerFault(): unexpected pagefault in command handler while in PrintkCallback()!\n",address)); + } + + if(tsk) + { + PULONG pPGD; + PULONG pPTE; + + pPGD = ADDR_TO_PDE(address); + + DPRINT((0,"PGD for %.8X @ %.8X = %.8X\n",address,(ULONG)pPGD,(ULONG)(*pPGD) )); + + if(pPGD && (*pPGD)&_PAGE_PRESENT) + { + // not large page + if(!((*pPGD)&_PAGE_4M)) + { + pPTE = ADDR_TO_PTE(address); + if(pPTE) + { + DPRINT((0,"PTE for %.8X @ %.8X = %.8X\n",address,(ULONG)pPTE,(ULONG)(*pPTE) )); + } + } + } + } + + IntelStackWalk(ptr->eip,CurrentEBP,ulRealStackPtr); + + DPRINT((0,"!!! machine is halted !!!\n")); + __asm__ __volatile__ ("hlt"); + + LEAVE_FUNC(); + + return 2; +} + +//************************************************************************* +// HandlePageFault() +// +// returns: +// 0 = let the system handle it +// 1 = call DebuggerShell() +// 2 = FATAL error inside debugger +//************************************************************************* +ULONG HandlePageFault(FRAME* ptr) +{ + PVOID address; + PEPROCESS tsk, tsk1; + PMADDRESS_SPACE vma; + PLIST_ENTRY current_entry; + MEMORY_AREA* current; + ULONG value; + PKTHREAD CurrentThread; + PETHREAD CurrentEThread; + + // get linear address of page fault + __asm__ __volatile__("movl %%cr2,%0" + :"=r" (address)); + + DPRINT((0,"\nPageFault: bInDebShell: %d, error: %d, addr: %x\n", bInDebuggerShell, ptr->error_code, address)); + + // there's something terribly wrong if we get a fault in our command handler + if(bInDebuggerShell) + { + DPRINT((0,"return handleindebuggerfault\n")); + return HandleInDebuggerFault(ptr,(ULONG)address); + } + + ASSERT(IsAddressValid((ULONG)ptr)); + // remember error code so we can push it back on the stack + error_code = ptr->error_code; + + //ei Check IRQL here!!! +/* + if(in_interrupt()) + { + Print(OUTPUT_WINDOW,"pICE: system is currently processing an interrupt!\n"); + return 1; + } +*/ + // current process + tsk = IoGetCurrentProcess(); + DPRINT((0,"tsk: %x\t", tsk)); + if( !tsk || !(IsAddressValid((ULONG)tsk))){ + DPRINT((0,"tsk address not valid: tsk: %x\n", tsk)); + return 0; + } + + // lookup VMA for this address + if( (ULONG)address > KERNEL_BASE ) + vma = my_init_mm; // use kernel mem area for kernel addresses + else vma = &(tsk->AddressSpace); // otherwise, use user memory area + + if( !vma ){ + DPRINT((0,"vma not valid: vma: %x\n", vma)); + return 0; + } + + current_entry = vma->MAreaListHead.Flink; + ASSERT(current_entry); + DPRINT((0,"vma: %x, current_entry: %x, kernel arena: %x\n", vma, current_entry, my_init_mm)); + while(current_entry != &vma->MAreaListHead) + { + ASSERT(current_entry); + ASSERT(IsAddressValid((ULONG)current_entry)); + current = CONTAINING_RECORD(current_entry, + MEMORY_AREA, + Entry); + + + if( (address >= current->BaseAddress) && (address <= current->BaseAddress + current->Length )) + { + DPRINT((0,"address: %x %x - %x Attrib: %x, Type: %x\n", address, current->BaseAddress, current->BaseAddress + current->Length, current->Attributes, current->Type)); + //page not present + if( !(error_code & 1) ){ + //check it is in pageable area + if( current->Type == MEMORY_AREA_SECTION_VIEW || + current->Type == MEMORY_AREA_VIRTUAL_MEMORY || + current->Type == MEMORY_AREA_PAGED_POOL || + current->Type == MEMORY_AREA_SHARED_DATA + ){ + //ei too much output Print(OUTPUT_WINDOW,"pICE: VMA Pageable Section.\n"); + //ei DPRINT((0,"return 0 1\n")); + return 0; //let the system handle this + } + Print(OUTPUT_WINDOW,"pICE: VMA Page not present in non-pageable Section!\n"); + //ei DPRINT((0,"Type: currenttype: %x return 1 2\n", current->Type)); + return 0; + } + else{ //access violation + + if( error_code & 4 ) + { //user mode + if( (ULONG)address >= KERNEL_BASE ) + { + Print(OUTPUT_WINDOW,"pICE: User mode program trying to access kernel memory!\n"); + //DPRINT((0,"return 0 3\n")); + return 1; + } + //DPRINT((0,"return 0 4\n")); + return 0; + } + /* + if(error_code & 2) + { + //on write + if(!(current->Attributes & PAGE_READONLY)) + { + Print(OUTPUT_WINDOW,"pICE: virtual memory arena is not writeable!\n"); + return 1; + } + } + // READ ACCESS + else + { + // test EXT bit in error code + if (error_code & 1) + { + Print(OUTPUT_WINDOW,"pICE: page-level protection fault!\n"); + return 1; + } + // + */ + /* + if (!(current->Attributes & PAGE_EXECUTE_READ)) + { + Print(OUTPUT_WINDOW,"pICE: VMA is not readable!\n"); + return 1; + } + */ + + // let the system handle it + //DPRINT((0,"return 0 5\n")); + return 0; + } + } + current_entry = current_entry->Flink; + } + + Print(OUTPUT_WINDOW,"pICE: no virtual memory arena at this address!\n"); + DPRINT((0,"return 0 6\n")); + return 1; + + // let the system handle it +// return 0; +} + +//************************************************************************* +// NewIntEHandler() +// +//************************************************************************* +__asm__ ("\n\t \ +NewIntEHandler:\n\t \ + pushfl\n\t \ + cli\n\t \ + cld\n\t \ + pushal\n\t \ + pushl %ds\n\t \ +\n\t \ + // setup default data selectors\n\t \ + movw %ss,%ax\n\t \ + movw %ax,%ds\n\t \ +\n\t \ + /*\n\t \ + * Load the PCR selector.\n\t \ + */\n\t \ + movl %fs, %eax\n\t \ + movl %eax, _OLD_PCR\n\t \ + movl _PCR_SEL, %eax\n\t \ + movl %eax, %fs\n\t \ +\n\t \ + // get frame ptr\n\t \ + lea 40(%esp),%eax\n\t \ + pushl %eax\n\t \ + call _HandlePageFault\n\t \ + addl $4,%esp\n\t \ +\n\t \ + pushl %eax\n\t \ + movl _OLD_PCR, %eax\n\t \ + movl %eax, %fs\n\t \ + popl %eax\n\t \ +\n\t \ + cmpl $0,%eax\n\t \ + je call_old_inte_handler\n\t \ +\n\t \ + cmpl $2,%eax\n\t \ + je call_handler_unknown_reason\n\t \ +\n\t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ + // remove error code. will be restored later when we call\n\t \ + // original handler again.\n\t \ + addl $4,%esp\n\t \ + // call debugger loop\n\t \ + pushl $" STR(REASON_PAGEFAULT) "\n\t \ + jmp NewInt31Handler\n\t \ +\n\t \ +call_old_inte_handler:\n\t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ + // chain to old handler\n\t \ + .byte 0x2e\n\t \ + jmp *_OldIntEHandler\n\t \ +\n\t \ +call_handler_unknown_reason:\n\t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ + // remove error code. will be restored later when we call\n\t \ + // original handler again.\n\t \ + addl $4,%esp\n\t \ + // call debugger loop\n\t \ + pushl $" STR(REASON_INTERNAL_ERROR) "\n\t \ + jmp NewInt31Handler\n\t \ + "); + + +//************************************************************************* +// InstallIntEHook() +// +//************************************************************************* +void InstallIntEHook(void) +{ + ULONG LocalIntEHandler; + + ENTER_FUNC(); + + MaskIrqs(); + if(!OldIntEHandler) + { + __asm__ __volatile__("mov $NewIntEHandler,%0" + :"=r" (LocalIntEHandler) + : + :"eax"); + OldIntEHandler=SetGlobalInt(0x0E,(ULONG)LocalIntEHandler); + } + UnmaskIrqs(); + DPRINT((0,"OldIntE @ %x\n", OldIntEHandler)); + LEAVE_FUNC(); +} + +//************************************************************************* +// DeInstallIntEHook() +// +//************************************************************************* +void DeInstallIntEHook(void) +{ + ENTER_FUNC(); + + MaskIrqs(); + if(OldIntEHandler) + { + SetGlobalInt(0x0E,(ULONG)OldIntEHandler); + OldIntEHandler=0; + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} diff --git a/rosapps/sysutils/utils/pice/module/pgflt.h b/rosapps/sysutils/utils/pice/module/pgflt.h new file mode 100644 index 00000000000..41cea22723d --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/pgflt.h @@ -0,0 +1,34 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + pgflt.h + +Abstract: + + HEADER for pgflt.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void InstallIntEHook(void); +void DeInstallIntEHook(void); + +extern ULONG error_code; diff --git a/rosapps/sysutils/utils/pice/module/pice.rc b/rosapps/sysutils/utils/pice/module/pice.rc new file mode 100644 index 00000000000..b5fd480136e --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/pice.rc @@ -0,0 +1,7 @@ +/* $Id$ */ + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "PICE Debugger\0" +#define REACTOS_STR_INTERNAL_NAME "pice\0" +#define REACTOS_STR_ORIGINAL_FILENAME "pice.sys\0" +#include diff --git a/rosapps/sysutils/utils/pice/module/pice_ver.h b/rosapps/sysutils/utils/pice/module/pice_ver.h new file mode 100644 index 00000000000..d55858e6260 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/pice_ver.h @@ -0,0 +1,36 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + pice_ver.h + +Abstract: + + HEADER , pICE debugger version + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +// versions below 1.0 are BETA +#define PICE_MAJOR_VERSION (0) +#define PICE_MINOR_VERSION (99) +// reset this on major or minor version change +// increment this on every release build +#define PICE_BUILD (0007) diff --git a/rosapps/sysutils/utils/pice/module/precomp.h b/rosapps/sysutils/utils/pice/module/precomp.h new file mode 100644 index 00000000000..996bc38526f --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/precomp.h @@ -0,0 +1,65 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + precomp.h + +Abstract: + + precompiled headers + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#define FRAMEBUFFER_SIZE (0x8000) +#define LINES_IN_BUFFER (2048) + +#include +#include +#include +//#include +#include +#include +#include + +#include "retypes.h" +//#include +#include "../shared/shared.h" +#include "debug.h" +#include "hardware.h" +#include "utils.h" +#include "init.h" +#include "shell.h" +#include "trace.h" +#include "hooks.h" +#include "patch.h" // patch the keyboard driver +#include "symbols.h" +#include "parse.h" +#include "syscall.h" +#include "bp.h" +#include "scancodes.h" +#include "output.h" +#include "dblflt.h" +#include "pgflt.h" +#include "gpfault.h" +#include "serial.h" +#include "hercules.h" +#include "vga.h" +#include "pice_ver.h" diff --git a/rosapps/sysutils/utils/pice/module/privateice.c b/rosapps/sysutils/utils/pice/module/privateice.c new file mode 100644 index 00000000000..918011d798b --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/privateice.c @@ -0,0 +1,203 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + privateice.c + +Abstract: + +Environment: + +Author: + + Klaus P. Gerlicher + + reactos port by: + Eugene Ingerman + +Revision History: + + 16-Jul-1998: created + 15-Nov-2000: general cleanup of source files + 19-Jan-2001: renamed to privateice.c + + 10/20/2001: porting to reactos begins + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +/* +#include +#include +#include +#include +#include +#include +#include +#include +*/ + +#include +#include +#include + +#include "precomp.h" +#include "serial.h" + +//////////////////////////////////////////////////// +// GLOBALS +//// + +BOOLEAN bDeviceAlreadyOpen = FALSE; + +char tempPICE[1024]; + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// pice_open() +// +//************************************************************************* + +NTSTATUS STDCALL pice_open(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT((0,"pice_open\n")); + + /* We don't want to talk to two processes at the + * same time */ + if (bDeviceAlreadyOpen){ + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; /* is there a more descriptive status code for this case? */ + } + + bDeviceAlreadyOpen = TRUE; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +//************************************************************************* +// pice_close() +// +//************************************************************************* +NTSTATUS STDCALL pice_close(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ + DPRINT((0,"pice_close\n")); + + CleanUpPICE(); // used to be in cleanup_module + + /* We're now ready for our next caller */ + bDeviceAlreadyOpen = FALSE; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + + +//************************************************************************* +// pice_ioctl() +// +//************************************************************************* + +NTSTATUS STDCALL pice_ioctl(PDEVICE_OBJECT DeviceObject, PIRP Irp) +{ +// char* pFilename = (char*) ioctl_param; + + PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation( Irp ); + + ULONG Code = IoStack->Parameters.DeviceIoControl.IoControlCode; + + switch(Code) + { + case PICE_IOCTL_LOAD: + break; + case PICE_IOCTL_RELOAD: + if(!ReloadSymbols()) + { + PICE_sprintf(tempPICE,"pICE: not able to reload symbols\n"); + Print(OUTPUT_WINDOW,tempPICE); + } + break; + case PICE_IOCTL_UNLOAD: + UnloadSymbols(); + break; + case PICE_IOCTL_BREAK: + PICE_sprintf(tempPICE,"pICE: forcible break\n"); + Print(OUTPUT_WINDOW,tempPICE); + __asm__ __volatile("int $3"); + break; + case PICE_IOCTL_STATUS: + { + PDEBUGGER_STATUS_BLOCK ustatus_block_p; + DEBUGGER_STATUS_BLOCK kstatus_block; + + ULONG OutLength = IoStack->Parameters.DeviceIoControl.OutputBufferLength; + if( OutLength < sizeof( DEBUGGER_STATUS_BLOCK ) ){ + return STATUS_INVALID_PARAMETER; + } + + ustatus_block_p = (PDEBUGGER_STATUS_BLOCK)Irp->AssociatedIrp.SystemBuffer; + + //kstatus_block.Test = 0x12345678; + RtlCopyMemory(ustatus_block_p, &kstatus_block, sizeof(DEBUGGER_STATUS_BLOCK) ); + } + break; + default: + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + + +NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Module entry point + */ +{ + PDEVICE_OBJECT DeviceObject; + UNICODE_STRING DeviceName; + UNICODE_STRING SymlinkName; + + DPRINT((0,"PICE Debugger\n")); + +#if 0 // don't enable before completely ported +#ifdef DEBUG + // first we enable output of debug strings to COM port + DebugSetupSerial(1,115200); +#endif // DEBUG +#endif + + if(InitPICE()){ + DriverObject->MajorFunction[IRP_MJ_CREATE] = pice_open; + //ei unimplemented DriverObject->MajorFunction[IRP_MJ_CLOSE] = pice_close; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = pice_ioctl; + + RtlRosInitUnicodeStringFromLiteral(&DeviceName, L"\\Device\\Pice"); + IoCreateDevice(DriverObject, + 0, + &DeviceName, + PICE_DEVICE_DEBUGGER, + 0, + TRUE, + &DeviceObject); + DeviceObject->Flags = DeviceObject->Flags | DO_BUFFERED_IO; + + RtlRosInitUnicodeStringFromLiteral(&SymlinkName, L"\\??\\Pice"); + IoCreateSymbolicLink(&SymlinkName, &DeviceName); + + return(STATUS_SUCCESS); + } +} + diff --git a/rosapps/sysutils/utils/pice/module/regs.h b/rosapps/sysutils/utils/pice/module/regs.h new file mode 100644 index 00000000000..3d5c5dda74d --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/regs.h @@ -0,0 +1,122 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + regs.h + +Abstract: + + HEADER for disasm.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +#define REGGS 0 +#define REGFS 1 +#define REGES 2 +#define REGDS 3 +#define REGEDI 4 +#define REGESI 5 +#define REGEBX 6 +#define REGEDX 7 +#define REGECX 8 +#define REGEAX 9 +#define REGEBP 10 +#define REGEIP 11 +#define REGCS 12 +#define REGEFL 13 +#define REGESP 14 +#define REGSS 15 + +#ifdef KERNEL +#define REGCR0 16 +#define REGCR2 17 +#define REGCR3 18 +#define REGCR4 19 +#endif + +#define REGDR0 20 +#define REGDR1 21 +#define REGDR2 22 +#define REGDR3 23 +#define REGDR6 24 +#define REGDR7 25 + +#ifdef KERNEL +#define REGGDTR 26 +#define REGGDTL 27 +#define REGIDTR 28 +#define REGIDTL 29 +#define REGTR 30 +#define REGLDTR 31 +#endif + +// Pseudo-registers: +#define PREGEA 40 +#define PREGBASE PREGEA +#define PREGEXP 41 +#define PREGRA 42 +#define PREGP 43 +#define PREGU0 44 +#define PREGU1 45 +#define PREGU2 46 +#define PREGU3 47 +#define PREGU4 48 +#define PREGU5 49 +#define PREGU6 50 +#define PREGU7 51 +#define PREGU8 52 +#define PREGU9 53 + +#define FLAGBASE 100 +#define REGDI 100 +#define REGSI 101 +#define REGBX 102 +#define REGDX 103 +#define REGCX 104 +#define REGAX 105 +#define REGBP 106 +#define REGIP 107 +#define REGFL 108 +#define REGSP 109 +#define REGBL 110 +#define REGDL 111 +#define REGCL 112 +#define REGAL 113 +#define REGBH 114 +#define REGDH 115 +#define REGCH 116 +#define REGAH 117 +#define FLAGIOPL 118 +#define FLAGOF 119 +#define FLAGDF 120 +#define FLAGIF 121 +#define FLAGTF 122 +#define FLAGSF 123 +#define FLAGZF 124 +#define FLAGAF 125 +#define FLAGPF 126 +#define FLAGCF 127 +#define FLAGVIP 128 +#define FLAGVIF 129 + + +#define REGFIR REGEIP diff --git a/rosapps/sysutils/utils/pice/module/remods.h b/rosapps/sysutils/utils/pice/module/remods.h new file mode 100644 index 00000000000..ce98bda955c --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/remods.h @@ -0,0 +1,33 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + remods.h + +Abstract: + + HEADER for kernel module creation + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + + + diff --git a/rosapps/sysutils/utils/pice/module/retypes.h b/rosapps/sysutils/utils/pice/module/retypes.h new file mode 100644 index 00000000000..8dc77f05f8f --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/retypes.h @@ -0,0 +1,52 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + retypes.h + +Abstract: + + HEADER for type remapping (porting from NT code) + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +//typedef unsigned int ULONG,*PULONG; +//typedef unsigned short USHORT,*PUSHORT; +//typedef unsigned char UCHAR,*PUCHAR,BYTE,*PBYTE; + +//typedef signed int LONG,*PLONG; +//typedef signed short SHORT,*PSHORT; +//typedef signed char CHAR,*PCHAR,*LPSTR,*PSTR; +//typedef unsigned short WCHAR; + +//typedef void VOID,*PVOID; + +//typedef char BOOLEAN,*PBOOLEAN; + +//#define FALSE (0==1) +//#define TRUE (1==1) +#ifndef NULL +#define NULL ((void*)0) +#endif + +// dimension macro +#define DIM(name) (sizeof(name)/sizeof(name[0])) + diff --git a/rosapps/sysutils/utils/pice/module/scancodes.h b/rosapps/sysutils/utils/pice/module/scancodes.h new file mode 100644 index 00000000000..dae66de0de4 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/scancodes.h @@ -0,0 +1,106 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + scancodes.h + +Abstract: + + HEADER, scancodes of IBM keyboard + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +/* +** Scan Code Definitions . . . +*/ +// System Keys +#define SCANCODE_ESC 0x01 +#define SCANCODE_BACKSPACE 0x0E +#define SCANCODE_TAB 0x0F + +#define SCANCODE_ENTER 0x1C +#define SCANCODE_L_CTRL 0x1D +#define SCANCODE_R_CTRL 0x5A +#define SCANCODE_L_SHIFT 0x2A +#define SCANCODE_R_SHIFT 0x36 +#define SCANCODE_L_ALT 0x38 +#define SCANCODE_R_ALT 0x5C + +#define SCANCODE_SPACE 0x39 +#define SCANCODE_CAPS_LOCK 0x3A +#define SCANCODE_NUM_LOCK 0x45 +#define SCANCODE_PRNT_SCRN 0x47 +#define SCANCODE_SCROLL_LOCK 0x57 + +// Function Keys +#define SCANCODE_F1 0x3b +#define SCANCODE_F2 0x3c +#define SCANCODE_F3 0x3d +#define SCANCODE_F4 0x3e +#define SCANCODE_F5 0x3f +#define SCANCODE_F6 0x40 +#define SCANCODE_F7 0x41 +#define SCANCODE_F8 0x42 +#define SCANCODE_F9 0x43 +#define SCANCODE_F10 0x44 +#define SCANCODE_F11 0x57 +#define SCANCODE_F12 0x58 + +// Directional Control Keys +#define SCANCODE_HOME 0x47 +#define SCANCODE_UP 0x48 +#define SCANCODE_PGUP 0x49 +#define SCANCODE_LEFT 0x4b +#define SCANCODE_CENTER 0x4c +#define SCANCODE_RIGHT 0x4d +#define SCANCODE_END 0x4f +#define SCANCODE_DOWN 0x50 +#define SCANCODE_PGDN 0x51 +#define SCANCODE_INS 0x52 +#define SCANCODE_DEL 0x53 + +// Cluster Directional Control Keys +#define SCANCODE_C_ENTER 0x59 +#define SCANCODE_C_HOME 0x5d +#define SCANCODE_C_UP 0x5e +#define SCANCODE_C_PGUP 0x5f +#define SCANCODE_C_LEFT 0x60 +#define SCANCODE_C_RIGHT 0x61 +#define SCANCODE_C_END 0x62 +#define SCANCODE_C_DOWN 0x63 +#define SCANCODE_C_PGDN 0x64 +#define SCANCODE_C_INS 0x65 +#define SCANCODE_C_DEL 0x66 + + +// Alphanumerics +#define SCANCODE_1 0x02 +#define SCANCODE_2 0x03 +#define SCANCODE_3 0x04 +#define SCANCODE_4 0x05 +#define SCANCODE_5 0x06 +#define SCANCODE_6 0x07 +#define SCANCODE_7 0x08 +#define SCANCODE_8 0x09 +#define SCANCODE_9 0x0A +#define SCANCODE_0 0x0B + +#define SCANCODE_EXTENDED 0xE0 diff --git a/rosapps/sysutils/utils/pice/module/serial.c b/rosapps/sysutils/utils/pice/module/serial.c new file mode 100644 index 00000000000..3998492eae7 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/serial.c @@ -0,0 +1,656 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + serial.c + +Abstract: + + serial debugger connection + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 19-Aug-2000: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#include "remods.h" +#include "precomp.h" +#include "serial_port.h" + +BOOLEAN SerialReadByte(PUCHAR px); + + +// used for SERIAL window creation +// NB: at the moment the terminal is 60 lines high. +WINDOW wWindowSerial[4]= +{ + {1,3,1,0,FALSE}, + {5,8,1,0,FALSE}, + {14,26,1,0,FALSE}, + {41,18,1,0,FALSE} +}; + +PUCHAR pScreenBufferSerial; + +USHORT usSerialPortBase; + +UCHAR packet[_PAGE_SIZE]; +UCHAR assemble_packet[_PAGE_SIZE]; + +UCHAR flush_buffer[_PAGE_SIZE],g_x,g_y; +ULONG ulFlushBufferPos = 0; + +UCHAR ucLastKeyRead; +ECOLORS eForegroundColor=WHITE,eBackgroundColor=BLACK; + +///************************************************************************ +// SerialSetSpeed() +// +///************************************************************************ +void SerialSetSpeed(ULONG baudrate) +{ + UCHAR c; + ULONG divisor; + + divisor = (ULONG) (115200L/baudrate); + + c = inportb((USHORT)(usSerialPortBase + LCR)); + outportb((USHORT)(usSerialPortBase + LCR), (UCHAR)(c | 0x80)); // Set DLAB + outportb((USHORT)(usSerialPortBase + DLL), (UCHAR)(divisor & 0x00FF)); + outportb((USHORT)(usSerialPortBase + DLH), (UCHAR)((divisor >> 8) & 0x00FF)); + outportb((USHORT)(usSerialPortBase + LCR), c); // Reset DLAB + +} + +///************************************************************************ +// SerialSetOthers() +// +// Set other communications parameters +//************************************************************************ +void SerialSetOthers(ULONG Parity, ULONG Bits, ULONG StopBit) +{ + ULONG setting; + UCHAR c; + + if (usSerialPortBase == 0) return ; + if (Bits < 5 || Bits > 8) return ; + if (StopBit != 1 && StopBit != 2) return ; + if (Parity != NO_PARITY && Parity != ODD_PARITY && Parity != EVEN_PARITY) + return; + + setting = Bits-5; + setting |= ((StopBit == 1) ? 0x00 : 0x04); + setting |= Parity; + + c = inportb((USHORT)(usSerialPortBase + LCR)); + outportb((USHORT)(usSerialPortBase + LCR), (UCHAR)(c & ~0x80)); // Reset DLAB + + // no ints + outportb((USHORT)(usSerialPortBase + IER), (UCHAR)0); + + // clear FIFO and disable them + outportb((USHORT)(usSerialPortBase + FCR), (UCHAR)0); + + outportb((USHORT)(usSerialPortBase + LCR), (UCHAR)setting); + + outportb((USHORT)(usSerialPortBase + MCR), DTR | RTS); + + + return ; +} + +///************************************************************************ +// FlushSerialBuffer() +// +///************************************************************************ +void FlushSerialBuffer(void) +{ + UCHAR c; + + while(SerialReadByte(&c)); +} + +///************************************************************************ +// SetupSerial() +// +///************************************************************************ +void SetupSerial(ULONG port,ULONG baudrate) +{ + USHORT ports[]={COM1BASE,COM2BASE,COM3BASE,COM4BASE}; + + usSerialPortBase = ports[port-1]; + SerialSetOthers(NO_PARITY,8,1); + SerialSetSpeed(baudrate); + + // clear out received bytes + // else we would think there's a terminal connected + FlushSerialBuffer(); +} + + +///************************************************************************ +// SerialReadByte() +// +// Output a character to the serial port +//************************************************************************ +BOOLEAN SerialReadByte(PUCHAR px) +{ + ULONG timeout; + + timeout = 0x00FFFFL; + + // Wait for transmitter to clear + while ((inportb((USHORT)(usSerialPortBase + LSR)) & RCVRDY) == 0) + if (!(--timeout)) + { + return FALSE; + } + + *px = inportb((USHORT)(usSerialPortBase + RXR)); + + return TRUE; +} + +///************************************************************************ +// SerialSendByte() +// +// Output a character to the serial port +//************************************************************************ +BOOLEAN SerialSendByte(UCHAR x) +{ + ULONG timeout; + + timeout = 0x00FFFFL; + + // Wait for transmitter to clear + while ((inportb((USHORT)(usSerialPortBase + LSR)) & XMTRDY) == 0) + if (!(--timeout)) + { + return FALSE; + } + + outportb((USHORT)(usSerialPortBase + TXR), x); + + return TRUE; +} + +//************************************************************************ +// CheckSum() +// +//************************************************************************ +UCHAR CheckSum(LPSTR p,ULONG Len) +{ + UCHAR ucCheckSum = 0; + ULONG i; + for(i=0;iheader; + ULONG i; + UCHAR c; + ULONG timeout; + + do + { + timeout = 10; + pHeader = (PUCHAR)&p->header; + for(i=0;i<(sizeof(SERIAL_PACKET_HEADER)+p->header.packet_size);i++) + { + if(!SerialSendByte(*pHeader++)) + { + return FALSE; + } + } + + do + { + c = 0; + SerialReadByte(&c); + if(c != ACK) + ucLastKeyRead = c; + }while(c != ACK && timeout--); + + }while(c != ACK); + + return TRUE; +} + +///************************************************************************ +// SendPacketTimeout() +// +///************************************************************************ +BOOLEAN SendPacketTimeout(PSERIAL_PACKET p) +{ + PUCHAR pHeader = (PUCHAR)&p->header; + ULONG i; + UCHAR c; + ULONG timeout = 20; + BOOLEAN bResult = TRUE; + + pHeader = (PUCHAR)&p->header; + for(i=0;i<(sizeof(SERIAL_PACKET_HEADER)+p->header.packet_size);i++) + { + if(!SerialSendByte(*pHeader++)) + { + return FALSE; + } + } + + do + { + c = 0xFF; + SerialReadByte(&c); + }while(c != ACK && timeout--); + + if(c != ACK) + bResult = FALSE; + + return bResult; +} + + +//************************************************************************ +// AssemblePacket() +// +//************************************************************************ +PSERIAL_PACKET AssemblePacket(PUCHAR pData,ULONG ulSize) +{ + PSERIAL_PACKET p; + ULONG ulCheckSum; + + p = (PSERIAL_PACKET)assemble_packet; + + // fill in header + p->header.packet_chksum = CheckSum(pData,ulSize); + p->header.packet_size = ulSize; + p->header.packet_header_chksum = 0; + ulCheckSum = (ULONG)CheckSum((PUCHAR)p,sizeof(SERIAL_PACKET_HEADER)); + p->header.packet_header_chksum = ulCheckSum; + // attach data to packet + PICE_memcpy(p->data,pData,ulSize); + + return p; +} + + +// OUTPUT handlers + +//************************************************************************* +// SetForegroundColorVga() +// +//************************************************************************* +void SetForegroundColorSerial(ECOLORS col) +{ + eForegroundColor = col; +} + +//************************************************************************* +// SetBackgroundColorVga() +// +//************************************************************************* +void SetBackgroundColorSerial(ECOLORS col) +{ + eBackgroundColor = col; +} + + +//************************************************************************* +// PrintGrafSerial() +// +//************************************************************************* +void PrintGrafSerial(ULONG x,ULONG y,UCHAR c) +{ + // put this into memory + pScreenBufferSerial[y*GLOBAL_SCREEN_WIDTH + x] = c; + + // put this into cache + if(ulFlushBufferPos == 0) + { + g_x = x; + g_y = y; + } + + flush_buffer[ulFlushBufferPos++] = c; +} + +//************************************************************************* +// FlushSerial() +// +//************************************************************************* +void FlushSerial(void) +{ + PSERIAL_DATA_PACKET_PRINT pPrint; + PSERIAL_PACKET p; + + pPrint = (PSERIAL_DATA_PACKET_PRINT)packet; + pPrint->type = PACKET_TYPE_PRINT; + pPrint->x = g_x; + pPrint->y = g_y; + pPrint->fgcol = eForegroundColor; + pPrint->bkcol = eBackgroundColor; + flush_buffer[ulFlushBufferPos++] = 0; + PICE_strcpy(pPrint->string,flush_buffer); + ulFlushBufferPos = 0; + + p = AssemblePacket((PUCHAR)pPrint,sizeof(SERIAL_DATA_PACKET_PRINT)+PICE_strlen(flush_buffer)); + SendPacket(p); +} + +//************************************************************************* +// ShowCursorSerial() +// +// show hardware cursor +//************************************************************************* +void ShowCursorSerial(void) +{ + PSERIAL_DATA_PACKET_CURSOR pCursor; + PSERIAL_PACKET p; + + ENTER_FUNC(); + + bCursorEnabled = TRUE; + + pCursor = (PSERIAL_DATA_PACKET_CURSOR)packet; + pCursor->type = PACKET_TYPE_CURSOR; + pCursor->state = (UCHAR)TRUE; + pCursor->x = (UCHAR)wWindow[OUTPUT_WINDOW].usCurX; + pCursor->y = (UCHAR)wWindow[OUTPUT_WINDOW].usCurY; + + p = AssemblePacket((PUCHAR)pCursor,sizeof(SERIAL_DATA_PACKET_CURSOR)); + SendPacket(p); + + LEAVE_FUNC(); +} + +//************************************************************************* +// HideCursorSerial() +// +// hide hardware cursor +//************************************************************************* +void HideCursorSerial(void) +{ + PSERIAL_DATA_PACKET_CURSOR pCursor; + PSERIAL_PACKET p; + + ENTER_FUNC(); + + bCursorEnabled = FALSE; + + pCursor = (PSERIAL_DATA_PACKET_CURSOR)packet; + pCursor->type = PACKET_TYPE_CURSOR; + pCursor->state = (UCHAR)TRUE; + + p = AssemblePacket((PUCHAR)pCursor,sizeof(SERIAL_DATA_PACKET_CURSOR)); + SendPacket(p); + + LEAVE_FUNC(); +} + +//************************************************************************* +// CopyLineToSerial() +// +// copy a line from src to dest +//************************************************************************* +void CopyLineToSerial(USHORT dest,USHORT src) +{ + NOT_IMPLEMENTED(); +} + +//************************************************************************* +// InvertLineSerial() +// +// invert a line on the screen +//************************************************************************* +void InvertLineSerial(ULONG line) +{ + PSERIAL_DATA_PACKET_INVERTLINE pInvertLine; + PSERIAL_PACKET p; + + pInvertLine = (PSERIAL_DATA_PACKET_INVERTLINE)packet; + pInvertLine->type = PACKET_TYPE_INVERTLINE; + pInvertLine->line = line; + + p = AssemblePacket((PUCHAR)pInvertLine,sizeof(SERIAL_DATA_PACKET_INVERTLINE)); + SendPacket(p); +} + +//************************************************************************* +// HatchLineSerial() +// +// hatches a line on the screen +//************************************************************************* +void HatchLineSerial(ULONG line) +{ + NOT_IMPLEMENTED(); +} + +//************************************************************************* +// ClrLineSerial() +// +// clear a line on the screen +//************************************************************************* +void ClrLineSerial(ULONG line) +{ + PSERIAL_DATA_PACKET_CLRLINE pClrLine; + PSERIAL_PACKET p; + + pClrLine = (PSERIAL_DATA_PACKET_CLRLINE)packet; + pClrLine->type = PACKET_TYPE_CLRLINE; + pClrLine->fgcol = eForegroundColor; + pClrLine->bkcol = eBackgroundColor; + pClrLine->line = line; + + p = AssemblePacket((PUCHAR)pClrLine,sizeof(SERIAL_DATA_PACKET_CLRLINE)); + SendPacket(p); +} + +//************************************************************************* +// PrintLogoSerial() +// +//************************************************************************* +void PrintLogoSerial(BOOLEAN bShow) +{ + NOT_IMPLEMENTED(); +} + +//************************************************************************* +// PrintCursorSerial() +// +// emulate a blinking cursor block +//************************************************************************* +void PrintCursorSerial(BOOLEAN bForce) +{ + NOT_IMPLEMENTED(); +} + +//************************************************************************* +// SaveGraphicsStateSerial() +// +//************************************************************************* +void SaveGraphicsStateSerial(void) +{ + // not implemented +} + +//************************************************************************* +// RestoreGraphicsStateSerial() +// +//************************************************************************* +void RestoreGraphicsStateSerial(void) +{ + // not implemented +} + +// INPUT handlers +//************************************************************************* +// GetKeyPolledSerial() +// +//************************************************************************* +UCHAR GetKeyPolledSerial(void) +{ + UCHAR ucResult; + PSERIAL_DATA_PACKET_POLL pPoll; + PSERIAL_PACKET p; + + pPoll = (PSERIAL_DATA_PACKET_POLL)packet; + pPoll->type = PACKET_TYPE_POLL; + pPoll->major_version = PICE_MAJOR_VERSION; + pPoll->minor_version = PICE_MINOR_VERSION; + pPoll->build_number = PICE_BUILD; + + p = AssemblePacket((PUCHAR)pPoll,sizeof(SERIAL_DATA_PACKET_POLL)); + SendPacket(p); + + ucResult = ucLastKeyRead; + + ucLastKeyRead = 0; + + return ucResult; +} + +//************************************************************************* +// FlushKeyboardQueueSerial() +// +//************************************************************************* +void FlushKeyboardQueueSerial(void) +{ + // not implemented +} + +//************************************************************************* +// Connect() +// +//************************************************************************* +BOOLEAN Connect(USHORT xSize,USHORT ySize) +{ + PSERIAL_DATA_PACKET_CONNECT pConnect; + PSERIAL_PACKET p; + + pConnect = (PSERIAL_DATA_PACKET_CONNECT)packet; + pConnect->type = PACKET_TYPE_CONNECT; + pConnect->xsize = xSize; + pConnect->ysize = ySize; + + p = AssemblePacket((PUCHAR)pConnect,sizeof(SERIAL_DATA_PACKET_CONNECT)); + return SendPacketTimeout(p); +} + +//************************************************************************* +// ConsoleInitSerial() +// +// init terminal screen +//************************************************************************* +BOOLEAN ConsoleInitSerial(void) +{ + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + + ohandlers.CopyLineTo = CopyLineToSerial; + ohandlers.PrintGraf = PrintGrafSerial; + ohandlers.Flush = FlushSerial; + ohandlers.ClrLine = ClrLineSerial; + ohandlers.InvertLine = InvertLineSerial; + ohandlers.HatchLine = HatchLineSerial; + ohandlers.PrintLogo = PrintLogoSerial; + ohandlers.PrintCursor = PrintCursorSerial; + ohandlers.SaveGraphicsState = SaveGraphicsStateSerial; + ohandlers.RestoreGraphicsState = RestoreGraphicsStateSerial; + ohandlers.ShowCursor = ShowCursorSerial; + ohandlers.HideCursor = HideCursorSerial; + ohandlers.SetForegroundColor = SetForegroundColorSerial; + ohandlers.SetBackgroundColor = SetBackgroundColorSerial; + + ihandlers.GetKeyPolled = GetKeyPolledSerial; + ihandlers.FlushKeyboardQueue = FlushKeyboardQueueSerial; + + SetWindowGeometry(wWindowSerial); + + GLOBAL_SCREEN_WIDTH = 80; + GLOBAL_SCREEN_HEIGHT = 60; + + pScreenBufferSerial = PICE_malloc(FRAMEBUFFER_SIZE, NONPAGEDPOOL); + + if(pScreenBufferSerial) + { + bResult = TRUE; + + EmptyRingBuffer(); + + SetupSerial(1,115200); + + // connect to terminal, if none's there, we give up + bResult = Connect(GLOBAL_SCREEN_WIDTH,GLOBAL_SCREEN_HEIGHT); + + if(bResult) + { + GetKeyPolledSerial(); + } + } + + LEAVE_FUNC(); + + return bResult; +} + + +//************************************************************************* +// ConsoleShutdownSerial() +// +// exit terminal screen +//************************************************************************* +void ConsoleShutdownSerial(void) +{ + ENTER_FUNC(); + + Connect(80,25); + + FlushSerialBuffer(); + + if(pScreenBufferSerial) + PICE_free(pScreenBufferSerial); + + LEAVE_FUNC(); +} + + + diff --git a/rosapps/sysutils/utils/pice/module/serial.h b/rosapps/sysutils/utils/pice/module/serial.h new file mode 100644 index 00000000000..9c531334395 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/serial.h @@ -0,0 +1,36 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + serial.h + +Abstract: + + HEADER for serial.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void SendString(LPSTR s); +void SetupSerial(ULONG port,ULONG baudrate); + +BOOLEAN ConsoleInitSerial(void); +void ConsoleShutdownSerial(void); + diff --git a/rosapps/sysutils/utils/pice/module/serial_port.h b/rosapps/sysutils/utils/pice/module/serial_port.h new file mode 100644 index 00000000000..eabd62a4e33 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/serial_port.h @@ -0,0 +1,173 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + serial_port.h + +Abstract: + + HEADER for serial.c + + serial port HW defines + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#define COM1 1 +#define COM2 2 +#define COM1BASE 0x3F8 /* Base port address for COM1 */ +#define COM2BASE 0x2F8 /* Base port address for COM2 */ + +// FIX these +#define COM3BASE 0x3F8 /* Base port address for COM3 */ +#define COM4BASE 0x2F8 /* Base port address for COM4 */ + +/* + The 8250 UART has 10 registers accessible through 7 port addresses. + Here are their addresses relative to COM1BASE and COM2BASE. Note + that the baud rate registers, (DLL) and (DLH) are active only when + the Divisor-Latch Access-Bit (DLAB) is on. The (DLAB) is bit 7 of + the (LCR). + + o TXR Output data to the serial port. + o RXR Input data from the serial port. + o LCR Initialize the serial port. + o IER Controls interrupt generation. + o IIR Identifies interrupts. + o MCR Send contorl signals to the modem. + o LSR Monitor the status of the serial port. + o MSR Receive status of the modem. + o DLL Low byte of baud rate divisor. + o DHH High byte of baud rate divisor. +*/ +#define TXR 0 /* Transmit register (WRITE) */ +#define RXR 0 /* Receive register (READ) */ +#define IER 1 /* Interrupt Enable */ +#define IIR 2 /* Interrupt ID */ +#define FCR 2 /* FIFO control */ +#define LCR 3 /* Line control */ +#define MCR 4 /* Modem control */ +#define LSR 5 /* Line Status */ +#define MSR 6 /* Modem Status */ +#define DLL 0 /* Divisor Latch Low */ +#define DLH 1 /* Divisor latch High */ + + +/*-------------------------------------------------------------------* + Bit values held in the Line Control Register (LCR). + bit meaning + --- ------- + 0-1 00=5 bits, 01=6 bits, 10=7 bits, 11=8 bits. + 2 Stop bits. + 3 0=parity off, 1=parity on. + 4 0=parity odd, 1=parity even. + 5 Sticky parity. + 6 Set break. + 7 Toggle port addresses. + *-------------------------------------------------------------------*/ +#define NO_PARITY 0x00 +#define EVEN_PARITY 0x18 +#define ODD_PARITY 0x08 + + + +/*-------------------------------------------------------------------* + Bit values held in the Line Status Register (LSR). + bit meaning + --- ------- + 0 Data ready. + 1 Overrun error - Data register overwritten. + 2 Parity error - bad transmission. + 3 Framing error - No stop bit was found. + 4 Break detect - End to transmission requested. + 5 Transmitter holding register is empty. + 6 Transmitter shift register is empty. + 7 Time out - off line. + *-------------------------------------------------------------------*/ +#define RCVRDY 0x01 +#define OVRERR 0x02 +#define PRTYERR 0x04 +#define FRMERR 0x08 +#define BRKERR 0x10 +#define XMTRDY 0x20 +#define XMTRSR 0x40 +#define TIMEOUT 0x80 + +/*-------------------------------------------------------------------* + Bit values held in the Modem Output Control Register (MCR). + bit meaning + --- ------- + 0 Data Terminal Ready. Computer ready to go. + 1 Request To Send. Computer wants to send data. + 2 auxillary output #1. + 3 auxillary output #2.(Note: This bit must be + set to allow the communications card to send + interrupts to the system) + 4 UART ouput looped back as input. + 5-7 not used. + *------------------------------------------------------------------*/ +#define DTR 0x01 +#define RTS 0x02 + + +/*------------------------------------------------------------------* + Bit values held in the Modem Input Status Register (MSR). + bit meaning + --- ------- + 0 delta Clear To Send. + 1 delta Data Set Ready. + 2 delta Ring Indicator. + 3 delta Data Carrier Detect. + 4 Clear To Send. + 5 Data Set Ready. + 6 Ring Indicator. + 7 Data Carrier Detect. + *------------------------------------------------------------------*/ +#define CTS 0x10 +#define DSR 0x20 + + +/*------------------------------------------------------------------* + Bit values held in the Interrupt Enable Register (IER). + bit meaning + --- ------- + 0 Interrupt when data received. + 1 Interrupt when transmitter holding reg. empty. + 2 Interrupt when data reception error. + 3 Interrupt when change in modem status register. + 4-7 Not used. + *------------------------------------------------------------------*/ +#define RX_INT 0x01 + + +/*------------------------------------------------------------------* + Bit values held in the Interrupt Identification Register (IIR). + bit meaning + --- ------- + 0 Interrupt pending + 1-2 Interrupt ID code + 00=Change in modem status register, + 01=Transmitter holding register empty, + 10=Data received, + 11=reception error, or break encountered. + 3-7 Not used. + *------------------------------------------------------------------*/ +#define RX_ID 0x04 +#define RX_MASK 0x07 diff --git a/rosapps/sysutils/utils/pice/module/shell.c b/rosapps/sysutils/utils/pice/module/shell.c new file mode 100644 index 00000000000..8e348899ca2 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/shell.c @@ -0,0 +1,1692 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + shell.c + +Abstract: + + user interface for debugger + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 16-Jul-1998: created + 22-Sep-1998: rewrite of keyboard hooking through patching the original keyboard driver + 29-Sep-1998: started documentation on project + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + + +//////////////////////////////////////////////////// +// DEFINES +//// +#define LINES_IN_COMMAND_BUFFER (64) + +//////////////////////////////////////////////////// +// PROTOTYPES +//// + +//////////////////////////////////////////////////// +// GLOBALS +//// + +ULONG bPreviousCommandWasGo = FALSE; + +// flags to set when we need to pass things to the old INT handlers +ULONG dwCallOldInt1Handler = 0; +ULONG dwCallOldInt3Handler = 0; +ULONG dwCallOldIntEHandler = 0; +ULONG dwCallOldGPFaultHandler = 0; + +ULONG g_ulLineNumberStart=0; +ULONG ulWindowOffset = 0; +BOOLEAN bStepThroughSource=FALSE; +BOOLEAN bStepInto = FALSE; + +// key handling +UCHAR ucConverted; // key converted from scancode to ANSI + +volatile BOOLEAN bControl=FALSE; // TRUE when CTRL key was pressed +volatile BOOLEAN bShift=FALSE; // TRUE when SHIFT key was pressed +volatile BOOLEAN bAlt=FALSE; // TRUE when ALT key was pressed +volatile ULONG OldInt31Handler; // address of old keyboard ISR +volatile ULONG OldGlobalInt31Handler; // address of old global keyboard ISR +volatile BOOLEAN bEnterNow=FALSE; // TRUE if already stopped +volatile BOOLEAN bNotifyToExit=FALSE; // TRUE when debugger should leave +volatile BOOLEAN bSkipMainLoop=FALSE; // TRUE when debugger should skip main loop +volatile UCHAR ucKeyPressedWhileIdle=0; // key pressed when system was stopped +volatile BOOLEAN bInDebuggerShell=FALSE; // TRUE while in DebuggerShell() +BOOLEAN bIrqStateAtBreak; + +ULONG ulRealStackPtr; +static ULONG PCR_SEL = PCR_SELECTOR; +static ULONG OLD_PCR; + +char tempShell[256]; // temporary string container + +// old address of display memory +USHORT OldSelector=0; +ULONG OldOffset=0; + +ULONG ulLastLineDisplayedOffset = 0; + +// functions of function keys +char *szFunctionKeys[10]={ + "mod", // F1 + "proc", // F2 + "src", // F3 + "code", // F4 + "x", // F5 + "vma", // F6 + "", // F7 + "t", // F8 + "", // F9 + "p" // F10 +}; + +// new stack for "deep parsing" +ULONG aulNewStack[0x20000]; +ULONG ulOldStack; + +// registers save area (context) +ULONG CurrentEIP,CurrentEFL; +ULONG CurrentEAX,CurrentEBX,CurrentECX,CurrentEDX; +ULONG CurrentESP,CurrentEBP,CurrentESI,CurrentEDI; +USHORT CurrentCS,CurrentDS=0,CurrentES,CurrentFS,CurrentGS,CurrentSS; +ULONG CurrentDR0,CurrentDR1,CurrentDR2,CurrentDR3,CurrentDR6,CurrentDR7; +ULONG CurrentCR0,CurrentCR2,CurrentCR3; +// previous context +ULONG OldEIP=0,OldEFL; +ULONG OldEAX,OldEBX,OldECX,OldEDX; +ULONG OldESP,OldEBP,OldESI,OldEDI; +USHORT OldCS=0,OldDS,OldES,OldFS,OldGS,OldSS; + +ULONG CurrentProcess; + +UCHAR ucCommandBuffer[256]; +USHORT usCurrentPosInInputBuffer=0; +volatile BOOLEAN bSingleStep=FALSE; + +// the last command lines +char aszCommandLines[LINES_IN_COMMAND_BUFFER][sizeof(ucCommandBuffer)+2]; +ULONG ulCommandInPos=0,ulCommandLastPos=0; +ULONG ulCommandCurrentPos=0; + + +extern ULONG KeyboardIRQL; + +//************************************************************************* +// GetLinesInCommandHistory() +// +//************************************************************************* +ULONG GetLinesInCommandHistory(void) +{ + ULONG ulResult = (ulCommandInPos-ulCommandLastPos)%LINES_IN_COMMAND_BUFFER; + + ENTER_FUNC(); + + DPRINT((0,"GetLinesInCommandHistory() returns %u (ulIn %u ulLast %u)\n",ulResult,ulCommandInPos,ulCommandLastPos)); + + LEAVE_FUNC(); + + return ulResult; +} + +//************************************************************************* +// AddToCommandLineHistory() +// +//************************************************************************* +void AddToCommandLineHistory(LPSTR s) +{ + ULONG i; + + ENTER_FUNC(); + DPRINT((0,"AddToCommandLineHistory(%s)\n",s)); + + if(PICE_strlen(s)) + { + for(i=0;iImageFileName; + if(IsAddressValid((ULONG)pProcessName) ) + { + PICE_sprintf(tempShell, + " PROCESS(%.8X \"%s\") ", + (ULONG)pCurrentProcess,pProcessName); + } + else + { + PICE_sprintf(tempShell, + " PROCESS(%.8X) ", + (ULONG)pCurrentProcess); + } + PutChar(tempShell,1,wWindow[OUTPUT_WINDOW].y-1); + + ResetColor(); + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// ProcessBootParams() +// +//************************************************************************* +void ProcessBootParams(void) +{ + LPSTR p1,p2; + + ENTER_FUNC(); + if(*szBootParams) + { + DPRINT((0,"ProcessBootParams()\n")); + + p1 = szBootParams; + + while(*p1) + { + p2 = ucCommandBuffer; + DPRINT((0,"ProcessBootParams(): boot params = %s\n",p1)); + while(*p1 && *p1!=';') + { + *p2++ = *p1++; + } + *p2=0; + DPRINT((0,"ProcessBootParams(): cmd buf = %s\n",ucCommandBuffer)); + if(*p1 != ';') + { + DPRINT((0,"ProcessBootParams(): error in cmd buf\n")); + break; + } + p1++; + DPRINT((0,"ProcessBootParams(): next cmd buf = %s\n",p1)); + + Parse(ucCommandBuffer,TRUE); + } + PICE_memset(ucCommandBuffer,0,sizeof(ucCommandBuffer)); + *szBootParams = 0; + } + LEAVE_FUNC(); +} + +//************************************************************************* +// bNoCtrlKeys() +// +//************************************************************************* +BOOLEAN __inline bNoCtrlKeys(void) +{ + return (!bControl && !bAlt && !bShift); +} + + +//************************************************************************* +// DebuggerShell() +// +// handle user interface when stopped system +//************************************************************************* +void DebuggerShell(void) +{ + ARGS Args; + UCHAR speaker; + PEPROCESS pCurrentProcess; + + ENTER_FUNC(); + + // save the graphics state + SaveGraphicsState(); + + // tell USER we are stopped + ShowStoppedMsg(); + + FlushKeyboardQueue(); + + CheckRingBuffer(); + + // kill the speakers annoying beep + speaker = inb_p((PCHAR)0x61); + speaker &= 0xFC; + outb_p(speaker,(PCHAR)0x61); + + ProcessBootParams(); + + DPRINT((0,"DebuggerShell(): DisplayRegs()\n")); + // display register contents + DisplayRegs(); + + DPRINT((0,"DebuggerShell(): DisplayMemory()\n")); + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + + DPRINT((0,"DebuggerShell(): Unassemble()\n")); + + // disassembly from current address + PICE_memset(&Args,0,sizeof(ARGS)); + Args.Value[0]=CurrentCS; + Args.Value[1]=CurrentEIP; + Args.Count=2; + Unassemble(&Args); + + // try to find current process's name + pCurrentProcess = IoGetCurrentProcess(); + CurrentProcess = (ULONG)pCurrentProcess; + + // display status line + ShowStatusLine(); + + // switch on cursor + ShowCursor(); + + // while we are not told to exit + while(bNotifyToExit==FALSE) + { + // emulate graphics cursor + PrintCursor(FALSE); + + // we have a key press + if((ucKeyPressedWhileIdle = GetKeyPolled())!=0) + { + DPRINT((0,"DebuggerShell(): key = %x control = %u shift = %u\n",ucKeyPressedWhileIdle,bControl,bShift)); + + // if cursor reversed, normalize it again (only graphics) + if(bRev) + { + PrintCursor(TRUE); + } + + // convert key to ANSI, if success add to command buffer and try to + // find a command that fits the already entered letters + ucConverted = AsciiFromScan((UCHAR)(ucKeyPressedWhileIdle&0x7f)); + +#if 0 + PICE_sprintf(tempShell,"%u -> %u",ucKeyPressedWhileIdle, ucConverted); + PutChar(tempShell,GLOBAL_SCREEN_WIDTH-32,wWindow[OUTPUT_WINDOW].y-1); +#endif + + if(!bControl && !bAlt && ucConverted) + { + DPRINT((0,"DebuggerShell(): normal key\n")); + if(!(usCurrentPosInInputBuffer==0 && ucConverted==' ')) + { + // if we have space in the command buffer + // put the character there + if(usCurrentPosInInputBuffer=59 && ucKeyPressedWhileIdle<69) + { + DPRINT((0,"DebuggerShell(): FUNCTION %u\n",ucKeyPressedWhileIdle-59)); + PICE_sprintf(tempShell,":"); + ReplaceRingBufferCurrent(tempShell); + PICE_memset(&ucCommandBuffer,0,sizeof(ucCommandBuffer)); + usCurrentPosInInputBuffer=0; + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + PICE_strcpy(ucCommandBuffer,szFunctionKeys[ucKeyPressedWhileIdle-59]); + usCurrentPosInInputBuffer=PICE_strlen(ucCommandBuffer); + if(ucCommandBuffer[0]) + { + ulLastLineDisplayedOffset = 0; + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + + // setup a safe stack for parsing + __asm__ __volatile__("\n\t \ + movl %2,%%eax\n\t \ + movl %%esp,%%ebx\n\t \ + mov %%ebx,%0\n\t \ + leal _aulNewStack,%%ebx\n\t \ + addl $0x1FFF0,%%ebx\n\t \ + movl %%ebx,%%esp\n\t \ + pushl $1\n\t \ + pushl %%eax\n\t \ + call _Parse\n\t \ + movl %0,%%ebx\n\t \ + movl %%ebx,%%esp" + :"=m" (ulOldStack) + :"m" (ulOldStack),"m" (ucCommandBuffer) + :"eax","ebx"); + PICE_memset(&ucCommandBuffer,0,sizeof(ucCommandBuffer)); + usCurrentPosInInputBuffer=0; + } + } + else + { + switch(ucKeyPressedWhileIdle) + { + case SCANCODE_ESC: + if(usCurrentPosInInputBuffer) + { + PICE_sprintf(tempShell,":"); + ReplaceRingBufferCurrent(tempShell); + PICE_memset(&ucCommandBuffer,0,sizeof(ucCommandBuffer)); + usCurrentPosInInputBuffer=0; + Print(OUTPUT_WINDOW,""); + ShowStoppedMsg(); + } + break; + case SCANCODE_HOME: // home + DPRINT((0,"DebuggerShell(): HOME\n")); + // memory window + if(bAlt) + { + DPRINT((0,"DebuggerShell(): data window home\n")); + OldOffset=0x0; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + // output window + else if(bShift) + { + DPRINT((0,"DebuggerShell(): output window home\n")); + if(ulLastLineDisplayedOffset != LinesInRingBuffer()-wWindow[OUTPUT_WINDOW].cy) + { + ulLastLineDisplayedOffset = LinesInRingBuffer()-wWindow[OUTPUT_WINDOW].cy+1; + PrintRingBufferHome(wWindow[OUTPUT_WINDOW].cy-1); + } + } + // source window home + else if(bControl) + { + if(ulCurrentlyDisplayedLineNumber>0) + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber = 1; + + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + 1,-1); + } + } + } + else if(!bShift && !bControl && !bAlt) + { + } + break; + case SCANCODE_END: // end + DPRINT((0,"DebuggerShell(): END\n")); + // memory window + if(bAlt) + { + DPRINT((0,"DebuggerShell(): data window end\n")); + OldOffset=0xFFFFFFFF-0x10*4; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + // output window + else if(bShift) + { + DPRINT((0,"DebuggerShell(): output window end\n")); + if(ulLastLineDisplayedOffset) + { + ulLastLineDisplayedOffset = 0; + + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + } + } + else if(!bShift && !bControl && !bAlt) + { + } + break; + case SCANCODE_UP: // up + DPRINT((0,"DebuggerShell(): UP\n")); + // memory window + if(bAlt) + { + DPRINT((0,"DebuggerShell(): data window up\n")); + OldOffset-=0x10; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + // output window + else if(bShift) + { + DPRINT((0,"DebuggerShell(): output window up ulLastLineDisplayedOffset = %u\n",ulLastLineDisplayedOffset)); + + if(ulLastLineDisplayedOffset+wWindow[OUTPUT_WINDOW].cy < LinesInRingBuffer()) + { + ulLastLineDisplayedOffset += 1; + + PrintRingBufferOffset(wWindow[OUTPUT_WINDOW].cy-1,ulLastLineDisplayedOffset); + } + } + // source window up + else if(bControl) + { + if((ulCurrentlyDisplayedLineNumber-1)>0 && PICE_strlen(szCurrentFile) ) + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber--; + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + ulCurrentlyDisplayedLineNumber,-1); + } + } + else + { + UnassembleOneLineUp(); + } + } + // command line history + else if(!bShift && !bControl && !bAlt) + { + LPSTR pCurrentCmd; + ULONG len; + + DPRINT((0,"DebuggerShell(): command line up\n")); + + // only if anything in history + if(GetLinesInCommandHistory()) + { + // go to next entry in history + if(ulCommandCurrentPos) + ulCommandCurrentPos = (ulCommandCurrentPos-1)%GetLinesInCommandHistory(); + else + ulCommandCurrentPos = GetLinesInCommandHistory()-1; + DPRINT((0,"DebuggerShell(): current history pos = %u\n",ulCommandCurrentPos)); + // get this entry + pCurrentCmd = GetFromCommandLineHistory(ulCommandCurrentPos); + // if it has a string attached + if((len = PICE_strlen(pCurrentCmd))) + { + // replace the current command line + PICE_sprintf(tempShell,":"); + ReplaceRingBufferCurrent(tempShell); + PICE_memset(&ucCommandBuffer,0,sizeof(ucCommandBuffer)); + PICE_strcpy(ucCommandBuffer,pCurrentCmd); + usCurrentPosInInputBuffer=len; + Print(OUTPUT_WINDOW,pCurrentCmd); + } + } + } + break; + case SCANCODE_DOWN: // down + DPRINT((0,"DebuggerShell(): DOWN\n")); + // memory window + if(bAlt) + { + DPRINT((0,"DebuggerShell(): data window down\n")); + OldOffset+=0x10; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + // output window + else if(bShift) + { + DPRINT((0,"DebuggerShell(): output window down ulLastLineDisplayedOffset = %u\n",ulLastLineDisplayedOffset)); + if(ulLastLineDisplayedOffset) + { + ulLastLineDisplayedOffset -= 1; + + if(!PrintRingBufferOffset(wWindow[OUTPUT_WINDOW].cy-1,ulLastLineDisplayedOffset)) + { + ulLastLineDisplayedOffset = 0; + PrintRingBuffer(wWindow[OUTPUT_WINDOW].cy-1); + } + } + } + // source window down + else if(bControl) + { + if(ulCurrentlyDisplayedLineNumber>0 && PICE_strlen(szCurrentFile)) + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber++; + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + ulCurrentlyDisplayedLineNumber,-1); + } + } + else + { + UnassembleOneLineDown(); + } + } + // command line history + else if(!bShift && !bControl && !bAlt) + { + LPSTR pCurrentCmd; + ULONG len; + + DPRINT((0,"DebuggerShell(): command line down\n")); + + // only if anything in history + if(GetLinesInCommandHistory()) + { + // go to next entry in history + ulCommandCurrentPos = (ulCommandCurrentPos+1)%(GetLinesInCommandHistory()); + DPRINT((0,"DebuggerShell(): current history pos = %u\n",ulCommandCurrentPos)); + // get this entry + pCurrentCmd = GetFromCommandLineHistory(ulCommandCurrentPos); + // if it has a string attached + if((len = PICE_strlen(pCurrentCmd))) + { + // replace the current command line + PICE_sprintf(tempShell,":"); + ReplaceRingBufferCurrent(tempShell); + PICE_memset(&ucCommandBuffer,0,sizeof(ucCommandBuffer)); + PICE_strcpy(ucCommandBuffer,pCurrentCmd); + usCurrentPosInInputBuffer=len; + Print(OUTPUT_WINDOW,pCurrentCmd); + } + } + } + break; + case SCANCODE_LEFT: // left + DPRINT((0,"DebuggerShell(): LEFT\n")); + // memory window + if(bAlt) + { + DPRINT((0,"DebuggerShell(): data window left\n")); + + OldOffset-=0x1; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + else if(!bShift && !bControl && !bAlt) + { + } + else if(bControl) + { + if(ulWindowOffset > 0) + ulWindowOffset--; + PICE_memset(&Args,0,sizeof(ARGS)); + Args.Count=0; + Unassemble(&Args); + } + break; + case SCANCODE_RIGHT: // right + // memory window + if(bAlt) + { + DPRINT((0,"DebuggerShell(): data window right\n")); + + OldOffset+=0x1; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + else if(!bShift && !bControl && !bAlt) + { + } + else if(bControl) + { + if(ulWindowOffset < 80) + ulWindowOffset++; + PICE_memset(&Args,0,sizeof(ARGS)); + Args.Count=0; + Unassemble(&Args); + } + break; + case SCANCODE_PGUP: // page up + DPRINT((0,"DebuggerShell(): PAGEUP\n")); + // memory window + if(bAlt) + { + OldOffset-=wWindow[DATA_WINDOW].cy*0x10; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + // output window + else if(bShift) + { + if(ulLastLineDisplayedOffset+2*(wWindow[OUTPUT_WINDOW].cy) < LinesInRingBuffer()) + { + ulLastLineDisplayedOffset += (wWindow[OUTPUT_WINDOW].cy); + + PrintRingBufferOffset(wWindow[OUTPUT_WINDOW].cy-1,ulLastLineDisplayedOffset); + } + else + { + if(ulLastLineDisplayedOffset != LinesInRingBuffer()-wWindow[OUTPUT_WINDOW].cy) + { + ulLastLineDisplayedOffset = LinesInRingBuffer()-wWindow[OUTPUT_WINDOW].cy; + PrintRingBufferOffset(wWindow[OUTPUT_WINDOW].cy-1,ulLastLineDisplayedOffset); + } + } + } + // source window page up + else if(bControl) + { + if(PICE_strlen(szCurrentFile)) + { + if((ulCurrentlyDisplayedLineNumber-wWindow[SOURCE_WINDOW].cy)>0) + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber -= wWindow[SOURCE_WINDOW].cy; + + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + ulCurrentlyDisplayedLineNumber ,-1); + } + } + else + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber = 1; + + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + ulCurrentlyDisplayedLineNumber ,-1); + } + } + } + else + { + UnassembleOnePageUp(wWindow[SOURCE_WINDOW].cy); + } + + } + else if(!bShift && !bControl && !bAlt) + { + } + break; + case SCANCODE_PGDN: // page down + DPRINT((0,"DebuggerShell(): PAGEDOWN\n")); + // memory window + if(bAlt) + { + OldOffset+=wWindow[DATA_WINDOW].cy*0x10; + // display data window + Args.Value[0]=OldSelector; + Args.Value[1]=OldOffset; + Args.Count=2; + DisplayMemory(&Args); + } + else if(bShift) + { + if(ulLastLineDisplayedOffset>wWindow[OUTPUT_WINDOW].cy) + { + ulLastLineDisplayedOffset -= (wWindow[OUTPUT_WINDOW].cy); + + PrintRingBufferOffset(wWindow[OUTPUT_WINDOW].cy-1,ulLastLineDisplayedOffset); + } + else + { + if(ulLastLineDisplayedOffset) + { + ulLastLineDisplayedOffset = 0; + PrintRingBufferOffset(wWindow[OUTPUT_WINDOW].cy-1,ulLastLineDisplayedOffset); + } + } + } + else if(bControl) + { + if(PICE_strlen(szCurrentFile) ) + { + if((ulCurrentlyDisplayedLineNumber+wWindow[SOURCE_WINDOW].cy)>0) + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber += wWindow[SOURCE_WINDOW].cy; + + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + ulCurrentlyDisplayedLineNumber ,-1); + } + } + else + { + PICE_SYMBOLFILE_SOURCE* pSrc; + + if(ConvertTokenToSrcFile(szCurrentFile,(PULONG)&pSrc) ) + { + ulCurrentlyDisplayedLineNumber = 1; + + DisplaySourceFile((LPSTR)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE), + (LPSTR)pSrc+pSrc->ulOffsetToNext, + ulCurrentlyDisplayedLineNumber ,-1); + } + } + } + else + { + UnassembleOnePageDown(wWindow[SOURCE_WINDOW].cy); + } + } + else if(!bShift && !bControl && !bAlt) + { + } + break; + } + } + } + } + ucKeyPressedWhileIdle=0; + } + } + + SaveOldRegs(); + + PrintLogo(TRUE); + + ShowRunningMsg(); + + if(bRev) + PrintCursor(TRUE); + + // hide the cursor + HideCursor(); + + FlushKeyboardQueue(); + + RestoreGraphicsState(); + + LEAVE_FUNC(); +} + +//************************************************************************* +// RealIsr() +// +//************************************************************************* +void RealIsr(ULONG dwReasonForBreak) +{ + BOOLEAN ReinstallPermanentBp = FALSE; + + DPRINT((0,"reason: %u#################################################################\n", dwReasonForBreak)); + ENTER_FUNC(); + + // in handler + bInDebuggerShell = TRUE; + + bStepping = FALSE; + + // don't assume we must call original handlers yet + dwCallOldInt1Handler = dwCallOldInt3Handler = dwCallOldIntEHandler = dwCallOldGPFaultHandler = 0; + bSkipMainLoop = FALSE; + bEnterNow = FALSE; + + // reset trace flag (TF) on the stack + CurrentEFL&=(~0x100); + + InstallPrintkHook(); + + // control is not depressed + bControl=FALSE; + + bIrqStateAtBreak = ((CurrentEFL&(1<<9))!=0); + + DPRINT((0,"\nbInDebuggerShell %x, dwReasonForBreak: %x, bIrqStateAtBreak: %d\n", bInDebuggerShell, dwReasonForBreak, bIrqStateAtBreak)); + DPRINT((0,"CurrentEIP: %x, CurrentESP: %x\n", CurrentEIP, CurrentESP)); + + // came in because TF flag was set + if(dwReasonForBreak == REASON_SINGLESTEP) + { + ULONG ulAddress,ulAddressCurrent; + + DPRINT((0,"REASON_SINGLESTEP: bSingleStep: %u\n", bSingleStep)); + + if(!bSingleStep) + { + dwCallOldInt1Handler = 1; + DPRINT((0,"no single step requested: %u!\n", dwCallOldInt1Handler)); + goto common_return_point; + } + + ulAddress = GetLinearAddress(OldCS,OldEIP); + ulAddressCurrent = GetLinearAddress(CurrentCS,CurrentEIP); + + // if we came in because we needed to skip past a permanent + // INT3 hook, we need to put the INT3 back in place and + // simply restart the system. + if(NeedToReInstallSWBreakpoints(ulAddress,TRUE) ) + { + DPRINT((0,"reinstalling INT3 @ %.4X:%.8X\n",OldCS,OldEIP)); + + ReInstallSWBreakpoint(ulAddress); + + // previous command was go i.e. we did not single-step over a location + // where a permanent breakpoint was installed (Printk() etc.) we simply restart + // else we must stop the system. + if(bPreviousCommandWasGo) + { + bPreviousCommandWasGo = FALSE; + bInDebuggerShell = FALSE; + + if(bStepThroughSource) + { + // set TF flag + CurrentEFL |= 0x100; + } + + LEAVE_FUNC(); + DPRINT((0,"singlestep-----------------------------------------------------------------\n")); + return; + } + bPreviousCommandWasGo = FALSE; + } + + if(IsSwBpAtAddressInstalled(ulAddressCurrent)) + DeInstallSWBreakpoint(ulAddressCurrent); + + // we came here while stepping through source code block + if(bStepThroughSource) + { + ULONG ulLineNumber; + LPSTR pSrc,pFileName; + + DPRINT((0,"RealIsr(): stepping through source!\n")); + + // look up the corresponding source line + // if there isn't any or the source line number has changed + // we break back into the debugger + if(bShowSrc) + pSrc = FindSourceLineForAddress(ulAddressCurrent,&ulLineNumber,NULL,NULL,&pFileName); + else pSrc = NULL; + + DPRINT((0,"RealIsr(): line #%u pSrc=%x (old line #%u)\n",ulLineNumber,(ULONG)pSrc,g_ulLineNumberStart)); + + // if we have found a source line there + if(pSrc && ulLineNumber==g_ulLineNumberStart) + { + DPRINT((0,"RealIsr(): stepping through line #%u in file = %s!\n",ulLineNumber,pFileName)); + + if(bStepInto) + StepInto(NULL); + else + StepOver(NULL); + + bInDebuggerShell = FALSE; + LEAVE_FUNC(); + DPRINT((0,"singstep-----------------------------------------------------------------\n")); + return; + } + bStepThroughSource = FALSE; + bNotifyToExit = FALSE; + bSkipMainLoop = FALSE; + } + } + // came in because hardware register triggered a breakpoint + else if(dwReasonForBreak == REASON_HARDWARE_BP) + { + ULONG ulReason; + + DPRINT((0,"REASON_HARDWARE_BP\n")); + + // disable HW breakpoints + __asm__("\n\t \ + movl %%dr6,%%eax\n\t \ + movl %%eax,%0\n\t \ + xorl %%eax,%%eax\n\t \ + movl %%eax,%%dr6\n\t \ + movl %%eax,%%dr7" + :"=m" (ulReason) + : + :"eax" + ); + + DPRINT((0,"REASON_HARDWARE_BP: %x\n",(ulReason&0xF))); + + // HW breakpoint DR1 (skip: only used in init_module detection) + if(ulReason&0x2) + { + CurrentEFL |=(1<<16); // set resume flag + + bSkipMainLoop = TRUE; + + TryToInstallVirtualSWBreakpoints(); + } + // HW breakpoint DR0 + else if(ulReason&0x1) + { + ULONG ulAddressCurrent; + + ulAddressCurrent = GetLinearAddress(CurrentCS,CurrentEIP); + + // we came here while stepping through source code block + if(bStepThroughSource) + { + ULONG ulLineNumber; + LPSTR pSrc,pFileName; + + DPRINT((0,"RealIsr(): stepping through source! [2]\n")); + + // look up the corresponding source line + // if there isn't any or the source line number has changed + // we break back into the debugger + if(bShowSrc) + pSrc = FindSourceLineForAddress(ulAddressCurrent,&ulLineNumber,NULL,NULL,&pFileName); + else + pSrc = NULL; + + DPRINT((0,"RealIsr(): line #%u pSrc=%x (old line #%u) [2]\n",ulLineNumber,(ULONG)pSrc,g_ulLineNumberStart)); + + // if we have found a source line there + if(pSrc && ulLineNumber==g_ulLineNumberStart) + { + DPRINT((0,"RealIsr(): stepping through line #%u in file = %s! [2]\n",ulLineNumber,pFileName)); + + if(bStepInto) + StepInto(NULL); + else + StepOver(NULL); + + bInDebuggerShell = FALSE; + LEAVE_FUNC(); + DPRINT((0,"rrr-----------------------------------------------------------------\n")); + return; + } + bNotifyToExit = FALSE; + bSkipMainLoop = FALSE; + bStepThroughSource = FALSE; + } + } + } + else if(dwReasonForBreak==REASON_INT3) + { + ULONG ulAddress; + + DPRINT((0,"REASON_INT3\n")); + + // must subtract one cause INT3s are generated after instructions execution + CurrentEIP--; + + // make a flat address + ulAddress = GetLinearAddress(CurrentCS,CurrentEIP); + + DPRINT((0,"INT3 @ %.8X\n",ulAddress)); + + // if there's a breakpoint installed at current EIP remove it + if(DeInstallSWBreakpoint(ulAddress) ) + { + PSW_BP p; + + DPRINT((0,"INT3 @ %.8X removed\n",ulAddress)); + + // if it's permanent (must be Printk() ) skip the DebuggerShell() and + // do a callback + if( (p = IsPermanentSWBreakpoint(ulAddress)) ) + { + DPRINT((0,"permanent breakpoint\n")); + + ReinstallPermanentBp = TRUE; + + OldCS = CurrentCS; + OldEIP = CurrentEIP; + + bSkipMainLoop = TRUE; + DPRINT((0,"callback at %x\n",p->Callback)); + if(p->Callback) + p->Callback(); + } + else + { + LPSTR pFind; + if(ScanExportsByAddress(&pFind,GetLinearAddress(CurrentCS,CurrentEIP))) + { + PICE_sprintf(tempShell,"pICE: SW Breakpoint at %s (%.4X:%.8X)\n",pFind,CurrentCS,CurrentEIP); + } + else + { + PICE_sprintf(tempShell,"pICE: SW Breakpoint at %.4X:%.8X\n",CurrentCS,CurrentEIP); + } + Print(OUTPUT_WINDOW,tempShell); + } + CurrentEFL &= ~(1<<16); // clear resume flag + } + else + { + LPSTR pFind; + PEPROCESS my_current = IoGetCurrentProcess(); + + DPRINT((0,"can't deinstall, somebody else's breakpoint\n")); + + + // if no other debugger is running on this process and the address is + // above TASK_SIZE we assume this to be a hard embedded INT3 +/* +#if REAL_LINUX_VERSION_CODE < 0x020400 + if(ulAddressflags & PF_PTRACED) ) +#else + if(ulAddressptrace & PT_PTRACED) ) +#endif +*/ + if( ulAddress ) + { + if(ScanExportsByAddress(&pFind,GetLinearAddress(CurrentCS,CurrentEIP))) + { + PICE_sprintf(tempShell,"pICE: break due to embedded INT 3 at %s (%.4X:%.8X)\n",pFind,CurrentCS,CurrentEIP); + } + else + { + PICE_sprintf(tempShell,"pICE: break due to embedded INT 3 at user-mode address %.4X:%.8X\n",CurrentCS,CurrentEIP); + } + Print(OUTPUT_WINDOW,tempShell); + CurrentEFL &= ~(1<<16); // clear resume flag + } + // well someone is already debugging this, we must pass the INT3 on to old handler + // but only when it's a user-mode address +/* + else + { + if(ulAddressring0 transition)\n\t \ + // stack is switched if orig. SS is not global kernel code segment\n\t \ + movl 4*4(%esp),%eax\n\t \ + cmpw $" STR(GLOBAL_CODE_SEGMENT) ",%ax\n\t \ + je notswitched\n\t \ +\n\t \ + // switched stack\n\t \ + movl 6*4(%esp),%eax\n\t \ + mov %eax,_CurrentESP\n\t \ + mov 7*4(%esp),%eax\n\t \ + movzwl %ax,%eax\n\t \ + mov %ax,_CurrentSS\n\t \ + jmp afterswitch\n\t \ +\n\t \ +notswitched:\n\t \ + // didn't switch stack\n\t \ + movl %esp,_CurrentESP\n\t \ + addl $24,_CurrentESP\n\t \ + movw %ss,%ax\n\t \ + movzwl %ax,%eax\n\t \ + mov %ax,_CurrentSS\n\t \ +\n\t \ +afterswitch:\n\t \ + // save EIP\n\t \ + mov 3*4(%esp),%eax\n\t \ + mov %eax,_CurrentEIP\n\t \ + //save CS\n\t \ + mov 4*4(%esp),%eax\n\t \ + movzwl %ax,%eax\n\t \ + movw %ax,_CurrentCS\n\t \ + // save flags\n\t \ + movl 5*4(%esp),%eax\n\t \ + andl $0xFFFFFEFF,%eax\n\t \ + movl %eax,_CurrentEFL\n\t \ +\n\t \ + pushal\n\t \ +\n\t \ + // get reason code\n\t \ + mov 0x28(%esp),%ebx\n\t \ +\n\t \ + /*\n\t \ + * Load the PCR selector.\n\t \ + */\n\t \ +\n\t \ + movl %fs, %eax\n\t \ + movl %eax, _OLD_PCR\n\t \ + movl _PCR_SEL, %eax\n\t \ + movl %eax, %fs\n\t \ +\n\t \ + // setup a large work stack\n\t \ + movl %esp,%eax\n\t \ + movl %eax,_ulRealStackPtr\n\t \ +\n\t \ + pushl %ebx\n\t \ + call _RealIsr\n\t \ + addl $4,%esp\n\t \ +\n\t \ + pushl %eax\n\t \ + movl _OLD_PCR, %eax\n\t \ + movl %eax, %fs\n\t \ + popl %eax\n\t \ +\n\t \ + // restore all regs\n\t \ + popal\n\t \ +\n\t \ + // do an EOI to IRQ controller (because we definitely pressed some key)\n\t \ + // TODO: SMP APIC support\n\t \ + movb $0x20,%al\n\t \ + outb %al,$0x20\n\t \ +\n\t \ + popl %ds\n\t \ + popl %eax\n\t \ +\n\t \ + // remove reason code\n\t \ + addl $4,%esp\n\t \ +\n\t \ + // make EAX available\n\t \ + pushl %eax\n\t \ +\n\t \ + // modify or restore EFLAGS\n\t \ + .byte 0x2e\n\t \ + mov _CurrentEFL,%eax\n\t \ + mov %eax,3*4(%esp)\n\t \ + .byte 0x2e\n\t \ + movzwl _CurrentCS,%eax\n\t \ + mov %eax,2*4(%esp)\n\t \ + .byte 0x2e\n\t \ + mov _CurrentEIP,%eax\n\t \ + mov %eax,1*4(%esp)\n\t \ +\n\t \ + // restore EAX\n\t \ + popl %eax\n\t \ +\n\t \ + // do we need to call old INT1 handler\n\t \ + .byte 0x2e\n\t \ + cmp $0,_dwCallOldInt1Handler\n\t \ + je do_iret2\n\t \ +\n\t \ + // call INT3 handler\n\t \ + .byte 0x2e\n\t \ + jmp *_OldInt1Handler\n\t \ +\n\t \ +do_iret2:\n\t \ + // do we need to call old INT3 handler\n\t \ + .byte 0x2e\n\t \ + cmp $0,_dwCallOldInt3Handler\n\t \ + je do_iret1\n\t \ +\n\t \ + // call INT3 handler\n\t \ + .byte 0x2e\n\t \ + jmp *_OldInt3Handler\n\t \ +\n\t \ +do_iret1:\n\t \ + // do we need to call old pagefault handler\n\t \ + .byte 0x2e\n\t \ + cmp $0,_dwCallOldIntEHandler\n\t \ + je do_iret3\n\t \ +\n\t \ + // call old pagefault handler\n\t \ + .byte 0x2e\n\t \ + pushl _error_code\n\t \ + .byte 0x2e\n\t \ + jmp *_OldIntEHandler\n\t \ +\n\t \ +do_iret3:\n\t \ + // do we need to call old general protection fault handler\n\t \ + .byte 0x2e\n\t \ + cmp $0,_dwCallOldGPFaultHandler\n\t \ + je do_iret\n\t \ +\n\t \ + // call old pagefault handler\n\t \ + .byte 0x2e\n\t \ + pushl _error_code\n\t \ + .byte 0x2e\n\t \ + jmp *_OldGPFaultHandler\n\t \ +\n\t \ +do_iret:\n\t \ + //ei\n\t \ + //int3\n\t \ + iretl "); + +// +// stub for entering via CTRL-F +// +// IDTs keyboard IRQ points here +// +__asm__ ("\n\t \ +NewGlobalInt31Handler:\n\t \ + .byte 0x2e\n\t \ + cmpb $0,_bEnterNow\n\t \ + jne dotheenter\n\t \ +\n\t \ + // chain to old handler\n\t \ + .byte 0x2e\n\t \ + jmp *_OldGlobalInt31Handler\n\t \ +\n\t \ +dotheenter:\n\t \ + pushl $" STR(REASON_CTRLF) "\n\t \ + jmp NewInt31Handler " +); + +void InstallGlobalKeyboardHook(void) +{ + ULONG LocalNewGlobalInt31Handler; + + ENTER_FUNC(); + + MaskIrqs(); + if(!OldGlobalInt31Handler) + { + __asm__("mov $NewGlobalInt31Handler,%0" + :"=r" (LocalNewGlobalInt31Handler) + : + :"eax"); + OldGlobalInt31Handler=SetGlobalInt(KeyboardIRQL,(ULONG)LocalNewGlobalInt31Handler); + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} + +void DeInstallGlobalKeyboardHook(void) +{ + ENTER_FUNC(); + + MaskIrqs(); + if(OldGlobalInt31Handler) + { + SetGlobalInt(KeyboardIRQL,(ULONG)OldGlobalInt31Handler); + OldGlobalInt31Handler=0; + } + UnmaskIrqs(); + + LEAVE_FUNC(); +} + + diff --git a/rosapps/sysutils/utils/pice/module/shell.h b/rosapps/sysutils/utils/pice/module/shell.h new file mode 100644 index 00000000000..cac78222ddc --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/shell.h @@ -0,0 +1,91 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + shell.h + +Abstract: + + HEADER for shell.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +//void InstallKeyboardHook(void); +//void DeInstallKeyboardHook(void); +void InstallGlobalKeyboardHook(void); +void DeInstallGlobalKeyboardHook(void); + +void RealIsr(ULONG dwReasonForBreak); +void NewInt31Handler(void); + +extern volatile BOOLEAN bNotifyToExit; +extern volatile BOOLEAN bSingleStep; +extern volatile UCHAR ucKeyPressedWhileIdle; +extern volatile BOOLEAN bInDebuggerShell; + +extern ULONG CurrentEIP,CurrentEFL; +extern ULONG CurrentEAX,CurrentEBX,CurrentECX,CurrentEDX; +extern ULONG CurrentESP,CurrentEBP,CurrentESI,CurrentEDI; +extern ULONG CurrentDR0,CurrentDR1,CurrentDR2,CurrentDR3,CurrentDR6,CurrentDR7; +extern ULONG CurrentCR0,CurrentCR2,CurrentCR3; +extern USHORT CurrentCS,CurrentDS,CurrentES,CurrentFS,CurrentGS,CurrentSS; +extern volatile BOOLEAN bControl; // TRUE when CTRL key was pressed +extern volatile BOOLEAN bShift; // TRUE when SHIFT key was pressed +extern volatile BOOLEAN bAlt; // TRUE when SHIFT key was pressed + +// previous context +extern ULONG OldEIP,OldEFL; +extern ULONG OldEAX,OldEBX,OldECX,OldEDX; +extern ULONG OldESP,OldEBP,OldESI,OldEDI; +extern USHORT OldCS,OldDS,OldES,OldFS,OldGS,OldSS; + +extern ULONG CurrentProcess; + +extern USHORT OldSelector; +extern ULONG OldOffset; + +extern ULONG ulRealStackPtr; // serves as current process pointer too!! + +extern ULONG g_ulLineNumberStart; +extern BOOLEAN bStepThroughSource; +extern BOOLEAN bStepInto; + +#define REASON_INT3 (0) +#define REASON_SINGLESTEP (1) +#define REASON_CTRLF (2) +#define REASON_PAGEFAULT (3) +#define REASON_GP_FAULT (4) +#define REASON_HARDWARE_BP (5) +#define REASON_DOUBLE_FAULT (6) +#define REASON_MODULE_LOAD (7) +#define REASON_INTERNAL_ERROR (8) + +extern volatile BOOLEAN bEnterNow; + +// keyboard controller defines +#define I8042_PHYSICAL_BASE 0x60 +#define I8042_DATA_REGISTER_OFFSET 0 +#define I8042_COMMAND_REGISTER_OFFSET 4 +#define I8042_STATUS_REGISTER_OFFSET 4 + +void ShowStatusLine(void); + +#define KEYBOARD_IRQ 1 diff --git a/rosapps/sysutils/utils/pice/module/stab.def b/rosapps/sysutils/utils/pice/module/stab.def new file mode 100644 index 00000000000..7e2c129dc30 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/stab.def @@ -0,0 +1,265 @@ +/* Table of DBX symbol codes for the GNU system. + Copyright (C) 1988, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + +/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files + overlaps the N_UNDF used for ordinary symbols. In ELF files, the + debug information is in a different file section, so there is no conflict. + This symbol's n_value gives the size of the string section associated + with this file. The symbol's n_strx (relative to the just-updated + string section start address) gives the name of the source file, + e.g. "foo.c", without any path information. The symbol's n_desc gives + the count of upcoming symbols associated with this file (not including + this one). */ +__define_stab (N_UNDF, 0x00, "UNDF") + +/* Global variable. Only the name is significant. + To find the address, look in the corresponding external symbol. */ +__define_stab (N_GSYM, 0x20, "GSYM") + +/* Function name for BSD Fortran. Only the name is significant. + To find the address, look in the corresponding external symbol. */ +__define_stab (N_FNAME, 0x22, "FNAME") + +/* Function name or text-segment variable for C. Value is its address. + Desc is supposedly starting line number, but GCC doesn't set it + and DBX seems not to miss it. */ +__define_stab (N_FUN, 0x24, "FUN") + +/* Data-segment variable with internal linkage. Value is its address. + "Static Sym". */ +__define_stab (N_STSYM, 0x26, "STSYM") + +/* BSS-segment variable with internal linkage. Value is its address. */ +__define_stab (N_LCSYM, 0x28, "LCSYM") + +/* Name of main routine. Only the name is significant. */ +__define_stab (N_MAIN, 0x2a, "MAIN") + +/* Solaris2: Read-only data symbols. */ +__define_stab (N_ROSYM, 0x2c, "ROSYM") + +/* Global symbol in Pascal. + Supposedly the value is its line number; I'm skeptical. */ +__define_stab (N_PC, 0x30, "PC") + +/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */ +__define_stab (N_NSYMS, 0x32, "NSYMS") + +/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */ +__define_stab (N_NOMAP, 0x34, "NOMAP") + +/* New stab from Solaris 2. Like N_SO, but for the object file. Two in + a row provide the build directory and the relative path of the .o from it. + Solaris2 uses this to avoid putting the stabs info into the linked + executable; this stab goes into the ".stab.index" section, and the debugger + reads the real stabs directly from the .o files instead. */ +__define_stab (N_OBJ, 0x38, "OBJ") + +/* New stab from Solaris 2. Options for the debugger, related to the + source language for this module. E.g. whether to use ANSI + integral promotions or traditional integral promotions. */ +__define_stab (N_OPT, 0x3c, "OPT") + +/* Register variable. Value is number of register. */ +__define_stab (N_RSYM, 0x40, "RSYM") + +/* Modula-2 compilation unit. Can someone say what info it contains? */ +__define_stab (N_M2C, 0x42, "M2C") + +/* Line number in text segment. Desc is the line number; + value is corresponding address. On Solaris2, the line number is + relative to the start of the current function. */ +__define_stab (N_SLINE, 0x44, "SLINE") + +/* Similar, for data segment. */ +__define_stab (N_DSLINE, 0x46, "DSLINE") + +/* Similar, for bss segment. */ +__define_stab (N_BSLINE, 0x48, "BSLINE") + +/* Sun's source-code browser stabs. ?? Don't know what the fields are. + Supposedly the field is "path to associated .cb file". THIS VALUE + OVERLAPS WITH N_BSLINE! */ +__define_stab_duplicate (N_BROWS, 0x48, "BROWS") + +/* GNU Modula-2 definition module dependency. Value is the modification time + of the definition file. Other is non-zero if it is imported with the + GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there + are enough empty fields? */ +__define_stab(N_DEFD, 0x4a, "DEFD") + +/* New in Solaris2. Function start/body/end line numbers. */ +__define_stab(N_FLINE, 0x4C, "FLINE") + +/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2 + and one is for C++. Still,... */ +/* GNU C++ exception variable. Name is variable name. */ +__define_stab (N_EHDECL, 0x50, "EHDECL") +/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */ +__define_stab_duplicate (N_MOD2, 0x50, "MOD2") + +/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if + this entry is immediately followed by a CAUGHT stab saying what exception + was caught. Multiple CAUGHT stabs means that multiple exceptions + can be caught here. If Desc is 0, it means all exceptions are caught + here. */ +__define_stab (N_CATCH, 0x54, "CATCH") + +/* Structure or union element. Value is offset in the structure. */ +__define_stab (N_SSYM, 0x60, "SSYM") + +/* Solaris2: Last stab emitted for module. */ +__define_stab (N_ENDM, 0x62, "ENDM") + +/* Name of main source file. + Value is starting text address of the compilation. + If multiple N_SO's appear, the first to contain a trailing / is the + compilation directory. The first to not contain a trailing / is the + source file name, relative to the compilation directory. Others (perhaps + resulting from cfront) are ignored. + On Solaris2, value is undefined, but desc is a source-language code. */ + +__define_stab (N_SO, 0x64, "SO") + +/* Automatic variable in the stack. Value is offset from frame pointer. + Also used for type descriptions. */ +__define_stab (N_LSYM, 0x80, "LSYM") + +/* Beginning of an include file. Only Sun uses this. + In an object file, only the name is significant. + The Sun linker puts data into some of the other fields. */ +__define_stab (N_BINCL, 0x82, "BINCL") + +/* Name of sub-source file (#include file). + Value is starting text address of the compilation. */ +__define_stab (N_SOL, 0x84, "SOL") + +/* Parameter variable. Value is offset from argument pointer. + (On most machines the argument pointer is the same as the frame pointer. */ +__define_stab (N_PSYM, 0xa0, "PSYM") + +/* End of an include file. No name. + This and N_BINCL act as brackets around the file's output. + In an object file, there is no significant data in this entry. + The Sun linker puts data into some of the fields. */ +__define_stab (N_EINCL, 0xa2, "EINCL") + +/* Alternate entry point. Value is its address. */ +__define_stab (N_ENTRY, 0xa4, "ENTRY") + +/* Beginning of lexical block. + The desc is the nesting level in lexical blocks. + The value is the address of the start of the text for the block. + The variables declared inside the block *precede* the N_LBRAC symbol. + On Solaris2, the value is relative to the start of the current function. */ +__define_stab (N_LBRAC, 0xc0, "LBRAC") + +/* Place holder for deleted include file. Replaces a N_BINCL and everything + up to the corresponding N_EINCL. The Sun linker generates these when + it finds multiple identical copies of the symbols from an include file. + This appears only in output from the Sun linker. */ +__define_stab (N_EXCL, 0xc2, "EXCL") + +/* Modula-2 scope information. Can someone say what info it contains? */ +__define_stab (N_SCOPE, 0xc4, "SCOPE") + +/* End of a lexical block. Desc matches the N_LBRAC's desc. + The value is the address of the end of the text for the block. + On Solaris2, the value is relative to the start of the current function. */ +__define_stab (N_RBRAC, 0xe0, "RBRAC") + +/* Begin named common block. Only the name is significant. */ +__define_stab (N_BCOMM, 0xe2, "BCOMM") + +/* End named common block. Only the name is significant + (and it should match the N_BCOMM). */ +__define_stab (N_ECOMM, 0xe4, "ECOMM") + +/* Member of a common block; value is offset within the common block. + This should occur within a BCOMM/ECOMM pair. */ +__define_stab (N_ECOML, 0xe8, "ECOML") + +/* Solaris2: Pascal "with" statement: type,,0,0,offset */ +__define_stab (N_WITH, 0xea, "WITH") + +/* These STAB's are used on Gould systems for Non-Base register symbols + or something like that. FIXME. I have assigned the values at random + since I don't have a Gould here. Fixups from Gould folk welcome... */ +__define_stab (N_NBTEXT, 0xF0, "NBTEXT") +__define_stab (N_NBDATA, 0xF2, "NBDATA") +__define_stab (N_NBBSS, 0xF4, "NBBSS") +__define_stab (N_NBSTS, 0xF6, "NBSTS") +__define_stab (N_NBLCS, 0xF8, "NBLCS") + +/* Second symbol entry containing a length-value for the preceding entry. + The value is the length. */ +__define_stab (N_LENG, 0xfe, "LENG") + +/* The above information, in matrix format. + + STAB MATRIX + _________________________________________________ + | 00 - 1F are not dbx stab symbols | + | In most cases, the low bit is the EXTernal bit| + + | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA | + | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT | + + | 08 BSS | 0A INDR | 0C FN_SEQ | 0E WEAKA | + | 09 |EXT | 0B | 0D WEAKU | 0F WEAKT | + + | 10 WEAKD | 12 COMM | 14 SETA | 16 SETT | + | 11 WEAKB | 13 | 15 | 17 | + + | 18 SETD | 1A SETB | 1C SETV | 1E WARNING| + | 19 | 1B | 1D | 1F FN | + + |_______________________________________________| + | Debug entries with bit 01 set are unused. | + | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | + | 28 LCSYM | 2A MAIN | 2C ROSYM | 2E | + | 30 PC | 32 NSYMS | 34 NOMAP | 36 | + | 38 OBJ | 3A | 3C OPT | 3E | + | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE | + | 48 BSLINE*| 4A DEFD | 4C FLINE | 4E | + | 50 EHDECL*| 52 | 54 CATCH | 56 | + | 58 | 5A | 5C | 5E | + | 60 SSYM | 62 ENDM | 64 SO | 66 | + | 68 | 6A | 6C | 6E | + | 70 | 72 | 74 | 76 | + | 78 | 7A | 7C | 7E | + | 80 LSYM | 82 BINCL | 84 SOL | 86 | + | 88 | 8A | 8C | 8E | + | 90 | 92 | 94 | 96 | + | 98 | 9A | 9C | 9E | + | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | + | A8 | AA | AC | AE | + | B0 | B2 | B4 | B6 | + | B8 | BA | BC | BE | + | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | + | C8 | CA | CC | CE | + | D0 | D2 | D4 | D6 | + | D8 | DA | DC | DE | + | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | + | E8 ECOML | EA WITH | EC | EE | + | F0 | F2 | F4 | F6 | + | F8 | FA | FC | FE LENG | + +-----------------------------------------------+ + * 50 EHDECL is also MOD2. + * 48 BSLINE is also BROWS. + */ diff --git a/rosapps/sysutils/utils/pice/module/stab_gnu.h b/rosapps/sysutils/utils/pice/module/stab_gnu.h new file mode 100644 index 00000000000..faeba1486b6 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/stab_gnu.h @@ -0,0 +1,67 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + stab_gnu.h + +Abstract: + + HEADER, GNU stabs symbols + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#ifndef __GNU_STAB__ + +/* Indicate the GNU stab.h is in use. */ + +#define __GNU_STAB__ + +#define __define_stab(NAME, CODE, STRING) NAME=CODE, +#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE, + +enum __stab_debug_code +{ +#include "stab.def" +LAST_UNUSED_STAB_CODE +}; + +#undef __define_stab + +/* Definitions of "desc" field for N_SO stabs in Solaris2. */ + +#define N_SO_AS 1 +#define N_SO_C 2 +#define N_SO_ANSI_C 3 +#define N_SO_CC 4 /* C++ */ +#define N_SO_FORTRAN 5 +#define N_SO_PASCAL 6 + +/* Solaris2: Floating point type values in basic types. */ + +#define NF_NONE 0 +#define NF_SINGLE 1 /* IEEE 32-bit */ +#define NF_DOUBLE 2 /* IEEE 64-bit */ +#define NF_COMPLEX 3 /* Fortran complex */ +#define NF_COMPLEX16 4 /* Fortran double complex */ +#define NF_COMPLEX32 5 /* Fortran complex*16 */ +#define NF_LDOUBLE 6 /* Long double (whatever that is) */ + +#endif /* __GNU_STAB_ */ diff --git a/rosapps/sysutils/utils/pice/module/symbols.c b/rosapps/sysutils/utils/pice/module/symbols.c new file mode 100644 index 00000000000..9c2358e756e --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/symbols.c @@ -0,0 +1,2984 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module ModuleName: + + symbols.c + +Abstract: + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + Reactos Port by Eugene Ingerman + +Revision History: + + 19-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" +#include "stab_gnu.h" + +#include +#include +#include +#include +#include + +#define NDEBUG +#include + + +PVOID pExports=0; +ULONG ulExportLen=0; + +LOCAL_VARIABLE local_vars[512]; + +PICE_SYMBOLFILE_HEADER* apSymbols[32]={NULL,}; +ULONG ulNumSymbolsLoaded=0; + +ULONG kernel_end=0; + +char tempSym[1024]; // temp buffer for output + + +PULONG LocalRegs[]= +{ + &CurrentEAX, + &CurrentECX, + &CurrentEDX, + &CurrentEBX, + &CurrentESP, + &CurrentEBP, + &CurrentESI, + &CurrentEDI, + &CurrentEIP, + &CurrentEFL +}; + +typedef struct _VRET +{ + ULONG value; + ULONG type; + ULONG father_type; + ULONG error; + ULONG file; + ULONG size; + ULONG address; + char name[256]; + char type_name[256]; + BOOLEAN bPtrType; + BOOLEAN bStructType; + BOOLEAN bArrayType; + PICE_SYMBOLFILE_HEADER* pSymbols; +}VRET,*PVRET; + +ULONG ulIndex; +LPSTR pExpression; +VRET vr; +VRET vrStructMembers[1024]; +ULONG ulNumStructMembers; + +BOOLEAN Expression(PVRET pvr); + +LIST_ENTRY *pModuleListHead = NULL; +extern PDIRECTORY_OBJECT *pNameSpaceRoot; +extern PDEBUG_MODULE pdebug_module_tail; +extern PDEBUG_MODULE pdebug_module_head; + + +PVOID HEADER_TO_BODY(POBJECT_HEADER obj) +{ + return(((void *)obj)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER)); +} + +POBJECT_HEADER BODY_TO_HEADER(PVOID body) +{ + PCOMMON_BODY_HEADER chdr = (PCOMMON_BODY_HEADER)body; + return(CONTAINING_RECORD((&(chdr->Type)),OBJECT_HEADER,Type)); +} + +/*-----------------12/26/2001 7:59PM---------------- + * FreeModuleList - free list allocated with InitModuleList. Must + * be called at passive irql. + * --------------------------------------------------*/ +VOID FreeModuleList( PDEBUG_MODULE pm ) +{ + PDEBUG_MODULE pNext = pm; + + ENTER_FUNC(); + + while( pNext ){ + pNext = pm->next; + ExFreePool( pm ); + } + LEAVE_FUNC(); +} + +/*-----------------12/26/2001 7:58PM---------------- + * InitModuleList - creates linked list of length len for debugger. Can't be + * called at elevated IRQL + * --------------------------------------------------*/ +BOOLEAN InitModuleList( PDEBUG_MODULE *ppmodule, ULONG len ) +{ + ULONG i; + PDEBUG_MODULE pNext = NULL, pm = *ppmodule; + + ENTER_FUNC(); + + ASSERT(pm==NULL); + + for(i=1;i<=len;i++){ + pm = (PDEBUG_MODULE)ExAllocatePool( NonPagedPool, sizeof( DEBUG_MODULE ) ); + if( !pm ){ + FreeModuleList(pNext); + return FALSE; + } + pm->next = pNext; + pm->size = 0; + pm->BaseAddress = NULL; + //DbgPrint("len1: %d\n", pm->name.Length); + pNext = pm; + } + *ppmodule = pm; + + LEAVE_FUNC(); + + return TRUE; +} + +BOOLEAN ListUserModules( PPEB peb ) +{ + PLIST_ENTRY UserModuleListHead; + PLIST_ENTRY Entry; + PLDR_DATA_TABLE_ENTRY Module; + PPEB_LDR_DATA Ldr; + + ENTER_FUNC(); + + Ldr = peb->Ldr; + if( Ldr && IsAddressValid((ULONG)Ldr)){ + UserModuleListHead = &Ldr->InLoadOrderModuleList; + ASSERT(IsAddressValid((ULONG)UserModuleListHead)); + Entry = UserModuleListHead->Flink; + while (Entry != UserModuleListHead) + { + Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList); + //DbgPrint("Module: %x, BaseAddress: %x\n", Module, Module->BaseAddress); + + DPRINT((0,"FullName: %S, BaseName: %S, Length: %ld, EntryPoint: %x, BaseAddress: %x\n", Module->FullDllName.Buffer, + Module->BaseDllName.Buffer, Module->SizeOfImage, Module->EntryPoint, Module->BaseAddress )); + + pdebug_module_tail->size = Module->SizeOfImage; + pdebug_module_tail->BaseAddress = Module->BaseAddress; + pdebug_module_tail->EntryPoint = (PVOID)(Module->EntryPoint); + ASSERT(Module->BaseDllName.Lengthname, Module->BaseDllName.Buffer ); + pdebug_module_tail = pdebug_module_tail->next; + + Entry = Entry->Flink; + } + } + LEAVE_FUNC(); + return TRUE; +} + +POBJECT FindDriverObjectDirectory( void ) +{ + PLIST_ENTRY current; + POBJECT_HEADER current_obj; + PDIRECTORY_OBJECT pd; + + ENTER_FUNC(); + + if( pNameSpaceRoot && *pNameSpaceRoot ){ + current = (*pNameSpaceRoot)->head.Flink; + while (current!=(&((*pNameSpaceRoot)->head))) + { + current_obj = CONTAINING_RECORD(current,OBJECT_HEADER,Entry); + DPRINT((0,"Scanning %S\n",current_obj->Name.Buffer)); + if (_wcsicmp(current_obj->Name.Buffer, L"Modules")==0) + { + pd=HEADER_TO_BODY(current_obj); + DPRINT((0,"Found it %x\n",pd)); + return pd; + } + current = current->Flink; + } + } + LEAVE_FUNC(); + return NULL; +} + +BOOLEAN ListDriverModules( void ) +{ + PLIST_ENTRY current_entry; + PMODULE_OBJECT current; + POBJECT_HEADER current_obj; + + ENTER_FUNC(); + + ASSERT( pModuleListHead ); + + current_entry = pModuleListHead->Flink; + + while (current_entry != (pModuleListHead)){ + + current = CONTAINING_RECORD(current_entry,MODULE_OBJECT,ListEntry); + + DPRINT((0,"FullName: %S, BaseName: %S, Length: %ld, EntryPoint: %x\n", current->FullName.Buffer, + current->BaseName.Buffer, current->Length, current->EntryPoint )); + + pdebug_module_tail->BaseAddress = current->Base; + pdebug_module_tail->size = current->Length; + PICE_wcscpy( pdebug_module_tail->name, current->BaseName.Buffer); + pdebug_module_tail->EntryPoint = current->EntryPoint; + + pdebug_module_tail = pdebug_module_tail->next; + + if (current && _wcsicmp(current->BaseName.Buffer, L"ntoskrnl")==0) + { + kernel_end = (ULONG)current->Base + current->Length; + } + current_entry = current_entry->Flink; + } + + LEAVE_FUNC(); + return TRUE; +} + +BOOLEAN BuildModuleList( void ) +{ + PPEB peb; + PEPROCESS tsk; + ENTER_FUNC(); + + pdebug_module_tail = pdebug_module_head; + tsk = IoGetCurrentProcess(); + ASSERT(IsAddressValid((ULONG)tsk)); + if( tsk ){ + peb = tsk->Peb; + if( peb ){ + if( !ListUserModules( peb ) ){ + LEAVE_FUNC(); + return FALSE; + } + } + } + if( !ListDriverModules() ){ + LEAVE_FUNC(); + return FALSE; + } + LEAVE_FUNC(); + return TRUE; +} + +//************************************************************************* +// IsModuleLoaded() +// +//************************************************************************* +PDEBUG_MODULE IsModuleLoaded(LPSTR p) +{ + PDEBUG_MODULE pd; + + ENTER_FUNC(); + DPRINT((0,"IsModuleLoaded(%s)\n",p)); + + if(BuildModuleList()) + { + pd = pdebug_module_head; + do + { + char temp[DEBUG_MODULE_NAME_LEN]; + DPRINT((0,"module (%x) %S\n",pd->size,pd->name)); + CopyWideToAnsi(temp,pd->name); + if(pd->size && PICE_strcmpi(p,temp) == 0) + { + DPRINT((0,"module %S is loaded!\n",pd->name)); + LEAVE_FUNC(); + return pd; + } + }while((pd = pd->next)!=pdebug_module_tail); + } + LEAVE_FUNC(); + return NULL; +} + +//************************************************************************* +// ScanExports() +// +//************************************************************************* +BOOLEAN ScanExports(const char *pFind,PULONG pValue) +{ + char temp[256]; + LPSTR pStr=NULL; + LPSTR pExp = pExports; + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + DPRINT((0,"ScanExports pValue: %x\n", pValue)); +nomatch: + if(pExports) + pStr = strstr(pExp,pFind); + + if(pStr) + { + LPSTR p; + ULONG state; + LPSTR pOldStr = pStr; + + for(;(*pStr!=0x0a && *pStr!=0x0d) && (ULONG)pStr>=(ULONG)pExports;pStr--); + pStr++; + p = temp; + for(;(*pStr!=0x0a && *pStr!=0x0d);)*p++=*pStr++; + *p=0; + p = (LPSTR) PICE_strtok(temp," "); + state=0; + while(p) + { + switch(state) + { + case 0: + ConvertTokenToHex(p,pValue); + break; + case 1: + break; + case 2: + if(strcmp(p,pFind)!=0) + { + DPRINT((0,"Not: %s\n", p)); + pExp = pOldStr+1; + goto nomatch; + } + state = -1; + bResult = TRUE; + DPRINT((0,"%s @ %x\n",pFind,*pValue)); + goto exit; + break; + } + state++; + p = (char*) PICE_strtok(NULL," "); + } + } +exit: + DPRINT((0,"%s %x @ %x\n",pFind,pValue,*pValue)); + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// ReadHex() +// +//************************************************************************* +BOOLEAN ReadHex(LPSTR p,PULONG pValue) +{ + ULONG result=0,i; + + for(i=0;i<8 && p[i]!=0 && p[i]!=' ';i++) + { + if(p[i]>='0' && p[i]<='9') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'0'); + } + else if(p[i]>='A' && p[i]<='F') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'A'+10); + } + else if(p[i]>='a' && p[i]<='f') + { + result<<=4; + result|=(ULONG)(UCHAR)(p[i]-'a'+10); + } + else + return FALSE; + } + + *pValue = result; + return TRUE; +} + +//************************************************************************* +// ScanExportLine() +// +//************************************************************************* +BOOLEAN ScanExportLine(LPSTR p,PULONG ulValue,LPSTR* ppPtrToSymbol) +{ + BOOLEAN bResult = FALSE; + + if(ReadHex(p,ulValue)) + { + p += 11; + *ppPtrToSymbol += 11; + bResult = TRUE; + } + + return bResult; +} + +//************************************************************************* +// ValidityCheckSymbols() +// +//************************************************************************* +BOOLEAN ValidityCheckSymbols(PICE_SYMBOLFILE_HEADER* pSymbols) +{ + BOOLEAN bRet; + + DPRINT((0,"ValidityCheckSymbols()\n")); + + bRet = (IsRangeValid((ULONG)pSymbols + pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader) && + IsRangeValid((ULONG)pSymbols + pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals) && + IsRangeValid((ULONG)pSymbols + pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings) && + IsRangeValid((ULONG)pSymbols + pSymbols->ulOffsetToStabs,pSymbols->ulSizeOfStabs) && + IsRangeValid((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings,pSymbols->ulSizeOfStabsStrings)); + + DPRINT((0,"ValidityCheckSymbols(): symbols are %s\n",bRet?"VALID":"NOT VALID")); + + return bRet; +} + +//************************************************************************* +// FindModuleSymbols() +// +//************************************************************************* +PICE_SYMBOLFILE_HEADER* FindModuleSymbols(ULONG addr) +{ + ULONG start,end,i; + PDEBUG_MODULE pd = pdebug_module_head; + + DPRINT((0,"FindModuleSymbols(%x)\n",addr)); + if(BuildModuleList()) + { + i=0; + pd = pdebug_module_head; + do + { + DPRINT((0,"pd: %x\n", pd)); + if(pd->size) + { + start = (ULONG)pd->BaseAddress; + end = start + pd->size; + DPRINT((0,"FindModuleSymbols(): %S %x-%x\n",pd->name,start,end)); + if(addr>=start && addrname,start,end)); + for(i=0;iname )); + if(PICE_wcsicmp(pd->name,apSymbols[i]->name) == 0) + { + if(ValidityCheckSymbols(apSymbols[i])) + return apSymbols[i]; + else + return NULL; + } + } + } + } + }while((pd = pd->next) != pdebug_module_tail); + } + + return NULL; +} + +//************************************************************************* +// FindModuleFromAddress() +// +//************************************************************************* +PDEBUG_MODULE FindModuleFromAddress(ULONG addr) +{ + PDEBUG_MODULE pd; + ULONG start,end; + + DPRINT((0,"FindModuleFromAddress()\n")); + if(BuildModuleList()) + { + pd = pdebug_module_head; + do + { + if(pd->size) + { + start = (ULONG)pd->BaseAddress; + end = start + pd->size; + DPRINT((0,"FindModuleFromAddress(): %S %x-%x\n",pd->name,start,end)); + if(addr>=start && addrname)); + return pd; + } + } + }while((pd = pd->next)!=pdebug_module_tail); + } + + return NULL; +} + +//************************************************************************* +// FindModuleByName() +// +//************************************************************************* +PDEBUG_MODULE FindModuleByName(LPSTR modname) +{ + PDEBUG_MODULE pd; + WCHAR tempstr[DEBUG_MODULE_NAME_LEN]; + + DPRINT((0,"FindModuleFromAddress()\n")); + if( !PICE_MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, DEBUG_MODULE_NAME_LEN ) ) + { + DPRINT((0,"Can't convert module name.\n")); + return NULL; + } + + if(BuildModuleList()) + { + pd = pdebug_module_head; + do + { + if(pd->size) + { + if(PICE_wcsicmp(tempstr,pd->name) == 0) + { + DPRINT((0,"FindModuleByName(): found %S\n",pd->name)); + return pd; + } + } + }while((pd = pd->next) != pdebug_module_tail); + } + + return NULL; +} + +//************************************************************************* +// FindModuleSymbolsByModuleName() +// +//************************************************************************* +PICE_SYMBOLFILE_HEADER* FindModuleSymbolsByModuleName(LPSTR modname) +{ + ULONG i; + WCHAR tempstr[DEBUG_MODULE_NAME_LEN]; + + DPRINT((0,"FindModuleSymbols()\n")); + if( !PICE_MultiByteToWideChar(CP_ACP, NULL, modname, -1, tempstr, DEBUG_MODULE_NAME_LEN ) ) + { + DPRINT((0,"Can't convert module name in FindModuleSymbols.\n")); + return NULL; + } + + for(i=0;iname) == 0) + return apSymbols[i]; + } + + return NULL; +} + +//************************************************************************* +// ScanExportsByAddress() +// +//************************************************************************* +BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue) +{ + char temp[256]; + static char temp3[256]; + LPSTR p,pStartOfLine,pSymbolName=NULL; + ULONG ulCurrentValue=0; + BOOLEAN bResult = FALSE; + PDEBUG_MODULE pd; + ULONG ulMinValue = -1; + PIMAGE_SYMBOL pSym,pSymEnd; //running pointer to symbols and end of sym talbe + PIMAGE_SYMBOL pFoundSym = NULL; //current best symbol match + ULONG ulAddr = 0x0; //address of the best match + LPSTR pStr; + PIMAGE_SECTION_HEADER pShdr; + PICE_SYMBOLFILE_HEADER* pSymbols; + ULONG ulSectionSize; + LPSTR pName; + + ENTER_FUNC(); + DPRINT((0,"In ScanExportsByAddress:\n")); + + pSymbols = FindModuleSymbols(ulValue); + DPRINT((0,"pSymbols: %x\n", pSymbols)); + + if(BuildModuleList()){ + if(pSymbols && pdebug_module_head) + { + PDEBUG_MODULE pdTemp; + + DPRINT((0,"looking up symbols\n")); + pd = pdebug_module_head; + do + { + if(pd->size){ + pdTemp = pd; + + if(ulValue>=((ULONG)pdTemp->BaseAddress) && ulValue<((ULONG)pdTemp+pdTemp->size)) + { + if(PICE_wcsicmp(pdTemp->name,pSymbols->name) == 0) + { + DPRINT((0,"ScanExportsByAddress(): found symbols for module %S @ %x \n",pdTemp->name,(ULONG)pSymbols)); + + pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals); + pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals); + pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings); + pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders); + + if(!IsRangeValid((ULONG)pSym,sizeof(IMAGE_SYMBOL) ) ) //should we actually check all the symbols here? + { + DPRINT((0,"ScanExportsByAddress(): pSym = %x is not a valid pointer\n",(ULONG)pSym)); + return FALSE; + } + + DPRINT((0,"ScanExportsByAddress(): pSym = %x\n",pSym)); + DPRINT((0,"ScanExportsByAddress(): pStr = %x\n",pStr)); + DPRINT((0,"ScanExportsByAddress(): pShdr = %x\n",pShdr)); + + DPRINT((0,"ScanExportsByAddress(): %S has %u symbols\n",pSymbols->name,pSymbols->ulSizeOfGlobals/sizeof(IMAGE_SYMBOL))); + + /* go through all the global symbols and find the one with + the largest address which is less than ulValue */ + while(pSym < pSymEnd) + { //it seems only 0x0 and 0x20 are used for type and External or Static storage classes + if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) && + ((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) || (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)) && + (pSym->SectionNumber > 0 )) + { + ULONG ulCurrAddr; + PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1); + + + DPRINT((0,"ScanExportsByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis)); + + if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) ) + { + DPRINT((0,"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis)); + return FALSE; + } + //to get address in the memory we base address of the module and + //add offset of the section and then add offset of the symbol from + //the begining of the section + ulCurrAddr = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value); + DPRINT((0,"ScanExportsByAddress(): CurrAddr [1] = %x\n",ulCurrAddr)); + + if(ulCurrAddr<=ulValue && ulCurrAddr>ulAddr) + { + ulAddr = ulCurrAddr; + pFoundSym = pSym; + } + } + //skip the auxiliary symbols and get the next symbol + pSym += pSym->NumberOfAuxSymbols + 1; + } + *pFind = temp3; + if( pFoundSym->N.Name.Short ){ + pName = pFoundSym->N.ShortName; //name is in the header + PICE_sprintf(temp3,"%S!%.8s",pdTemp->name,pName); //if name is in the header it may be nonzero terminated + } + else{ + ASSERT(pFoundSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check + pName = pStr+pFoundSym->N.Name.Long; + if(!IsAddressValid((ULONG)pName)) + { + DPRINT((0,"ScanExportsByAddress(): pName = %x is not a valid pointer\n",pName)); + return FALSE; + } + PICE_sprintf(temp3,"%S!%s",pdTemp->name,pName); + } + DPRINT((0,"ScanExportsByAddress(): pName = %x\n",(ULONG)pName)); + return TRUE; + } + } + } + }while((pd = pd->next)); + } + } + // if haven't found in the symbols try ntoskrnl exports. (note: check that this is needed since we + // already checked ntoskrnl coff symbol table) + if(pExports && ulValue >= KERNEL_START && ulValue < kernel_end) + { + p = pExports; + // while we bound in System.map + while(p<((LPSTR)pExports+ulExportLen)) + { + // make a temp ptr to the line we can change + pStartOfLine = p; + // will read the hex value and return a pointer to the symbol name + if(ScanExportLine(p,&ulCurrentValue,&pStartOfLine)) + { + if(ulValue>=ulCurrentValue && (ulValue-ulCurrentValue)name,(ULONG)pSymbols)); + if(pSymbols && pdebug_module_head) + { + DPRINT((0,"looking up symbol\n")); + pd = pdebug_module_head; + do + { + ASSERT(pd->size); + pdTemp = pd; + + //initial values for start and end. + start = (ULONG)pdTemp->BaseAddress; + end = start+pdTemp->size; + + DPRINT((0,"FindFunctionByAddress(): ulValue %x\n",ulValue)); + + if(ulValue>=start && ulValuename)); + if(PICE_wcsicmp(pdTemp->name,pSymbols->name) == 0) + { + DPRINT((0,"found symbols for module %S\n",pdTemp->name)); + pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals); + pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals); + pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings); + pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders); + + if(!IsRangeValid((ULONG)pSym,sizeof(IMAGE_SYMBOL) ) ) //should we actually check all the symbols here? + { + DPRINT((0,"FindFunctionByAddress(): pSym = %x is not a valid pointer\n",(ULONG)pSym)); + return FALSE; + } + DPRINT((0,"pSym = %x\n",pSym)); + DPRINT((0,"pStr = %x\n",pStr)); + DPRINT((0,"pShdr = %x\n",pShdr)); + + while( pSym < pSymEnd ) + { + //symbol is a function is it's type is 0x20, and section>0 + if(( (pSym->Type == 0x20) && + (pSym->SectionNumber > 0 ))) + { + ULONG ulCurrAddr; + PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1); + + DPRINT((0,"FindFunctionByAddress(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis)); + + if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) ) + { + DPRINT((0,"ScanExportsByAddress(): pElfShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis)); + return FALSE; + } + //to get address in the memory we base address of the module and + //add offset of the section and then add offset of the symbol from + //the begining of the section + ulCurrAddr = ((ULONG)pdTemp->BaseAddress+pShdrThis->VirtualAddress+pSym->Value); + DPRINT((0,"FindFunctionByAddress(): CurrAddr [1] = %x\n",ulCurrAddr)); + DPRINT((0,"%x ", ulCurrAddr)); + + if(ulCurrAddr<=ulValue && ulCurrAddr>start) + { + start = ulCurrAddr; + pFoundSym = pSym; + //DPRINT((0,"FindFunctionByAddress(): CANDIDATE for start %x\n",start)); + } + else if(ulCurrAddr>=ulValue && ulCurrAddrNumberOfAuxSymbols + 1; + } + //we went through all the symbols for this module + //now start should point to the start of the function and + //end to the start of the next (or end of section) + if(pulstart) + *pulstart = start; + + if(pulend){ + //just in case there is more than one code section + PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pFoundSym->SectionNumber-1); + if( end > (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData ){ + DPRINT((0,"Hmm: end=%d, end of section: %d\n", end, (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData)); + end = (ULONG)pdTemp->BaseAddress+pShdrThis->SizeOfRawData; + } + *pulend = end; + } + + if(pFoundSym->N.Name.Short){ + //name is in the header. it's not zero terminated. have to copy. + PICE_sprintf(temp4,"%.8s", pFoundSym->N.ShortName); + pName = temp4; + DPRINT((0,"Function name: %S!%.8s",pdTemp->name,pName)); + } + else{ + ASSERT(pFoundSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check + pName = pStr+pFoundSym->N.Name.Long; + if(!IsAddressValid((ULONG)pName)) + { + DPRINT((0,"FindFunctionByAddress(): pName = %x is not a valid pointer\n",pName)); + return NULL; + } + DPRINT((0,"Function name: %S!%s",pdTemp->name,pName)); + } + return pName; + } + } + }while((pd = pd->next) != pdebug_module_tail); + } + return NULL; +} + +//************************************************************************* +// FindDataSectionOffset() +// +//************************************************************************* +/* ei: never used +ULONG FindDataSectionOffset(Elf32_Shdr* pSHdr) +{ + + DPRINT((0,"FindDataSectionOffset()\n")); + + while(1) + { + DPRINT((0,"FindDataSectionOffset(): sh_offset %.8X sh_addr = %.8X\n",pSHdr->sh_offset,pSHdr->sh_addr)); + if((pSHdr->sh_flags & (SHF_WRITE|SHF_ALLOC) ) == (SHF_WRITE|SHF_ALLOC)) + { + + return pSHdr->sh_offset; + } + pSHdr++; + } + + return 0; +} +*/ + +//************************************************************************* +// FindFunctionInModuleByNameViaKsyms() +// +//************************************************************************* +/* ei: not needed. no Ksyms! +ULONG FindFunctionInModuleByNameViaKsyms(struct module* pMod,LPSTR szFunctionname) +{ + ULONG i; + + ENTER_FUNC(); + + if(pMod->nsyms) + { + DPRINT((0,"FindFunctionInModuleByNameViaKsyms(): %u symbols for module %s\n",pMod->nsyms,pMod->name)); + for(i=0;insyms;i++) + { + DPRINT((0,"FindFunctionInModuleByNameViaKsyms(): %s\n",pMod->syms[i].name)); + if(PICE_strcmpi((LPSTR)pMod->syms[i].name,szFunctionname) == 0) + { + DPRINT((0,"FindFunctionInModuleByName(): symbol was in exports\n")); + LEAVE_FUNC(); + return pMod->syms[i].value; + } + } + } + + DPRINT((0,"FindFunctionInModuleByName(): symbol wasn't in exports\n")); + LEAVE_FUNC(); + return 0; +} +*/ + +//************************************************************************* +// FindFunctionInModuleByName() +// +//************************************************************************* +ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pd) +{ + ULONG i,addr; + PICE_SYMBOLFILE_HEADER* pSymbols=NULL; + PIMAGE_SYMBOL pSym, pSymEnd; + LPSTR pStr; + PIMAGE_SECTION_HEADER pShdr; + + ENTER_FUNC(); + DPRINT((0,"FindFunctionInModuleByName(%s)\n",szFunctionname)); + DPRINT((0,"FindFunctionInModuleByName(): mod size = %x\n",pd->size)); + DPRINT((0,"FindFunctionInModuleByName(): module is %S\n",pd->name)); + + addr = (ULONG)pd->BaseAddress; + + pSymbols = FindModuleSymbols(addr); + if(pSymbols) + { + DPRINT((0,"FindFunctionInModuleByName(): found symbol table for %S\n",pSymbols->name)); + pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals); + pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals); + pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings); + pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders); + + while( pSym < pSymEnd ) + { + //symbol is a function is it's type is 0x20, storage class is external and section>0 + //if(( (pSym->Type == 0x20) && (pSym->StorageClass==IMAGE_SYM_CLASS_EXTERNAL) && + // (pSym->SectionNumber > 0 ))) + + if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) && + ((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) || (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)) && + (pSym->SectionNumber > 0 )) + + { + ULONG start; + LPSTR pName; + PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1); + + start = ((ULONG)pd->BaseAddress+pShdrThis->VirtualAddress+pSym->Value); + DPRINT((0,"FindFunctionInModuleByName(): %s @ %x\n",szFunctionname,start)); + + if(pSym->N.Name.Short){ //if name is stored in the structure + //name may be not zero terminated but 8 characters max + DPRINT((0,"FindFunctionInModuleByName: %.8s\n", pSym->N.ShortName)); + pName = pSym->N.ShortName; //name is in the header + if((PICE_fnncmp(pName,szFunctionname, 8) == 0) && start) + { + DPRINT((0,"FindFunctionInModuleByName(): symbol was in symbol table, start: %x\n", start)); + LEAVE_FUNC(); + return start; + } + }else{ + pName = pStr+pSym->N.Name.Long; + DPRINT((0,"FindFunctionInModuleByName: %s\n", pName)); + if((PICE_fncmp(pName,szFunctionname) == 0) && start) + { + DPRINT((0,"FindFunctionInModuleByName(): symbol was in string table, start: %x\n", start)); + LEAVE_FUNC(); + return start; + } + } + } + //skip the auxiliary symbols and get the next symbol + pSym += pSym->NumberOfAuxSymbols + 1; + } + } + LEAVE_FUNC(); + return 0; +} + +//************************************************************************* +// ExtractTypeNumber() +// +//************************************************************************* +ULONG ExtractTypeNumber(LPSTR p) +{ + LPSTR pTypeNumber; + ULONG ulTypeNumber = 0; + + DPRINT((0,"ExtractTypeNumber(%s)\n",p)); + + pTypeNumber = PICE_strchr(p,'('); + + if(pTypeNumber) + { + pTypeNumber++; + ulTypeNumber = ExtractNumber(pTypeNumber); + ulTypeNumber <<= 16; + pTypeNumber = PICE_strchr(p,','); + if(pTypeNumber) + { + pTypeNumber++; + ulTypeNumber += ExtractNumber(pTypeNumber); + } + else + { + ulTypeNumber = 0; + } + } + return ulTypeNumber; +} + +//************************************************************************* +// FindTypeDefinitionForCombinedTypes() +// +//************************************************************************* +LPSTR FindTypeDefinitionForCombinedTypes(PICE_SYMBOLFILE_HEADER* pSymbols,ULONG ulTypeNumber,ULONG ulFileNumber) +{ + ULONG i; + PSTAB_ENTRY pStab; + LPSTR pStr,pName,pTypeNumber,pTypeDefIncluded,pNameTemp; + int nStabLen; + int nOffset=0,nNextOffset=0,nLen; + static char szAccumulatedName[2048]; + ULONG ulCurrentTypeNumber,ulCurrentFileNumber=0; + static char szCurrentPath[256]; + + ENTER_FUNC(); + + *szAccumulatedName = 0; + + pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs); + nStabLen = pSymbols->ulSizeOfStabs; + pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings); + + DPRINT((0,"FindTypeDefinitionForCombinedTypes()\n")); + + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + pName = &pStr[pStab->n_strx + nOffset]; + + switch(pStab->n_type) + { + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStab->n_value; + break; + case N_SO: + if((nLen = PICE_strlen(pName))) + { + if(pName[nLen-1]!='/') + { + ulCurrentFileNumber++; + if(PICE_strlen(szCurrentPath)) + { + PICE_strcat(szCurrentPath,pName); + DPRINT((0,"FindTypeDefinitionForCombinedTypes(): changing source file %s\n",szCurrentPath)); + } + else + { + DPRINT((0,"FindTypeDefinitionForCombinedTypes(): changing source file %s\n",pName)); + } + } + else + PICE_strcpy(szCurrentPath,pName); + } + else + { + szCurrentPath[0]=0; + } + break; + case N_GSYM: + //ei File number count is not reliable + if( 1 /*ulCurrentFileNumber == ulFileNumber*/) + { + DPRINT((0,"FindTypeDefinitionForCombinedTypes(): %s\n",pName)); + + // handle multi-line symbols + if(PICE_strchr(pName,'\\')) + { + if(PICE_strlen(szAccumulatedName)) + { + PICE_strcat(szAccumulatedName,pName); + } + else + { + PICE_strcpy(szAccumulatedName,pName); + } + szAccumulatedName[PICE_strlen(szAccumulatedName)-1]=0; + //DPRINT((0,"accum. %s\n",szAccumulatedName)); + } + else + { + if(PICE_strlen(szAccumulatedName)==0) + { + PICE_strcpy(szAccumulatedName,pName); + } + else + { + PICE_strcat(szAccumulatedName,pName); + } + pNameTemp = szAccumulatedName; + + // symbol-name:type-identifier type-number = + nLen = StrLenUpToWhiteChar(pNameTemp,":"); + if((pTypeDefIncluded = PICE_strchr(pNameTemp,'=')) && pNameTemp[nLen+1]=='G') + { + DPRINT((0,"FindTypeDefinitionForCombinedTypes(): symbol includes type definition (%s)\n",pNameTemp)); + pTypeNumber = pNameTemp+nLen+1; + if((ulCurrentTypeNumber = ExtractTypeNumber(pTypeNumber)) ) + { + DPRINT((0,"FindTypeDefinitionForCombinedTypes(): type-number %x\n",ulCurrentTypeNumber)); + if(ulCurrentTypeNumber == ulTypeNumber) + { + DPRINT((0,"FindTypeDefinitionForCombinedTypes(): typenumber %x matches!\n",ulCurrentTypeNumber)); + return pNameTemp; + } + } + } + *szAccumulatedName = 0; + } + } + break; + } + pStab++; + } + return NULL; +} + +//************************************************************************* +// FindTypeDefinition() +// +//************************************************************************* +LPSTR FindTypeDefinition(PICE_SYMBOLFILE_HEADER* pSymbols,ULONG ulTypeNumber,ULONG ulFileNumber) +{ + ULONG i; + PSTAB_ENTRY pStab; + LPSTR pStr,pName,pTypeString; + int nStabLen; + int nOffset=0,nNextOffset=0,strLen; + static char szAccumulatedName[2048]; + ULONG ulCurrentTypeNumber,ulCurrentFileNumber=0; + LPSTR pTypeSymbol; + static char szCurrentPath[256]; + + ENTER_FUNC(); + DPRINT((0,"FindTypeDefinition(%u,%u)\n",ulTypeNumber,ulFileNumber)); + + *szAccumulatedName = 0; + + pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs); + nStabLen = pSymbols->ulSizeOfStabs; + pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings); + + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + pName = &pStr[pStab->n_strx + nOffset]; + + switch(pStab->n_type) + { + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStab->n_value; + break; + case N_SO: + if((strLen = PICE_strlen(pName))) + { + if(pName[strLen-1]!='/') + { + ulCurrentFileNumber++; + if(PICE_strlen(szCurrentPath)) + { + PICE_strcat(szCurrentPath,pName); + DPRINT((0,"FindTypeDefinition()1: cha %s, %u\n",szCurrentPath, ulCurrentFileNumber)); + } + else + { + DPRINT((0,"FindTypeDefinition(): cha %s, %u\n",pName, ulCurrentFileNumber)); + } + } + else + PICE_strcpy(szCurrentPath,pName); + } + else + { + szCurrentPath[0]=0; + } + break; + case N_LSYM: + // stab has no value -> must be type definition + //ei File number count is not reliable + if(pStab->n_value == 0 /*&& ulCurrentFileNumber==ulFileNumber*/) + { + DPRINT((0,"FindTypeDefinition(): pre type definition %s\n",pName)); + // handle multi-line symbols + if(strrchr(pName,'\\')) + { + if(PICE_strlen(szAccumulatedName)) + { + PICE_strcat(szAccumulatedName,pName); + DPRINT((0,"FindTypeDefinition(): [1] accum. %s\n",szAccumulatedName)); + } + else + { + PICE_strcpy(szAccumulatedName,pName); + DPRINT((0,"FindTypeDefinition(): [2] accum. %s\n",szAccumulatedName)); + } + szAccumulatedName[PICE_strlen(szAccumulatedName)-1]=0; + } + else + { + DPRINT((0,"FindTypeDefinition(): [3] accum. %s, pname: %s\n",szAccumulatedName, pName)); + if(PICE_strlen(szAccumulatedName)==0) + { + PICE_strcpy(szAccumulatedName,pName); + } + else + { + PICE_strcat(szAccumulatedName,pName); + } + pTypeString = szAccumulatedName; + + pTypeSymbol = PICE_strchr(pTypeString,':'); + if(pTypeSymbol && (*(pTypeSymbol+1)=='t' || *(pTypeSymbol+1)=='T')) + { + // parse it + ulCurrentTypeNumber = ExtractTypeNumber(pTypeString); + DPRINT((0,"FindTypeDefinition(): ulCurrType: %u, LSYM is type %s\n",ulCurrentTypeNumber,pName)); + if(ulCurrentTypeNumber == ulTypeNumber) + { + DPRINT((0,"FindTypeDefinition(): type definition %s\n",pTypeString)); + return pTypeString; + } + } + *szAccumulatedName=0; + } + } + break; + } + pStab++; + } + + return FindTypeDefinitionForCombinedTypes(pSymbols,ulTypeNumber,ulFileNumber); + +} + +//************************************************************************* +// TruncateString() +// +//************************************************************************* +LPSTR TruncateString(LPSTR p,char c) +{ + static char temp[1024]; + LPSTR pTemp; + + pTemp = temp; + + while(*p!=0 && *p!=c) + *pTemp++ = *p++; + + *pTemp = 0; + + return temp; +} + +//************************************************************************* +// FindLocalsByAddress() +// +// find all locals for a given address by first looking up the function +// and then it's locals +//************************************************************************* +PLOCAL_VARIABLE FindLocalsByAddress(ULONG addr) +{ + ULONG i; + PSTAB_ENTRY pStab; + LPSTR pStr,pName; + int nStabLen; + int nOffset=0,nNextOffset=0; + PICE_SYMBOLFILE_HEADER* pSymbols; + static char szCurrentFunction[256]; + static char szCurrentPath[256]; + LPSTR pFunctionName; + ULONG start,end,strLen; + ULONG ulTypeNumber,ulCurrentFileNumber=0; + LPSTR pTypedef; + ULONG ulNumLocalVars=0; + + DPRINT((0,"FindLocalsByAddress()\n")); + + pFunctionName = FindFunctionByAddress(addr,&start,&end); + DPRINT((0,"FindLocalsByAddress(): pFunctionName = %s\n",pFunctionName)); + if(pFunctionName) + { + pSymbols = FindModuleSymbols(addr); + if(pSymbols) + { + pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs); + nStabLen = pSymbols->ulSizeOfStabs; + pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings); + + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + pName = &pStr[pStab->n_strx + nOffset]; + + DPRINT((0,"FindLocalsByAddress(): %x %x %x %x %x\n", + pStab->n_strx, + pStab->n_type, + pStab->n_other, + pStab->n_desc, + pStab->n_value)); + + switch(pStab->n_type) + { + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStab->n_value; + break; + case N_SO: + if((strLen = PICE_strlen(pName))) + { + if(pName[strLen-1]!='/') + { + ulCurrentFileNumber++; + if(PICE_strlen(szCurrentPath)) + { + PICE_strcat(szCurrentPath,pName); + DPRINT((0,"changing source file1 %s, %u\n",szCurrentPath,ulCurrentFileNumber)); + } + else + { + DPRINT((0,"changing source file %s, %u\n",pName,ulCurrentFileNumber)); + } + } + else + PICE_strcpy(szCurrentPath,pName); + } + else + { + szCurrentPath[0]=0; + } + break; + case N_LSYM: + // if we're in the function we're looking for + if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0) + { + DPRINT((0,"local variable1 %.8X %.8X %.8X %.8X %.8X %s\n",pStab->n_strx,pStab->n_type,pStab->n_other,pStab->n_desc,pStab->n_value,pName)); + ulTypeNumber = ExtractTypeNumber(pName); + DPRINT((0,"type number = %u\n",ulTypeNumber)); + if((pTypedef = FindTypeDefinition(pSymbols,ulTypeNumber,ulCurrentFileNumber))) + { + DPRINT((0,"pTypedef: %x\n", pTypedef)); + PICE_strcpy(local_vars[ulNumLocalVars].type_name,TruncateString(pTypedef,':')); + PICE_strcpy(local_vars[ulNumLocalVars].name,TruncateString(pName,':')); + local_vars[ulNumLocalVars].value = (CurrentEBP+pStab->n_value); + local_vars[ulNumLocalVars].offset = pStab->n_value; + local_vars[ulNumLocalVars].line = pStab->n_desc; + local_vars[ulNumLocalVars].bRegister = FALSE; + ulNumLocalVars++; + } + } + break; + case N_PSYM: + // if we're in the function we're looking for + if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0) + { + DPRINT((0,"parameter variable %.8X %.8X %.8X %.8X %.8X %s\n",pStab->n_strx,pStab->n_type,pStab->n_other,pStab->n_desc,pStab->n_value,pName)); + ulTypeNumber = ExtractTypeNumber(pName); + DPRINT((0,"type number = %x\n",ulTypeNumber)); + if((pTypedef = FindTypeDefinition(pSymbols,ulTypeNumber,ulCurrentFileNumber))) + { + PICE_strcpy(local_vars[ulNumLocalVars].type_name,TruncateString(pTypedef,':')); + PICE_strcpy(local_vars[ulNumLocalVars].name,TruncateString(pName,':')); + local_vars[ulNumLocalVars].value = (CurrentEBP+pStab->n_value); + local_vars[ulNumLocalVars].offset = pStab->n_value; + ulNumLocalVars++; + } + } + break; + case N_RSYM: + // if we're in the function we're looking for + if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0) + { + DPRINT((0,"local variable2 %.8X %.8X %.8X %.8X %.8X %s\n",pStab->n_strx,pStab->n_type,pStab->n_other,pStab->n_desc,pStab->n_value,pName)); + ulTypeNumber = ExtractTypeNumber(pName); + DPRINT((0,"type number = %x\n",ulTypeNumber)); + if((pTypedef = FindTypeDefinition(pSymbols,ulTypeNumber,ulCurrentFileNumber))) + { + PICE_strcpy(local_vars[ulNumLocalVars].type_name,TruncateString(pTypedef,':')); + PICE_strcpy(local_vars[ulNumLocalVars].name,TruncateString(pName,':')); + local_vars[ulNumLocalVars].value = (LocalRegs[pStab->n_value]); + local_vars[ulNumLocalVars].offset = pStab->n_value; + local_vars[ulNumLocalVars].line = pStab->n_desc; + local_vars[ulNumLocalVars].bRegister = TRUE; + ulNumLocalVars++; + } + } + break; + case N_FUN: + if(PICE_strlen(pName)) + { + ULONG len; + + len=StrLenUpToWhiteChar(pName,":"); + PICE_strncpy(szCurrentFunction,pName,len); + szCurrentFunction[len]=0; + DPRINT((0,"function %s\n",szCurrentFunction)); + } + else + { + DPRINT((0,"END of function %s\n",szCurrentFunction)); + szCurrentFunction[0]=0; + if(ulNumLocalVars) + { + *local_vars[ulNumLocalVars].name = 0; + return local_vars; + } + } + break; + } + pStab++; + } + } + } + return NULL; +} + +//************************************************************************* +// FindSourceLineForAddress() +// +//************************************************************************* +LPSTR FindSourceLineForAddress(ULONG addr,PULONG pulLineNumber,LPSTR* ppSrcStart,LPSTR* ppSrcEnd,LPSTR* ppFilename) +{ + ULONG i; // index for walking through STABS + PSTAB_ENTRY pStab; // pointer to STABS + LPSTR pStr,pName; // pointer to STAB strings and current STAB string + int nStabLen; // length of STAB section in bytes + int nOffset=0,nNextOffset=0; // offset and next offset in string table + PICE_SYMBOLFILE_HEADER* pSymbols; // pointer to module's STAB symbol table + static char szCurrentFunction[256]; + static char szCurrentPath[256]; + static char szWantedPath[256]; + LPSTR pFunctionName; // name of function that brackets the current address + ULONG start,end,strLen,ulMinValue=0xFFFFFFFF; + LPSTR pSrcLine=NULL; + BOOLEAN bFirstOccurence = TRUE; + + // lookup the functions name and start-end (external symbols) + pFunctionName = FindFunctionByAddress(addr,&start,&end); + DPRINT((0,"FindSourceLineForAddress: for function: %s\n", pFunctionName)); + + if(pFunctionName) + { + // lookup the modules symbol table (STABS) + pSymbols = FindModuleSymbols(addr); + DPRINT((0,"FindSourceLineForAddress: pSymbols %x\n", pSymbols)); + if(pSymbols) + { + DPRINT((0,"FindSourceLineForAddress: pSymbols->ulNumberOfSrcFiles %x\n", pSymbols->ulNumberOfSrcFiles)); + // no source files so we don't need to lookup anything + if(!pSymbols->ulNumberOfSrcFiles) + return NULL; + + // prepare STABS access + pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs); + nStabLen = pSymbols->ulSizeOfStabs; + pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings); + + // walk over all STABS + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + // the name string corresponding to the STAB + pName = &pStr[pStab->n_strx + nOffset]; + + // switch STAB type + switch(pStab->n_type) + { + // change offset of name strings + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStab->n_value; + break; + // source file change + case N_SO: + DPRINT((0,"changing source file %s\n",pName)); + // if filename has a length record it + if((strLen = PICE_strlen(pName))) + { + PICE_strcpy(szCurrentPath,pName); + } + // else empty filename + else + { + szCurrentPath[0]=0; + } + break; + // sub-source file change + case N_SOL: + DPRINT((0,"changing sub source file %s\n",pName)); + // if filename has a length record it + if((strLen = PICE_strlen(pName))) + { + PICE_strcpy(szCurrentPath,pName); + } + // else empty filename + else + { + szCurrentPath[0]=0; + } + break; + // a function symbol + case N_FUN: + if(!PICE_strlen(pName)) + {// it's the end of a function + DPRINT((0,"END of function %s\n",szCurrentFunction)); + + szCurrentFunction[0]=0; + + // in case we haven't had a zero delta match we return from here + if(pSrcLine) + return pSrcLine; + + break; + } + else + {// if it has a length it's the start of a function + ULONG len; + // extract the name only, the type string is of no use here + len=StrLenUpToWhiteChar(pName,":"); + PICE_strncpy(szCurrentFunction,pName,len); + szCurrentFunction[len]=0; + + DPRINT((0,"function %s\n",szCurrentFunction)); + } + //intentional fall through + + // line number + case N_SLINE: + // if we're in the function we're looking for + if(szCurrentFunction[0] && PICE_fncmp(szCurrentFunction,pFunctionName)==0) + { + DPRINT((0,"cslnum#%u for addr.%x (fn @ %x) ulMinVal=%x ulDelta=%x\n",pStab->n_desc,start+pStab->n_value,start,ulMinValue,(addr-(start+pStab->n_value)))); + + if(bFirstOccurence) + { + PICE_strcpy(szWantedPath,szCurrentPath); + DPRINT((0,"source file must be %s\n",szWantedPath)); + bFirstOccurence = FALSE; + } + DPRINT((0,"wanted %s, current: %s\n",szWantedPath, szCurrentPath)); + // we might have a match if our address is greater than the one in the STAB + // and we're lower or equal than minimum value + if(addr>=start+pStab->n_value && + (addr-(start+pStab->n_value))<=ulMinValue && + PICE_strcmpi(szWantedPath,szCurrentPath)==0 ) + { + ULONG j; + PICE_SYMBOLFILE_SOURCE* pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pSymbols+pSymbols->ulOffsetToSrcFiles); + + DPRINT((0,"code source line number #%u for addr. %x found!\n",pStab->n_desc,start+pStab->n_value)); + + // compute new minimum + ulMinValue = addr-(start+pStab->n_value); + + // if we have a pointer for storage of line number, store it + if(pulLineNumber) + *pulLineNumber = pStab->n_desc; + + // NB: should put this somewhere else so that it's not done all the time + // if we have source files at all + DPRINT((0,"%u source files @ %x\n",pSymbols->ulNumberOfSrcFiles,pSrc)); + + // for all source files in this module + for(j=0;julNumberOfSrcFiles;j++) + { + LPSTR pSlash; + ULONG currlen, fnamelen; + + currlen = PICE_strlen( szCurrentPath ); + fnamelen = PICE_strlen( pSrc->filename ); + pSlash = pSrc->filename + fnamelen - currlen; + + //DPRINT((0,"pSlash: %s, szCurrentPath: %s\n", pSlash, szCurrentPath)); + // if base name matches current path we have found the correct source file + if(PICE_strcmpi(pSlash,szCurrentPath)==0) + { + // the linenumber + ULONG k = pStab->n_desc; + + DPRINT((0,"found src file %s @ %x\n",pSrc->filename,pSrc)); + + // store the pointer to the filename + if(ppFilename) + *ppFilename = pSrc->filename; + + if(pSrc->ulOffsetToNext > sizeof(PICE_SYMBOLFILE_SOURCE)) + { + // get a pointer to the source file (right after the file header) + pSrcLine = (LPSTR)((ULONG)pSrc+sizeof(PICE_SYMBOLFILE_SOURCE)); + + // store the source start and end address + if(ppSrcStart) + *ppSrcStart = pSrcLine; + if(ppSrcEnd) + *ppSrcEnd = pSrcLine+pSrc->ulOffsetToNext-sizeof(PICE_SYMBOLFILE_SOURCE); + + // goto to the right line + while(--k) + { + while(*pSrcLine!=0 && *pSrcLine!=0x0a && *pSrcLine!=0x0d) + pSrcLine++; + if(!IsAddressValid((ULONG)pSrcLine)) + return NULL; + pSrcLine++; + } + + if(ulMinValue == 0) + return pSrcLine; + } + else + { + DPRINT((0,"src file descriptor found, but contains no source\n")); + } + + break; + } + (ULONG)pSrc += pSrc->ulOffsetToNext; + } + } + } + break; + } + pStab++; + } + } + } + DPRINT((0,"FindSourceLineForAddress: exit 1\n")); + return NULL; +} + +//************************************************************************* +// FindAddressForSourceLine() +// +//************************************************************************* +BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename,PDEBUG_MODULE pMod,PULONG pValue) +{ + ULONG i; + PSTAB_ENTRY pStab; + LPSTR pStr,pName; + int nStabLen; + int nOffset=0,nNextOffset=0; + PICE_SYMBOLFILE_HEADER* pSymbols; + static char szCurrentFunction[256]; + static char szCurrentPath[256]; + ULONG strLen,addr,ulMinValue=0xFFFFFFFF; + BOOLEAN bFound = FALSE; + + DPRINT((0,"FindAddressForSourceLine(%u,%s,%x)\n",ulLineNumber,pFilename,(ULONG)pMod)); + + addr = (ULONG)pMod->BaseAddress; + + pSymbols = FindModuleSymbols(addr); + if(pSymbols) + { + pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs); + nStabLen = pSymbols->ulSizeOfStabs; + pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings); + + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + pName = &pStr[pStab->n_strx + nOffset]; + + switch(pStab->n_type) + { + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStab->n_value; + break; + case N_SO: + if((strLen = PICE_strlen(pName))) + { + if(pName[strLen-1]!='/') + { + if(PICE_strlen(szCurrentPath)) + { + PICE_strcat(szCurrentPath,pName); + DPRINT((0,"changing source file %s\n",szCurrentPath)); + } + else + { + DPRINT((0,"changing source file %s\n",pName)); + PICE_strcpy(szCurrentPath,pName); + } + } + else + PICE_strcpy(szCurrentPath,pName); + } + else + { + szCurrentPath[0]=0; + } + break; + case N_SLINE: + // if we're in the function we're looking for + if(PICE_strcmpi(pFilename,szCurrentPath)==0) + { + if(pStab->n_desc>=ulLineNumber && (pStab->n_desc-ulLineNumber)<=ulMinValue) + { + ulMinValue = pStab->n_desc-ulLineNumber; + + DPRINT((0,"code source line number #%u for offset %x in function @ %s)\n",pStab->n_desc,pStab->n_value,szCurrentFunction)); + addr = FindFunctionInModuleByName(szCurrentFunction,pMod); + if(addr) + { + *pValue = addr + pStab->n_value; + bFound = TRUE; + } + } + } + break; + case N_FUN: + if(PICE_strlen(pName)) + { + ULONG len; + + len=StrLenUpToWhiteChar(pName,":"); + PICE_strncpy(szCurrentFunction,pName,len); + szCurrentFunction[len]=0; + DPRINT((0,"function %s\n",szCurrentFunction)); + } + else + { + DPRINT((0,"END of function %s\n",szCurrentFunction)); + szCurrentFunction[0]=0; + } + break; + } + pStab++; + } + } + return bFound; +} + +//************************************************************************* +// ListSymbolStartingAt() +// iterate through the list of module symbols (both functions and variables) +//************************************************************************* +ULONG ListSymbolStartingAt(PDEBUG_MODULE pMod,PICE_SYMBOLFILE_HEADER* pSymbols,ULONG index,LPSTR pOutput) +{ + PIMAGE_SYMBOL pSym, pSymEnd; + LPSTR pStr; + PIMAGE_SECTION_HEADER pShdr; + + DPRINT((0,"ListSymbolStartingAt(%x,%u)\n",(ULONG)pSymbols,index)); + DPRINT((0,"ListSymbolStartingAt(): ulOffsetToGlobals = %x ulSizeofGlobals = %x\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals)); + pSym = (PIMAGE_SYMBOL)((ULONG)pSymbols+pSymbols->ulOffsetToGlobals); + pSymEnd = (PIMAGE_SYMBOL)((ULONG)pSym+pSymbols->ulSizeOfGlobals); + pStr = (LPSTR)((ULONG)pSymbols+pSymbols->ulOffsetToGlobalsStrings); + pShdr = (PIMAGE_SECTION_HEADER)((ULONG)pSymbols+pSymbols->ulOffsetToHeaders); + + pSym += index; + + while( pSym < pSymEnd ) + { + LPSTR pName; + + if(((pSym->Type == 0x0) || (pSym->Type == 0x20) ) && + ((pSym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) /*|| (pSym->StorageClass==IMAGE_SYM_CLASS_STATIC)*/) && + (pSym->SectionNumber > 0 )) + { + PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1); + ULONG section_flags; + ULONG start; + + DPRINT((0,"ListSymbolStartingAt(): pShdr[%x] = %x\n",pSym->SectionNumber,(ULONG)pShdrThis)); + + if(!IsRangeValid((ULONG)pShdrThis,sizeof(IMAGE_SECTION_HEADER)) ) + { + DPRINT((0,"ListSymbolStartingAt(): pShdr[%x] = %x is not a valid pointer\n",pSym->SectionNumber,(ULONG)pShdrThis)); + return FALSE; + } + section_flags = pShdrThis->Characteristics; + //to get address in the memory we base address of the module and + //add offset of the section and then add offset of the symbol from + //the begining of the section + + start = ((ULONG)pMod->BaseAddress+pShdrThis->VirtualAddress+pSym->Value); + if(pSym->N.Name.Short){ + //name is in the header. it's not zero terminated. have to copy. + PICE_sprintf(pOutput,"%.8X (%s) %.8s\n",start,(section_flags&IMAGE_SCN_CNT_CODE)?"TEXT":"DATA",pSym->N.ShortName); + } + else{ + ASSERT(pSym->N.Name.Long<=pSymbols->ulSizeOfGlobalsStrings); //sanity check + pName = pStr+pSym->N.Name.Long; + if(!IsAddressValid((ULONG)pName)) + { + DPRINT((0,"ListSymbolStartingAt(): pName = %x is not a valid pointer\n",pName)); + return 0; + } + PICE_sprintf(pOutput,"%.8X (%s) %s\n",start,(section_flags&IMAGE_SCN_CNT_CODE)?"TEXT":"DATA",pName); + } + + if((pSym+pSym->NumberOfAuxSymbols+1)<(pSymEnd)) + return (index+pSym->NumberOfAuxSymbols+1); + } + index += pSym->NumberOfAuxSymbols + 1; + pSym += pSym->NumberOfAuxSymbols + 1; + } + return 0; +} + +//************************************************************************* +// SanityCheckExports() +// +//************************************************************************* +BOOLEAN SanityCheckExports(void) +{ + BOOLEAN bResult = FALSE; + ULONG i,ulValue,incr; + + Print(OUTPUT_WINDOW,"pICE: sanity-checking exports...\n"); + return TRUE; + /* fix later!!! do we really need to cross reference two kinds of symbolic info? + if(fake_kernel_module.nsyms && fake_kernel_module.syms) + { + incr = (fake_kernel_module.nsyms/4); + if(!incr)incr = 1; + for(i=0;imagic = %X\n",pSymbols->magic)); + } + //set_fs(oldfs); + + + if(pSymbols->magic == PICE_MAGIC) + { + DPRINT((0,"magic = %X\n",pSymbols->magic)); + DPRINT((0,"name = %S\n",pSymbols->name)); + DPRINT((0,"ulOffsetToHeaders,ulSizeOfHeader = %X,%X\n",pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader)); + DPRINT((0,"ulOffsetToGlobals,ulSizeOfGlobals = %X,%X\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals)); + DPRINT((0,"ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings = %X,%X\n",pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings)); + DPRINT((0,"ulOffsetToStabs,ulSizeOfStabs = %X,%X\n",pSymbols->ulOffsetToStabs,pSymbols->ulSizeOfStabs)); + DPRINT((0,"ulOffsetToStabsStrings,ulSizeOfStabsStrings = %X,%X\n",pSymbols->ulOffsetToStabsStrings,pSymbols->ulSizeOfStabsStrings)); + DPRINT((0,"ulOffsetToSrcFiles,ulNumberOfSrcFiles = %X,%X\n",pSymbols->ulOffsetToSrcFiles,pSymbols->ulNumberOfSrcFiles)); + DPRINT((0,"pICE: symbols loaded for module \"%S\" @ %x\n",pSymbols->name,pSymbols)); + apSymbols[ulNumSymbolsLoaded++]=pSymbols; + } + else + { + DPRINT((0,"LoadSymbols(): freeing %x\n",pSymbols)); + DPRINT((0,"pICE: symbols file \"%s\" corrupt\n",filename)); + PICE_free(pSymbols); + } + } + + } + PICE_close(hf); + } + else + { + DPRINT((0,"pICE: could not load symbols for %s...\n",filename)); + } + } + + LEAVE_FUNC(); + + return pSymbols; +} + +//************************************************************************* +// ReloadSymbols() +// +//************************************************************************* +BOOLEAN ReloadSymbols(void) +{ + BOOLEAN bResult; + + ENTER_FUNC(); + + UnloadSymbols(); + + bResult = LoadSymbolsFromConfig(TRUE); + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// UnloadSymbols() +// +//************************************************************************* +void UnloadSymbols() +{ + ULONG i; + + ENTER_FUNC(); + + if(ulNumSymbolsLoaded) + { + for(i=0;i1) + { + if(PICE_strcmpi(temp,"+vga")==0) + { + eTerminalMode = TERMINAL_MODE_VGA_TEXT; + DPRINT((0,"pICE: eTerminalMode = TERMINAL_MODE_VGA_TEXT\n")); + } + else if(PICE_strcmpi(temp,"+hercules")==0) + { + eTerminalMode = TERMINAL_MODE_HERCULES_GRAPHICS; + DPRINT((0,"pICE: eTerminalMode = TERMINAL_MODE_HERCULES_GRAPHICS\n")); + } + else if(PICE_strcmpi(temp,"+serial")==0) + { + eTerminalMode = TERMINAL_MODE_SERIAL; + DPRINT((0,"pICE: eTerminalMode = TERMINAL_MODE_SERIAL\n")); + } + } + else + { + DPRINT((0,"pICE: found option, but no value\n")); + } + } + // comment + else if(*temp == '#') + { + DPRINT((0,"comment out\n")); + } + // symbol file name/path + else + { + DPRINT((0,"Load symbols from file %s\n", temp)); + pSymbols = LoadSymbols(temp); + DPRINT((0,"Load symbols from file %s, pSymbols: %x\n", temp, pSymbols)); + if(pSymbols) + { + PICE_SYMBOLFILE_SOURCE* pSrc; + LPSTR p; + + pSrc = (PICE_SYMBOLFILE_SOURCE*)((ULONG)pSymbols + pSymbols->ulOffsetToSrcFiles); + pCurrentSymbols = pSymbols; + p = strrchr(pSrc->filename,'\\'); + if(p) + { + PICE_strcpy(szCurrentFile,p+1); + } + else + { + PICE_strcpy(szCurrentFile,pSrc->filename); + } + } + } + } + else + { + DPRINT((0,"invalid line [%u] in config!\n",line)); + } + line++; + } + } + else + { + //set_fs(oldfs); + } + } + + PICE_close(hf); + bResult = TRUE; + } + else + { + DPRINT((0,"pICE: config file not found! No symbols loaded.\n")); + DPRINT((0,"pICE: Please make sure to create a file \\systemroot\\symbols\\pice.conf\n")); + DPRINT((0,"pICE: if you want to have symbols for any module loaded.\n")); + } + + LEAVE_FUNC(); + + return bResult; +} + + +//************************************************************************* +// EVALUATION OF EXPRESSIONS +//************************************************************************* + +//************************************************************************* +// SkipSpaces() +// +//************************************************************************* +void SkipSpaces(void) +{ + while(pExpression[ulIndex]==' ') + ulIndex++; +}; + +//************************************************************************* +// FindGlobalStabSymbol() +// +//************************************************************************* +BOOLEAN FindGlobalStabSymbol(LPSTR pExpression,PULONG pValue,PULONG pulTypeNumber,PULONG pulFileNumber) +{ + ULONG i; + PSTAB_ENTRY pStab; + LPSTR pStr,pName; + int nStabLen; + int nOffset=0,nNextOffset=0,nLen,strLen; + PICE_SYMBOLFILE_HEADER* pSymbols; + ULONG ulTypeNumber; + static char SymbolName[1024]; + static char szCurrentPath[256]; + ULONG ulCurrentFileNumber=0; + LPSTR pTypeDefIncluded; + ULONG addr; + + // must have a current module + if(pCurrentMod) + { + // in case we query for the kernel we need to use the fake kernel module + addr = (ULONG)pCurrentMod->BaseAddress; + + // find the symbols for the module + pSymbols = FindModuleSymbols(addr); + if(pSymbols) + { + // prepare table access + pStab = (PSTAB_ENTRY )((ULONG)pSymbols + pSymbols->ulOffsetToStabs); + nStabLen = pSymbols->ulSizeOfStabs; + pStr = (LPSTR)((ULONG)pSymbols + pSymbols->ulOffsetToStabsStrings); + // starting at file 0 + *pulFileNumber = 0; + + // go through stabs + for(i=0;i<(nStabLen/sizeof(STAB_ENTRY));i++) + { + pName = &pStr[pStab->n_strx + nOffset]; + + switch(pStab->n_type) + { + // an N_UNDF symbol marks a change of string table offset + case N_UNDF: + nOffset += nNextOffset; + nNextOffset = pStab->n_value; + break; + // a source file symbol + case N_SO: + if((strLen = PICE_strlen(pName))) + { + if(pName[strLen-1]!='/') + { + ulCurrentFileNumber++; + if(PICE_strlen(szCurrentPath)) + { + PICE_strcat(szCurrentPath,pName); + DPRINT((0,"changing source file %s\n",szCurrentPath)); + } + else + { + DPRINT((0,"changing source file %s\n",pName)); + } + } + else + PICE_strcpy(szCurrentPath,pName); + } + else + { + szCurrentPath[0]=0; + } + break; + case N_GSYM: + case N_LSYM: + case N_PSYM: + // symbol-name:type-identifier type-number = + nLen = StrLenUpToWhiteChar(pName,":"); + PICE_strncpy(SymbolName,pName,nLen); + SymbolName[nLen] = 0; + if(PICE_strcmpi(SymbolName,pExpression)==0) + { + DPRINT((0,"global symbol %s\n",pName)); + // extract type-number from stab + ulTypeNumber = ExtractTypeNumber(pName); + DPRINT((0,"type number = %x, from %s\n",ulTypeNumber, pName)); + *pulTypeNumber = ulTypeNumber; + // look for symbols address in external symbols + if( pStab->n_type == N_LSYM || pStab->n_type == N_PSYM ) + *pValue = CurrentEBP + pStab->n_value; + else *pValue = FindFunctionInModuleByName(SymbolName,pCurrentMod); + + DPRINT((0,"value = %x\n",*pValue)); + *pulFileNumber = ulCurrentFileNumber; + DPRINT((0,"file = %x\n",ulCurrentFileNumber)); + if((pTypeDefIncluded = PICE_strchr(pName,'=')) ) + { + DPRINT((0,"symbol includes type definition (%s)\n",pTypeDefIncluded)); + } + return TRUE; + } + break; + } + pStab++; + } + } + } + return FALSE; +} + +//************************************************************************* +// ExtractToken() +// +//************************************************************************* +void ExtractToken(LPSTR pStringToken) +{ + while(PICE_isalpha(pExpression[ulIndex]) || PICE_isdigit(pExpression[ulIndex]) || pExpression[ulIndex]=='_') + { + *pStringToken++=pExpression[ulIndex++]; + *pStringToken=0; + } +} + +//************************************************************************* +// ExtractTypeName() +// +//************************************************************************* +LPSTR ExtractTypeName(LPSTR p) +{ + static char temp[1024]; + ULONG i; + + DPRINT((1,"ExtractTypeName(%s)\n",p)); + + for(i=0;IsAddressValid((ULONG)p) && *p!=0 && *p!=':';i++,p++) + temp[i] = *p; + + if(!IsAddressValid((ULONG)p) ) + { + DPRINT((1,"hit invalid page %x!\n",(ULONG)p)); + } + + temp[i]=0; + + return temp; +} + +//************************************************************************* +// ExtractNumber() +// +//************************************************************************* +LONG ExtractNumber(LPSTR p) +{ + LONG lMinus = 1,lBase; + ULONG lNumber = 0; + + DPRINT((0,"ExtractNumber(): %s\n",p)); + + if(!IsAddressValid((ULONG)p) ) + { + DPRINT((1,"ExtractNumber(): [1] invalid page %x hit!\n",p)); + return 0; + } + + if(*p == '-') + { + lMinus = -1; + p++; + } + + if(!IsAddressValid((ULONG)p) ) + { + DPRINT((1,"ExtractNumber(): [2] invalid page %x hit!\n",p)); + return 0; + } + + if(*p != '0') // non-octal -> decimal number + lBase = 10; + else + lBase = 8; + + if(!IsAddressValid((ULONG)p) ) + { + DPRINT((1,"ExtractNumber(): [3] invalid page %x hit!\n",p)); + return 0; + } + + while(PICE_isdigit(*p)) + { + lNumber *= lBase; + lNumber += *p-'0'; + p++; + if(!IsAddressValid((ULONG)p) ) + { + DPRINT((1,"ExtractNumber(): [4] invalid page %x hit!\n",p)); + return 0; + } + } + + return (lNumber*lMinus); +} + +//************************************************************************* +// ExtractArray() +// +//************************************************************************* +BOOLEAN ExtractArray(PVRET pvr,LPSTR p) +{ + ULONG index_typenumber,type_number; + ULONG lower_bound,upper_bound; + LPSTR pTypeDef; + + DPRINT((1,"ExtractArray(%s)\n",p)); + + // index-type index-type-number;lower;upper;element-type-number + pvr->bArrayType = TRUE; + p++; + index_typenumber = ExtractTypeNumber(p); + p = PICE_strchr(p,';'); + if(p) + { + p++; + lower_bound = ExtractNumber(p); + p = PICE_strchr(p,';'); + if(p) + { + p++; + + upper_bound = ExtractNumber(p); + p = PICE_strchr(p,';'); + if(p) + { + p++; + + type_number = ExtractTypeNumber(p); + + DPRINT((1,"ExtractArray(): %x %x %x %x\n",index_typenumber,lower_bound,upper_bound,type_number)); + + pTypeDef = FindTypeDefinition(pvr->pSymbols,type_number,pvr->file); + if(pTypeDef) + { + PICE_strcpy(pvr->type_name,ExtractTypeName(pTypeDef)); + pvr->type = type_number; + return TRUE; + } + } + } + } + return FALSE; +} + +//************************************************************************* +// ExtractStructMembers() +// +//************************************************************************* +PVRET ExtractStructMembers(PVRET pvr,LPSTR p) +{ + ULONG len; + static char member_name[128]; + LONG bit_offset,bit_size,type_number,byte_size; + static VRET vr; + LPSTR pTypeDef,pEqual; + + DPRINT((1,"ExtractStructMembers(): %s\n",p)); + + PICE_memset(&vr,0,sizeof(vr)); + + // name:type-number,bit-offset,bit-size + len=StrLenUpToWhiteChar(p,":"); + if(len) + { + // extract member name + PICE_strncpy(member_name,p,len); + member_name[len]=0; + DPRINT((1,"ExtractStructMembers(): member_name = %s\n",member_name)); + + // go to char following ':' + p += (len+1); + if(IsAddressValid((ULONG)p) ) + { + type_number = ExtractTypeNumber(p); + DPRINT((1,"ExtractStructMembers(): type_number = %x\n",type_number)); + + vr.type = type_number; + + pEqual = PICE_strchr(p,')'); + // see if it includes type def + if(pEqual) + { + p = pEqual+1; + if(*p == '=') + { + p++; + if(*p == 'a') + { + DPRINT((1,"ExtractStructMembers(): member is array\n")); + vr.bArrayType = TRUE; + p = PICE_strchr(p,';'); + p = PICE_strchr(p,';'); + p = PICE_strchr(p,';'); + if(p) + p++; + + type_number = ExtractTypeNumber(p); + vr.father_type = type_number; + } + else if(*p == '*') + { + DPRINT((1,"ExtractStructMembers(): member is ptr\n")); + vr.bPtrType = TRUE; + type_number = ExtractTypeNumber(p); + DPRINT((1,"ExtractStructMembers(): type_number = %x\n",type_number)); + vr.father_type = type_number; + } + else if(*p == 'u') + { + DPRINT((1,"ExtractStructMembers(): member is union\n")); + while(*p!=';' && *(p+1)!=';' && *p!=0)p++; + } + } + } + + p = PICE_strchr(p,','); + if(p) + { + p++; + bit_offset = ExtractNumber(p); + DPRINT((1,"ExtractStructMembers(): bit_offset = %x\n",bit_offset)); + p = PICE_strchr(p,','); + if(p) + { + p++; + + bit_size = ExtractNumber(p); + DPRINT((1,"ExtractStructMembers(): bit_size = %x\n",bit_size)); + + vr.address = pvr->value + bit_offset/8; + vr.file = pvr->file; + vr.size = bit_size; + PICE_strcpy(vr.name,member_name); + byte_size = (bit_size+1)/8; + if(!byte_size) + byte_size = 4; + pvr->address = pvr->value; + if(IsRangeValid(vr.address,byte_size)) + { + switch(byte_size) + { + case 1: + vr.value = *(PUCHAR)vr.address; + break; + case 2: + vr.value = *(PUSHORT)vr.address; + break; + case 4: + vr.value = *(PULONG)vr.address; + break; + } + } + + DPRINT((1,"ExtractStructMembers(): member %s type %x bit_offset %x bit_size%x\n",member_name,type_number,bit_offset,bit_size)); + + pTypeDef = FindTypeDefinition(pvr->pSymbols,type_number,pvr->file); + if(pTypeDef) + { + DPRINT((1,"ExtractStructMembers(): pTypedef= %s\n",pTypeDef)); + PICE_strcpy(vr.type_name,ExtractTypeName(pTypeDef)); + pTypeDef = PICE_strchr(pTypeDef,':'); + if(pTypeDef) + { + pTypeDef++; + type_number = ExtractTypeNumber(pTypeDef); + DPRINT((1,"ExtractStructMembers(): type_number = %x\n",type_number)); + vr.father_type = type_number; + } + } + } + } + } + } + + return &vr; +} + +//************************************************************************* +// EvaluateSymbol() +// +//************************************************************************* +BOOLEAN EvaluateSymbol(PVRET pvr,LPSTR pToken) +{ + LPSTR pTypeDef,pTypeName,pTypeBase,pSemiColon,pStructMembers; + BOOLEAN bDone = FALSE; + ULONG ulType,ulBits,ulBytes; + LONG lLowerRange,lUpperRange,lDelta; + static char type_def[2048]; + + DPRINT((1,"EvaluateSymbol(%s)\n",pToken)); + + if(FindGlobalStabSymbol(pToken,&pvr->value,&pvr->type,&pvr->file)) + { + DPRINT((1,"EvaluateSymbol(%s) pvr->value = %x pvr->type = %x\n",pToken,pvr->value,pvr->type)); + while(!bDone) + { + if(!(pTypeDef = FindTypeDefinition(pvr->pSymbols,pvr->type,pvr->file))) + break; + PICE_strcpy(type_def,pTypeDef); + + pTypeDef = type_def; + + pTypeName = ExtractTypeName(pTypeDef); + + DPRINT((1,"%s %s\n",pTypeName,pToken)); + + PICE_strcpy(pvr->type_name,pTypeName); + + pTypeBase = PICE_strchr(pTypeDef,'='); + + if(!pTypeBase) + return FALSE; + + pTypeBase++; + + switch(*pTypeBase) + { + case '(': // type reference + ulType = ExtractTypeNumber(pTypeBase); + DPRINT((1,"%x is a type reference to %x\n",pvr->type,ulType)); + pvr->type = ulType; + break; + case 'r': // subrange + pTypeBase++; + ulType = ExtractTypeNumber(pTypeBase); + DPRINT((1,"%x is sub range of %x\n",pvr->type,ulType)); + if(pvr->type == ulType) + { + DPRINT((1,"%x is a self reference\n",pvr->type)); + pSemiColon = PICE_strchr(pTypeBase,';'); + pSemiColon++; + lLowerRange = ExtractNumber(pSemiColon); + pSemiColon = PICE_strchr(pSemiColon,';'); + pSemiColon++; + lUpperRange = ExtractNumber(pSemiColon); + lDelta = lUpperRange-lLowerRange; + DPRINT((1,"bounds %x-%x range %x\n",lLowerRange,lUpperRange,lDelta)); + ulBits=0; + do + { + ulBits++; + lDelta /= 2; + }while(lDelta); + ulBytes = (ulBits+1)/8; + if(!ulBytes) + ulBytes = 4; + DPRINT((1,"# of bytes = %x\n",ulBytes)); + pvr->address = pvr->value; + if(IsRangeValid(pvr->value,ulBytes)) + { + switch(ulBytes) + { + case 1: + pvr->value = *(PUCHAR)pvr->value; + break; + case 2: + pvr->value = *(PUSHORT)pvr->value; + break; + case 4: + pvr->value = *(PULONG)pvr->value; + break; + } + } + bDone=TRUE; + } + else + pvr->type = ulType; + break; + case 'a': // array type + DPRINT((1,"%x array\n",pvr->type)); + pTypeBase++; + if(!ExtractArray(pvr,pTypeBase)) + { + bDone = TRUE; + pvr->error = 1; + } + break; + case '*': // ptr type + DPRINT((1,"%x is ptr to\n",pvr->type)); + bDone = TRUE; // meanwhile + break; + case 's': // struct type [name:T(#,#)=s#membername1:(#,#),#,#;membername1:(#,#),#,#;;] + // go past 's' + pTypeBase++; + + // extract the the struct size + lLowerRange = ExtractNumber(pTypeBase); + DPRINT((1,"%x struct size = %x\n",pvr->type,lLowerRange)); + + // skip over the digits + while(PICE_isdigit(*pTypeBase)) + pTypeBase++; + + // the structs address is is value + pvr->address = pvr->value; + pvr->bStructType = TRUE; + + // decode the struct members. pStructMembers now points to first member name + pStructMembers = pTypeBase; + + while(pStructMembers && *pStructMembers && *pStructMembers!=';' && ulNumStructMemberstype == vrStructMembers[i].type) + { + PICE_strcpy(pvrThis->type_name,vrStructMembers[i].type_name); + pvrThis->bArrayType = vrStructMembers[i].bArrayType; + pvrThis->bPtrType = vrStructMembers[i].bPtrType; + pvrThis->bStructType = vrStructMembers[i].bStructType; + break; + } + } + } + + DPRINT((1,"EvaluateSymbol(): vr.type_name = %s\n",vrStructMembers[ulNumStructMembers].type_name)); + DPRINT((1,"EvaluateSymbol(): vr.name = %s\n",vrStructMembers[ulNumStructMembers].name)); + DPRINT((1,"EvaluateSymbol(): vr.address = %.8X\n",vrStructMembers[ulNumStructMembers].address)); + DPRINT((1,"EvaluateSymbol(): vr.value = %.8X\n",vrStructMembers[ulNumStructMembers].value)); + DPRINT((1,"EvaluateSymbol(): vr.size = %.8X\n",vrStructMembers[ulNumStructMembers].size)); + DPRINT((1,"EvaluateSymbol(): vr.type = %.8X\n",vrStructMembers[ulNumStructMembers].type)); + + ulNumStructMembers++; + + // skip to next ':' + pStructMembers = PICE_strchr(pStructMembers,';'); + pStructMembers = PICE_strchr(pStructMembers,':'); + if(pStructMembers) + { + DPRINT((1,"EvaluateSymbol(): ptr is now %s\n",pStructMembers)); + // go back to where member name starts + while(*pStructMembers!=';') + pStructMembers--; + // if ';' present, go to next char + if(pStructMembers) + pStructMembers++; + } + } + + bDone = TRUE; // meanwhile + break; + case 'u': // union type + DPRINT((1,"%x union\n",pvr->type)); + bDone = TRUE; // meanwhile + break; + case 'e': // enum type + DPRINT((1,"%x enum\n",pvr->type)); + bDone = TRUE; // meanwhile + break; + default: + DPRINT((1,"DEFAULT %x, base: %c\n",pvr->type, *pTypeBase)); + pvr->address = pvr->value; + if(IsRangeValid(pvr->value,ulBytes)) + { + switch(ulBytes) + { + case 1: + pvr->value = *(PUCHAR)pvr->value; + break; + case 2: + pvr->value = *(PUSHORT)pvr->value; + break; + case 4: + pvr->value = *(PULONG)pvr->value; + break; + } + } + bDone = TRUE; + break; + } + + } + return TRUE; + } + return FALSE; +} + +//************************************************************************* +// Symbol() +// +// Symbol := v +//************************************************************************* +BOOLEAN Symbol(PVRET pvr) +{ + char SymbolToken[128]; + + ExtractToken(SymbolToken); + + DPRINT((1,"SymbolToken = %s\n",SymbolToken)); + + return EvaluateSymbol(pvr,SymbolToken); +} + +//************************************************************************* +// Expression() +// +// Expression := Symbol | Symbol->Symbol +//************************************************************************* +BOOLEAN Expression(PVRET pvr) +{ + if(!Symbol(pvr)) + return FALSE; + + return TRUE; +} + +//************************************************************************* +// Evaluate() +// +//************************************************************************* +void Evaluate(PICE_SYMBOLFILE_HEADER* pSymbols,LPSTR p) +{ + ULONG i; + + PICE_memset(&vr,0,sizeof(vr)); + vr.pSymbols = pSymbols; + + pExpression = p; + ulIndex=0; + ulNumStructMembers=0; + if(Expression(&vr)) + { + DPRINT((1,"\nOK!\n")); + DPRINT((1,"value = %x type = %x\n",vr.value,vr.type)); + if(vr.bStructType) + { + PICE_sprintf(tempSym,"struct %s %s @ %x\n",vr.type_name,p,vr.address); + Print(OUTPUT_WINDOW,tempSym); + for(i=0;i %x (%u)\n", + vrStructMembers[i].address, + vrStructMembers[i].size/8, + vrStructMembers[i].type_name, + vrStructMembers[i].name, + vrStructMembers[i].value, + vrStructMembers[i].value); + } + else + { + PICE_sprintf(tempSym,"[%.8X %.8X] %s %s = %x (%u)\n", + vrStructMembers[i].address, + vrStructMembers[i].size/8, + vrStructMembers[i].type_name, + vrStructMembers[i].name, + vrStructMembers[i].value, + vrStructMembers[i].value); + } + Print(OUTPUT_WINDOW,tempSym); + } + } + else if(vr.bArrayType) + { + Print(OUTPUT_WINDOW,"array\n"); + } + else + { + PICE_sprintf(tempSym,"%s %s @ %x = %x (%u)\n",vr.type_name,p,vr.address,vr.value,vr.value); + Print(OUTPUT_WINDOW,tempSym); + } + } + else + { + DPRINT((1,"\nERROR: code %x\n",vr.error)); + } +} diff --git a/rosapps/sysutils/utils/pice/module/symbols.h b/rosapps/sysutils/utils/pice/module/symbols.h new file mode 100644 index 00000000000..7b598aeaf90 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/symbols.h @@ -0,0 +1,88 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + symbols.h + +Abstract: + + HEADER for symbols.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +typedef struct _LOCAL_VARIABLE +{ + char type_name[64]; + char name[64]; + ULONG value,offset,line; + BOOLEAN bRegister; +}LOCAL_VARIABLE,*PLOCAL_VARIABLE; + + +struct _DEBUG_MODULE_SYMBOL_ +{ + ULONG value; + char* name; +}; + +typedef struct _DEBUG_MODULE_ +{ + struct _DEBUG_MODULE_ *next; + ULONG size; + PVOID BaseAddress; + PVOID EntryPoint; + WCHAR name[DEBUG_MODULE_NAME_LEN]; + struct _DEBUG_MODULE_SYMBOL_ syms; +}DEBUG_MODULE, *PDEBUG_MODULE; + +BOOLEAN InitFakeKernelModule(void); +BOOLEAN LoadExports(void); +BOOLEAN SanityCheckExports(void); +void UnloadExports(void); +BOOLEAN ScanExports(const char *pFind,PULONG pValue); +BOOLEAN ScanExportsByAddress(LPSTR *pFind,ULONG ulValue); +PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename); +BOOLEAN LoadSymbolsFromConfig(BOOLEAN bIgnoreBootParams); +void UnloadSymbols(void); +BOOLEAN ReloadSymbols(void); +LPSTR FindFunctionByAddress(ULONG ulValue,PULONG pulstart,PULONG pulend); +LPSTR FindSourceLineForAddress(ULONG addr,PULONG pulLineNumber,LPSTR* ppSrcStart,LPSTR* ppSrcEnd,LPSTR* ppFilename); +PLOCAL_VARIABLE FindLocalsByAddress(ULONG addr); +ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pMod); +PICE_SYMBOLFILE_HEADER* FindModuleSymbolsByModuleName(LPSTR modname); +BOOLEAN FindAddressForSourceLine(ULONG ulLineNumber,LPSTR pFilename, PDEBUG_MODULE pMod,PULONG pValue); +ULONG ConvertDecimalToUlong(LPSTR p); +PDEBUG_MODULE FindModuleFromAddress(ULONG addr); +PICE_SYMBOLFILE_HEADER* FindModuleSymbols(ULONG addr); +ULONG ListSymbolStartingAt(PDEBUG_MODULE pMod,PICE_SYMBOLFILE_HEADER* pSymbols,ULONG index,LPSTR pOutput); +PDEBUG_MODULE FindModuleByName(LPSTR modname); +void Evaluate(PICE_SYMBOLFILE_HEADER* pSymbols,LPSTR p); +LONG ExtractNumber(LPSTR p); +LPSTR ExtractTypeName(LPSTR p); +PDEBUG_MODULE IsModuleLoaded(LPSTR p); + +//extern ULONG kernel_end; +extern PICE_SYMBOLFILE_HEADER* apSymbols[32]; + +//extern struct module fake_kernel_module; +#define KERNEL_START (0xc0000000) + diff --git a/rosapps/sysutils/utils/pice/module/syscall.c b/rosapps/sysutils/utils/pice/module/syscall.c new file mode 100644 index 00000000000..6236f566de0 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/syscall.c @@ -0,0 +1,231 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + syscall.c + +Abstract: + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 12-Nov-1999: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +char syscallTemp[1024]; + +typedef struct _FRAME_SYSCALL +{ + ULONG eip; + ULONG cs; + ULONG eflags; +}FRAME_SYSCALL; + +BOOLEAN bReportProcessEvents = TRUE; + +ULONG OldSyscallHandler=0; + +ULONG ulFreeModule=0; + +PDEBUG_MODULE pModJustFreed=NULL; +void (*old_cleanup_module)(void)=NULL; + +void other_module_cleanup_module(void) +{ + DPRINT((0,"other_module_cleanup_module()\n")); + + if(old_cleanup_module) + { + DPRINT((0,"other_module_cleanup_module(): calling %x\n",(ULONG)old_cleanup_module)); + old_cleanup_module(); + } + + if(pModJustFreed) + { + DPRINT((0,"other_module_cleanup_module(): calling RevirtualizeBreakpointsForModule(%x)\n",(ULONG)pModJustFreed)); + RevirtualizeBreakpointsForModule(pModJustFreed); + } +} + +void CSyscallHandler(FRAME_SYSCALL* ptr,ULONG ulSysCall,ULONG ebx) +{ +// DPRINT((0,"CSyscallHandler(): %.4X:%.8X (syscall = %u)\n",ptr->cs,ptr->eip,ulSysCall)); +/* + switch(ulSysCall) + { + case 1: // sys_exit + DPRINT((0,"CSysCallHandler(): 1\n")); + if(bReportProcessEvents) + { + PICE_sprintf(syscallTemp,"pICE: process destroyed \"%s\" PID=%.4X\n",current->comm,current->pid); + AddToRingBuffer(syscallTemp); + } + break; + case 11: // sys_execve + DPRINT((0,"CSysCallHandler(): 11\n")); + if(bReportProcessEvents) + { + if(PICE_strlen((char*)ebx)) + PICE_sprintf(syscallTemp,"pICE: process created \"%s\" PID=%.4X (parent \"%s\")\n",(char *)ebx,current->pid,current->comm); + else + PICE_sprintf(syscallTemp,"pICE: process created PID=%.4X (parent \"%s\")\n",current->pid,current->comm); + AddToRingBuffer(syscallTemp); + } + break; + case 128: // sys_init_module + DPRINT((0,"CSysCallHandler(): 128\n")); + if(PICE_strlen((char *)ebx)) + { + if(pmodule_list) + { + struct module* pMod = *pmodule_list; + do + { + if(PICE_strcmpi((char*)ebx,(LPSTR)pMod->name)==0) + { + ULONG ulInitAddress; + PICE_sprintf(syscallTemp,"pICE: module \"%s\" loaded (%x-%x init @ %x)\n",(char*)ebx,pMod,(ULONG)pMod+pMod->size,pMod->init); + if((ulInitAddress=FindFunctionInModuleByName("init_module",pMod))) + { + DPRINT((0,"setting DR1=%.8x\n",ulInitAddress)); + + SetHardwareBreakPoint(ulInitAddress,1); + } + } + }while((pMod = pMod->next)); + } + else + { + PICE_sprintf(syscallTemp,"pICE: module loaded \"%s\"\n",(char *)ebx); + } + } + else + PICE_sprintf(syscallTemp,"pICE: module loaded\n"); + AddToRingBuffer(syscallTemp); + break; + case 129: // sys_delete_module + DPRINT((0,"CSysCallHandler(): 129\n")); + if(PICE_strlen((char *)ebx)) + { + if(IsModuleLoaded((LPSTR)ebx)!=NULL && PICE_strcmpi((char*)ebx,"pice")!=0 ) + { + PICE_sprintf(syscallTemp,"pICE: module freed \"%s\"\n",(char *)ebx); + Print(OUTPUT_WINDOW,syscallTemp); + if((pModJustFreed = FindModuleByName((char*)ebx)) ) + { + if(pModJustFreed->cleanup) + { + old_cleanup_module = pModJustFreed->cleanup; + pModJustFreed->cleanup = other_module_cleanup_module; + } + else + { + RevirtualizeBreakpointsForModule(pModJustFreed); + } + } + } + } + else + { + PICE_sprintf(syscallTemp,"pICE: module freed\n"); + AddToRingBuffer(syscallTemp); + } + break; + } + */ +} + +__asm__ ("\n\t \ +NewSyscallHandler:\n\t \ + // save used regs\n\t \ + pushfl\n\t \ + cli\n\t \ + cld\n\t \ + pushal\n\t \ + pushl %ds\n\t \ +\n\t \ + // push the syscall number\n\t \ + pushl %ebx\n\t \ + pushl %eax\n\t \ +\n\t \ + // frame ptr\n\t \ + lea 48(%esp),%eax\n\t \ + pushl %eax\n\t \ +\n\t \ + // setup default data selectors\n\t \ + movw %ss,%ax\n\t \ + movw %ax,%ds\n\t \ +\n\t \ + call _CSyscallHandler\n\t \ +\n\t \ + // remove pushed params\n\t \ + add $12,%esp\n\t \ +\n\t \ + // restore used regs\n\t \ + popl %ds\n\t \ + popal\n\t \ + popfl\n\t \ +\n\t \ + // chain to old handler\n\t \ + .byte 0x2e\n\t \ + jmp *_OldSyscallHandler"); + +void InstallSyscallHook(void) +{ + ULONG LocalSyscallHandler; + + ENTER_FUNC(); +/*ei fix later + MaskIrqs(); + if(!OldSyscallHandler) + { + __asm__("mov $NewSyscallHandler,%0" + :"=r" (LocalSyscallHandler) + : + :"eax"); + OldSyscallHandler=SetGlobalInt(0x2e,(ULONG)LocalSyscallHandler); + + ScanExports("free_module",(PULONG)&ulFreeModule); + + DPRINT((0,"InstallSyscallHook(): free_module @ %x\n",ulFreeModule)); + } + UnmaskIrqs(); + */ + LEAVE_FUNC(); +} + +void DeInstallSyscallHook(void) +{ + ENTER_FUNC(); +/*ei + MaskIrqs(); + if(OldSyscallHandler) + { + SetGlobalInt(0x2e,(ULONG)OldSyscallHandler); + (ULONG)OldSyscallHandler=0; + } + UnmaskIrqs(); +*/ + LEAVE_FUNC(); +} diff --git a/rosapps/sysutils/utils/pice/module/syscall.h b/rosapps/sysutils/utils/pice/module/syscall.h new file mode 100644 index 00000000000..d328d94cbb6 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/syscall.h @@ -0,0 +1,35 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + syscall.h + +Abstract: + + HEADER for syscall.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void InstallSyscallHook(void); +void DeInstallSyscallHook(void); + +void CReturnFromSyscallHandler(void); + diff --git a/rosapps/sysutils/utils/pice/module/trace.c b/rosapps/sysutils/utils/pice/module/trace.c new file mode 100644 index 00000000000..89e19a4a4e5 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/trace.c @@ -0,0 +1,91 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + trace.c + +Abstract: + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 19-Aug-1998: created + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" + +#include "precomp.h" + +extern void NewInt31Handler(void); + +void DeInstallTraceHook(void); + +volatile ULONG OldInt1Handler=0; + +BOOLEAN InstallTraceHook(void) +{ + ULONG LocalInt1Handler; + + DPRINT((0,"InstallTraceHook(OldInt1Handler=%0.8x)...\n",OldInt1Handler)); + + MaskIrqs(); + if(!OldInt1Handler) + { + __asm__("mov $NewInt1Handler,%0" + :"=r" (LocalInt1Handler) + : + :"eax"); + OldInt1Handler=SetGlobalInt(0x01,(ULONG)LocalInt1Handler); + } + UnmaskIrqs(); + return TRUE; +} + +//this asm function must be at least second in the file. otherwise gcc does not +//generate correct code. +__asm__("\n\t \ +NewInt1Handler:\n\t \ + pushl %eax\n\t \ + movl %dr6,%eax\n\t \ + testl $(1<<14),%eax\n\t \ + jz exceptionnotsinglestep\n\t \ +\n\t \ + popl %eax\n\t \ + pushl $" STR(REASON_SINGLESTEP) "\n\t \ + jmp NewInt31Handler\n\t \ +\n\t \ +exceptionnotsinglestep:\n\t \ + popl %eax\n\t \ + pushl $" STR(REASON_HARDWARE_BP) "\n\t \ + jmp NewInt31Handler\n\t \ +"); + +void DeInstallTraceHook(void) +{ + DPRINT((0,"DeInstallTraceHook(OldInt1Handler=%0.8x)...\n",OldInt1Handler)); + + MaskIrqs(); + if(OldInt1Handler) + { + SetGlobalInt(0x01,(ULONG)OldInt1Handler); + OldInt1Handler = 0; + } + UnmaskIrqs(); +} diff --git a/rosapps/sysutils/utils/pice/module/trace.h b/rosapps/sysutils/utils/pice/module/trace.h new file mode 100644 index 00000000000..98f759a3552 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/trace.h @@ -0,0 +1,35 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + trace.h + +Abstract: + + HEADER for trace.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +void DeInstallTraceHook(void); +BOOLEAN InstallTraceHook(void); +void NewInt1Handler(void); + +extern volatile ULONG OldInt1Handler; diff --git a/rosapps/sysutils/utils/pice/module/utils.c b/rosapps/sysutils/utils/pice/module/utils.c new file mode 100644 index 00000000000..76b537aaeea --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/utils.c @@ -0,0 +1,2430 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + util.c + +Abstract: + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 19-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" +#include + + +//////////////////////////////////////////////////// +// GLOBALS +//// +// output string +char tempUtil[1024]; +char tempFlowChanges[256]; + +//PMADDRESS_SPACE my_init_mm=NULL; + +ULONG TwoPagesForPhysMem[2*_PAGE_SIZE]; + +// scancode to ASCII table +SCANTOASCII ucScanToAscii_DE[]= +{ +// German keyboard + {16,'q'},{17,'w'},{18,'e'},{19,'r'},{20,'t'}, + {21,'z'},{22,'u'},{23,'i'},{24,'o'},{25,'p'}, + {30,'a'},{31,'s'},{32,'d'},{33,'f'},{34,'g'}, + {35,'h'},{36,'j'},{37,'k'},{38,'l'}, + {44,'y'},{45,'x'},{46,'c'},{47,'v'},{48,'b'}, + {49,'n'},{50,'m'}, + {2,'1'},{3,'2'},{4,'3'},{ 5,'4'},{ 6,'5'}, + {7,'6'},{8,'7'},{9,'8'},{10,'9'},{11,'0'}, + {12,''}, // 239 = ß + {0x39,' '},{0x35,'-'},{0x34,'.'},{0x1b,'+'}, + {0,0} +}; + +SCANTOASCII ucShiftScanToAscii_DE[]= +{ +// German keyboard SHIFTED + {16,'Q'},{17,'W'},{18,'E'},{19,'R'},{20,'T'}, + {21,'Z'},{22,'U'},{23,'I'},{24,'O'},{25,'P'}, + {30,'A'},{31,'S'},{32,'D'},{33,'F'},{34,'G'}, + {35,'H'},{36,'J'},{37,'K'},{38,'L'}, + {44,'Y'},{45,'X'},{46,'C'},{47,'V'},{48,'B'}, + {49,'N'},{50,'M'}, + {2,'!'},{3,'\"'}, // " // (fixes mc syntax highlighting) + {4,'@'}, // is pragraph sign on keyboard + { 5,'$'},{ 6,'%'}, + {7,'&'},{8,'/'},{9,'('},{10,')'},{11,'='}, + {12,'?'}, + {0x39,' '},{0x35,'_'},{0x34,':'},{0x1b,'*'}, + {0,0} +}; + +SCANTOASCII ucScanToAscii_US[]= +{ +// US keyboard + {16,'q'},{17,'w'},{18,'e'},{19,'r'}, + {20,'t'},{21,'y'},{22,'u'},{23,'i'}, + {24,'o'},{25,'p'},{30,'a'},{31,'s'}, + {32,'d'},{33,'f'},{34,'g'},{35,'h'}, + {36,'j'},{37,'k'},{38,'l'},{44,'z'}, + {45,'x'},{46,'c'},{47,'v'},{48,'b'}, + {49,'n'},{50,'m'},{2,'1'},{3,'2'}, + {4,'3'},{5,'4'},{6,'5'},{7,'6'}, + {8,'7'},{9,'8'},{10,'9'},{11,'0'},{12,'-'}, + {0x39,' '},{0x35,'/'},{0x34,'.'},{0x1b,']'}, + {0x1a,'['},{0x33,','},{0x27,';'},{0x0d,'='}, + {0x2b,'\\'},{0x28,'\''},{0x29,'`'}, + {0,0} +}; + +SCANTOASCII ucShiftScanToAscii_US[]= +{ +// US keyboard SHIFTED + {16,'Q'},{17,'W'},{18,'E'},{19,'R'}, + {20,'T'},{21,'Y'},{22,'U'},{23,'I'}, + {24,'O'},{25,'P'},{30,'A'},{31,'S'}, + {32,'D'},{33,'F'},{34,'G'},{35,'H'}, + {36,'J'},{37,'K'},{38,'L'},{44,'Z'}, + {45,'X'},{46,'C'},{47,'V'},{48,'B'}, + {49,'N'},{50,'M'},{2,'!'},{3,'@'}, + {4,'#'},{5,'$'},{6,'%'},{7,'^'}, + {8,'&'},{9,'*'},{10,'('},{11,')'},{12,'_'}, + {0x39,' '},{0x35,'?'},{0x34,'>'},{0x1b,'}'}, + {0x1a,'{'},{0x33,'<'},{0x27,':'},{0x0d,'+'}, + {0x2b,'|'},{0x28,'\"'},{0x29,'~'}, + {0,0} +}; + + +SCANTOASCII ucScanToAscii_DK[]= +{ +// Danish keyboard + {16,'q'},{17,'w'},{18,'e'},{19,'r'}, + {20,'t'},{21,'y'},{22,'u'},{23,'i'}, + {24,'o'},{25,'p'},{30,'a'},{31,'s'}, + {32,'d'},{33,'f'},{34,'g'},{35,'h'}, + {36,'j'},{37,'k'},{38,'l'},{44,'z'}, + {45,'x'},{46,'c'},{47,'v'},{48,'b'}, + {49,'n'},{50,'m'},{2,'1'},{3,'2'}, + {4,'3'},{5,'4'},{6,'5'},{7,'6'}, + {8,'7'},{9,'8'},{10,'9'},{11,'0'},{12,'+'}, + {0x39,' '},{0x35,'-'},{0x34,'.'},{0x1b,''}, + {0x1a,''},{0x33,','},{0x27,''},{0x0d,''}, + {0x2b,'\''},{0x28,''},{0x29,' '}, + {0,0} +}; + +SCANTOASCII ucShiftScanToAscii_DK[]= +{ +// Danish keyboard SHIFTED + {16,'Q'},{17,'W'},{18,'E'},{19,'R'}, + {20,'T'},{21,'Y'},{22,'U'},{23,'I'}, + {24,'O'},{25,'P'},{30,'A'},{31,'S'}, + {32,'D'},{33,'F'},{34,'G'},{35,'H'}, + {36,'J'},{37,'K'},{38,'L'},{44,'Z'}, + {45,'X'},{46,'C'},{47,'V'},{48,'B'}, + {49,'N'},{50,'M'},{2,'!'},{3,'"'}, + {4,'#'},{5,''},{6,'%'},{7,'&'}, + {8,'/'},{9,'('},{10,')'},{11,'='},{12,'?'}, + {0x39,' '},{0x35,'_'},{0x34,':'},{0x1b,'^'}, + {0x1a,''},{0x33,';'},{0x27,''},{0x0d,'`'}, + {0x2b,'*'},{0x28,''},{0x29,''}, + {0,0} +}; + +SCANTOASCII ucAltScanToAscii_DK[]= +{ +// Danish keyboard ALTED + {16,' '},{17,' '},{18,' '},{19,' '}, + {20,' '},{21,' '},{22,' '},{23,' '}, + {24,' '},{25,' '},{30,' '},{31,' '}, + {32,' '},{33,' '},{34,' '},{35,' '}, + {36,' '},{37,' '},{38,' '},{44,' '}, + {45,' '},{46,' '},{47,' '},{48,' '}, + {49,' '},{50,' '},{2,' '},{3,'@'}, + {4,''},{5,'$'},{6,''},{7,' '}, + {8,'{'},{9,'['},{10,']'},{11,'}'},{12,' '}, + {0x39,' '},{0x35,' '},{0x34,' '},{0x1b,'~'}, + {0x1a,' '},{0x33,' '},{0x27,' '},{0x0d,'|'}, + {0x2b,' '},{0x28,' '},{0x29,' '}, + {0,0} +}; + +KEYBOARD_LAYOUT ucKeyboard[]= +{ + {"de", ucScanToAscii_DE, ucShiftScanToAscii_DE, NULL}, + {"us", ucScanToAscii_US, ucShiftScanToAscii_US, NULL}, + {"dk", ucScanToAscii_DK, ucShiftScanToAscii_DK, ucAltScanToAscii_DK}, + {NULL, NULL, NULL, NULL} +}; + +PKEYBOARD_LAYOUT CurrentKeyboard = NULL; + + +//////////////////////////////////////////////////// +// FUNCTIONS +//// + +//************************************************************************* +// GetKeyboardLayout() +// +//************************************************************************* +PKEYBOARD_LAYOUT GetKeyboardLayout() +{ + if (CurrentKeyboard == NULL) + { + CurrentKeyboard = &ucKeyboard[kbUS]; + } + + return CurrentKeyboard; +} + +//************************************************************************* +// SetKeyboardLayoutByName() +// +//************************************************************************* +PKEYBOARD_LAYOUT SetKeyboardLayoutByName(LPSTR Name) +{ + CHAR tempCmd[256]; + ULONG i; + + for(i=0;ucKeyboard[i].name != NULL;i++) + { + if(PICE_strcmpi(ucKeyboard[i].name, Name) == 0) + { + CurrentKeyboard = &ucKeyboard[i]; + return CurrentKeyboard; + } + } + return GetKeyboardLayout(); +} + +//************************************************************************* +// PICE_memset() +// +//************************************************************************* +void PICE_memset(void* p,unsigned char c,int sz) +{ + unsigned char *p2 = (unsigned char *)p; + while(sz--) + *p2++ = c; +} + +//************************************************************************* +// PICE_memcpy() +// +//************************************************************************* +void PICE_memcpy(void* t,void* s,int sz) +{ + memcpy(t,s,sz); +} + +//************************************************************************* +// PICE_isprint() +// +//************************************************************************* +BOOLEAN PICE_isprint(char c) +{ + BOOLEAN bResult = FALSE; + + if((ULONG)c>=0x20 && (ULONG)c<=0x7f) + bResult = TRUE; + + return bResult; +} + +//************************************************************************* +// PICE_strchr() +// +//************************************************************************* +char* PICE_strchr(char* s,char c) +{ + while(IsAddressValid((ULONG)s) && *s) + { + if(*s == c) + return s; + s++; + } +#ifdef DEBUG + if(!IsAddressValid((ULONG)s) ) + { + DPRINT((0,"PICE_strchr(): ********************\n")); + DPRINT((0,"PICE_strchr(): EXCEPTION @ %.8X\n",(ULONG)s)); + DPRINT((0,"PICE_strchr(): ********************\n")); + } +#endif + + return NULL; +} + +//************************************************************************* +// PICE_strncpy() +// +//************************************************************************* +char* PICE_strncpy(char* s1,char* s2,int len) +{ + ULONG len2 = PICE_strlen(s2); + + if(len='a' && c<='z') + c = (c-'a')+'A'; + + return c; +} + +int PICE_isdigit( int c ) +{ + return ((c>=0x30) && (c<=0x39)); +} + +int PICE_isxdigit( int c ) +{ + return (PICE_isdigit(c) || ((c>=0x41) && (c<=0x46)) || ((c>=0x61) && (c<=0x66))); +} + +int PICE_islower( int c ) +{ + return ((c>=0x61) && (c<=0x7a)); +} + +int PICE_isalpha( int c ) +{ + return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); +} + +//************************************************************************* +// PICE_strncmpi() +// +// my version of strncmpi() +//************************************************************************* +ULONG PICE_strncmpi(char* s1,char* s2,ULONG len) +{ +ULONG result=1; + + while(len && + IsAddressValid((ULONG)s1) && *s1 && // not end of string + IsAddressValid((ULONG)s2) && *s2 && // not end of string + PICE_toupper(*s1)==PICE_toupper(*s2) ) // char are the same except case + { + s1++; + s2++; + len--; + } + // strings same length + if(len==0) + result=0; + + return result; +} + +//************************************************************************* +// PICE_strcmpi() +// +// my version of strcmp() +//************************************************************************* +ULONG PICE_strcmpi(char* s1,char* s2) +{ +ULONG result=1; + + while(IsAddressValid((ULONG)s1) && *s1 && // not end of string + IsAddressValid((ULONG)s2) && *s2 && // not end of string + PICE_toupper(*s1)==PICE_toupper(*s2) ) // char are the same except case + { + s1++; + s2++; + } + // strings same length + if(*s1==0 && *s2==0) + result=0; + + return result; +} + +//************************************************************************* +// PICE_strcmp() +// +// my version of strcmp() +//************************************************************************* +ULONG PICE_strcmp(char* s1,char* s2) +{ + ULONG result=1; + + while(IsAddressValid((ULONG)s1) && *s1 && // not end of string + IsAddressValid((ULONG)s2) && *s2 && // not end of string + (*s1)==(*s2) ) + { + s1++; + s2++; + } + // strings same length + if(*s1==0 && *s2==0) + result=0; + + return result; +} + +//************************************************************************* +// PICE_fncmp() +// +// compare function names ignoring decorations: +// leading '_' or '@" and trailing "@xx" +//************************************************************************* +ULONG PICE_fncmp(char* s1,char* s2) +{ + ULONG result=1; + + if( IsAddressValid((ULONG)s1) && (*s1 == '_' || *s1 == '@')) + s1++; + + if( IsAddressValid((ULONG)s2) && (*s2 == '_' || *s2 == '@')) + s2++; + + while(IsAddressValid((ULONG)s1) && *s1 && // not end of string + IsAddressValid((ULONG)s2) && *s2 ) + { + if( (*s1 != *s2) || *s1=='@' || *s2=='@' ) + break; + s1++; + s2++; + } + // strings same length + if((*s1==0 || *s1=='@') && (*s2==0 || *s2 =='@')){ + result=0; + } + return result; +} + +//************************************************************************* +// PICE_fnncmp() +// +// compare function names ignoring decorations: +// leading '_' or '@" and trailing "@xx" . Decorations are included in total length. +//************************************************************************* +ULONG PICE_fnncmp(char* s1,char* s2, ULONG len) +{ + ULONG result=1; + ULONG len1 = len, len2 = len; + + if( IsAddressValid((ULONG)s1) && (*s1 == '_' || *s1 == '@')){ + s1++; + len1--; + } + + if( IsAddressValid((ULONG)s2) && (*s2 == '_' || *s2 == '@')){ + s2++; + len2--; + } + + while(len1 && len2 && IsAddressValid((ULONG)s1) && *s1 && // not end of string + IsAddressValid((ULONG)s2) && *s2 ) + { + if( (*s1 != *s2) || *s1=='@' || *s2=='@' ) + break; + s1++; + s2++; + len1--; + len2--; + } + // strings are the same length + if((*s1=='\0' || *s1=='@') && (*s2=='\0' || *s2 =='@')){ + result=0; + } + return result; +} + +wchar_t PICE_towlower(wchar_t c) +{ + if ( c>=L'A' && c<=L'Z' ) + return (c - (L'A' - L'a')); + return(c); +} + +ULONG PICE_wcsicmp(WCHAR* s1, WCHAR* s2) +{ + ULONG result=1; + + while(IsAddressValid((ULONG)s1) && *s1 && // not end of string + IsAddressValid((ULONG)s2) && *s2 && // not end of string + PICE_towlower(*s1)==PICE_towlower(*s2) ) // char are the same except case + { + s1++; + s2++; + } + // strings same length + if(*s1==0 && *s2==0) + result=0; + + return result; +} + +//************************************************************************* +// PICE_strrev() +// +// my version of strrev() +//************************************************************************* +char* PICE_strrev(char* s) +{ +ULONG i,j,len=PICE_strlen(s)-1; +char c; + + for(i=0,j=len;i>8)==0) + pAnsi[j]=(char)(pWide[j]); + else + pAnsi[j]=0x20; + } + pAnsi[j]=0; + +} +#endif // LINUX + +//************************************************************************* +// IsAddressValid() +// +//************************************************************************* +BOOLEAN IsAddressValid(ULONG address) +{ + PULONG pPGD; + PULONG pPTE; + BOOLEAN bResult = FALSE; + + address &= (~(_PAGE_SIZE-1)); + + pPGD = ADDR_TO_PDE(address); + if(pPGD && ((*pPGD)&_PAGE_PRESENT)) + { + // not large page + if(!((*pPGD)&_PAGE_4M)) + { + pPTE = ADDR_TO_PTE(address); + if(pPTE) + { + bResult = (*pPTE)&(_PAGE_PRESENT | _PAGE_PSE); + } + } + // large page + else + { + bResult = TRUE; + } + } + + return bResult; +} + + +//************************************************************************* +// IsAddressWriteable() +// +// returns: +// TRUE if adress/page is writeable +// FALSE if adress/page is not writeable +// +//************************************************************************* +BOOLEAN IsAddressWriteable(ULONG address) +{ + PULONG pPGD; + PULONG pPTE; + + //address &= (~(_PAGE_SIZE-1)); + pPGD = ADDR_TO_PDE(address); + if(pPGD && ((*pPGD)&_PAGE_PRESENT)) + { + // not large page + if(!((*pPGD)&_PAGE_4M)) + { + if(!((*pPGD) & _PAGE_RW)) + return FALSE; + + pPTE = ADDR_TO_PTE(address); + if(pPTE) + { + if( ((*pPTE)&(_PAGE_PRESENT | _PAGE_PSE)) && + ((*pPTE) & _PAGE_RW)) + return TRUE; + else + return FALSE; + } + } + // large page + else + return ((*pPGD) & _PAGE_RW); + } + + return FALSE; +} + + +//************************************************************************* +// SetAddressWriteable() +// +//************************************************************************* +BOOLEAN SetAddressWriteable(ULONG address,BOOLEAN bSet) +{ + PULONG pPGD; + PULONG pPTE; + + //address &= (~(_PAGE_SIZE-1)); + + pPGD = ADDR_TO_PDE(address); + if(pPGD && ((*pPGD)&_PAGE_PRESENT)) + { + // not large page + if(!((*pPGD)&_PAGE_4M)) + { + pPTE = ADDR_TO_PTE(address); + if(pPTE) + { + if( (*pPTE)&(_PAGE_PRESENT | _PAGE_PSE) ) + { + if( bSet ){ + *pPTE |= _PAGE_RW; + } + else{ + *pPTE &= ~_PAGE_RW; + } + FLUSH_TLB; + return TRUE; + } + } + } + // large page + else + { + if( bSet ) + *pPGD |= _PAGE_RW; + else + *pPGD &= ~_PAGE_RW; + FLUSH_TLB; + return TRUE; + } + } + return FALSE; +} +//************************************************************************* +// IsRangeValid() +// +// scan range for page present +//************************************************************************* +BOOLEAN IsRangeValid(ULONG Addr,ULONG Length) +{ +ULONG i,NumPages,PageNum; + + // need to only touch one byte per page + // calculate PICE_number of pages to touch + NumPages=(Length+(_PAGE_SIZE-1))>>12; + + // calculate PICE_number of page + PageNum=Addr>>PAGE_SHIFT; + + // touch all pages containing range + for(i=0;i>16))); + + LEAVE_FUNC(); + + return pGdt; +} + +//************************************************************************* +// GetLinearAddress() +// +// return flat address for SEGMENT:OFFSET +//************************************************************************* +ULONG GetLinearAddress(USHORT Segment,ULONG Offset) +{ + PGDT pGdt; + ULONG result=0; + PDESCRIPTOR pSel; + USHORT OriginalSegment=Segment; + + ENTER_FUNC(); + + pSel=(struct tagDESCRIPTOR*)&Segment; + + // get GDT pointer + pGdt=GetGDTPtr(); + DPRINT((0,"GetLinearAddress(): pGDT = %.8X\n",pGdt)); + DPRINT((0,"GetLinearAddress(): original Segment:Offset = %.4X:%.8X\n",Segment,Offset)); + + // see if segment selector is in LDT + if(pSel->Ti) + { + DPRINT((0,"GetLinearAddress(): Segment is in LDT\n")); + // get LDT selector + __asm__("\n\t \ + sldt %%ax\n\t \ + mov %%ax,%0" + :"=m" (Segment)); + if(Segment) + { + DPRINT((0,"GetLinearAddress(): no LDT\n")); + // get LDT selector + pGdt=(PGDT)((pGdt[pSel->Val].Base_31_24<<24)| + (pGdt[pSel->Val].Base_23_16<<16)| + (pGdt[pSel->Val].Base_15_0)); + if(!IsRangeValid((ULONG)pGdt,0x8) ) + pGdt=0; + } + else + { + pGdt=0; + } + } + + if(pGdt && Segment) + { + DPRINT((0,"GetLinearAddress(): Segment:Offset = %.4X:%.8X\n",Segment,Offset)); + result=pGdt[OriginalSegment>>3].Base_15_0| + (pGdt[OriginalSegment>>3].Base_23_16<<16)| + (pGdt[OriginalSegment>>3].Base_31_24<<24); + result+=Offset; + } + DPRINT((0,"GetLinearAddress(%.4X:%.8X)=%.8X\n",OriginalSegment,Offset,result)); + + LEAVE_FUNC(); + + return result; +} + +//************************************************************************* +// ShowRunningMsg() +// +// place RUNNING message +//************************************************************************* +void ShowRunningMsg(void) +{ + ENTER_FUNC(); + + SetForegroundColor(COLOR_TEXT); + SetBackgroundColor(COLOR_CAPTION); + ClrLine(wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + PutChar(" Reactos is running... (Press CTRL-D to stop) ",1,wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + ResetColor(); + + LEAVE_FUNC(); +} + +//************************************************************************* +// ShowStoppedMsg() +// +// place STOPPED message +//************************************************************************* +void ShowStoppedMsg(void) +{ + ENTER_FUNC(); + + SetForegroundColor(COLOR_TEXT); + SetBackgroundColor(COLOR_CAPTION); + ClrLine(wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + PutChar(" Stopped... (Type 'x' to continue) ",1,wWindow[OUTPUT_WINDOW].y+wWindow[OUTPUT_WINDOW].cy); + ResetColor(); + + LEAVE_FUNC(); +} + +//************************************************************************* +// SetHardwareBreakPoint() +// +//************************************************************************* +void SetHardwareBreakPoint(ULONG ulAddress,ULONG ulReg) +{ + ULONG mask = 0x300; + ULONG enable_mask = 0x3; + + DPRINT((0,"SetHardwareBreakPoint(%x,DR%x)\n",ulAddress,ulReg)); + + enable_mask <<= (ulReg*2); + mask |= enable_mask; + + DPRINT((0,"mask = %x\n",mask)); + + __asm__ __volatile__ + ("\n\t \ + xorl %%eax,%%eax\n\t \ + mov %%eax,%%dr6\n\t \ + mov %%dr7,%%eax\n\t \ + orl %0,%%eax\n\t \ + mov %%eax,%%dr7\n\t \ + " + : + :"m" (mask) + :"eax"); + + switch(ulReg) + { + case 0: + __asm__ __volatile__ + ("\n\t \ + mov %0,%%eax\n\t \ + mov %%eax,%%dr0\n\t \ + " + : + :"m" (ulAddress) + :"eax"); + break; + case 1: + __asm__ __volatile__ + ("\n\t \ + mov %0,%%eax\n\t \ + mov %%eax,%%dr1\n\t \ + " + : + :"m" (ulAddress) + :"eax"); + break; + case 2: + __asm__ __volatile__ + ("\n\t \ + mov %0,%%eax\n\t \ + mov %%eax,%%dr2\n\t \ + " + : + :"m" (ulAddress) + :"eax"); + break; + case 3: + __asm__ __volatile__ + ("\n\t \ + mov %0,%%eax\n\t \ + mov %%eax,%%dr3\n\t \ + " + : + :"m" (ulAddress) + :"eax"); + break; + } +} + +//************************************************************************* +// SetHardwareBreakPoints() +// +// install HW breakpoints +//************************************************************************* +void SetHardwareBreakPoints(void) +{ +ULONG i; +ULONG mask; +ULONG LinAddr0,LinAddr1,LinAddr2,LinAddr3; +PULONG LinAddr[4]={&LinAddr0,&LinAddr1,&LinAddr2,&LinAddr3}; + + ENTER_FUNC(); + + // cancel all debug activity + __asm__("\n\t \ + pushl %eax\n\t \ + xorl %eax,%eax\n\t \ + mov %eax,%dr6\n\t \ + mov %eax,%dr7\n\t \ + popl %eax"); + // build DR7 mask + for(mask=0,i=0;i<4;i++) + { + mask<<=2; + if(Bp[i].Active && Bp[i].Used && !Bp[i].Virtual) + { + mask|=0x03; + *LinAddr[3-i]=Bp[i].LinearAddress; + DPRINT((0,"breakpoint %u at %.8X\n",i,Bp[i].LinearAddress)); + } + } + if(mask) + { + __asm__("\n\t \ + pushl %%eax\n\t \ + movl %0,%%eax\n\t \ + andl $0x000000FF,%%eax\n\t \ + orl $0x300,%%eax\n\t \ + mov %%eax,%%dr7\n\t \ + mov %1,%%eax\n\t \ + mov %%eax,%%dr0\n\t \ + mov %2,%%eax\n\t \ + mov %%eax,%%dr1\n\t \ + mov %3,%%eax\n\t \ + mov %%eax,%%dr2\n\t \ + mov %4,%%eax\n\t \ + mov %%eax,%%dr3\n\t \ + popl %%eax" + : + :"m" (mask),"m" (LinAddr0),"m" (LinAddr1),"m" (LinAddr2),"m" (LinAddr3)); + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// IsCallInstrAtEIP() +// +// check if instruction at CS:EIP changes program flow +//************************************************************************* +BOOLEAN IsCallInstrAtEIP(void) +{ +PUCHAR linear; +BOOLEAN result=FALSE; + + ENTER_FUNC(); + DPRINT((0,"IsCallInstrAtEIP()\n")); + + linear=(PUCHAR)GetLinearAddress(CurrentCS,CurrentEIP); + if(IsRangeValid((ULONG)linear,2)) + { + if(*linear== 0xE8 || // call + (*linear== 0xFF && ( ((*(linear+1)>>3)&0x7)==0x2 || ((*(linear+1)>>3)&0x7)==0x3) ) || // call + *linear== 0x9A || // call + *linear== 0xF2 || // REP + *linear== 0xF3) // REP + result=TRUE; + } + + LEAVE_FUNC(); + + return result; +} + + +//************************************************************************* +// IsRetAtEIP() +// +// check if instruction at CS:EIP is a return instruction +//************************************************************************* +BOOLEAN IsRetAtEIP(void) +{ + PUCHAR linear; + BOOLEAN bResult = FALSE; + + ENTER_FUNC(); + DPRINT((0,"IsRetAtEIP()\n")); + + linear=(PUCHAR)GetLinearAddress(CurrentCS,CurrentEIP); + + switch(*linear) + { + case 0xc2: + case 0xc3: + case 0xca: + case 0xcb: + case 0xcf: // IRET/IRETD + bResult = TRUE; + break; + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// VisualizeFlags() +// +// display CPU EFLAGS as string +//************************************************************************* +LPSTR VisualizeFlags(ULONG EFlags) +{ + static UCHAR FlagNames[]={'c',0,'p',0,'a',0,'z','s','t','i','d','o'}; + ULONG i,j; + static char temp[32]; + + for(j=0,i=0;i>=1; + } + temp[j]=0; + PICE_strrev(temp); + return temp; +} + +//************************************************************************* +// DisplayRegs() +// +// display CPU registers +//************************************************************************* +void DisplayRegs(void) +{ + char tempDisplayRegs[48]; + + ENTER_FUNC(); + +// Clear(REGISTER_WINDOW); + Home(REGISTER_WINDOW); + // EAX + Print(REGISTER_WINDOW,"EAX="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentEAX); + if(OldEAX!=CurrentEAX) + { + SetForegroundColor(WHITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEAX!=CurrentEAX) + { + ResetColor(); + } + + // EBX + Print(REGISTER_WINDOW," EBX="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentEBX); + if(OldEBX!=CurrentEBX) + { + SetForegroundColor(WHITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEBX!=CurrentEBX) + { + ResetColor(); + } + + // ECX + Print(REGISTER_WINDOW," ECX="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentECX); + if(OldECX!=CurrentECX) + { + SetForegroundColor(WHITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldECX!=CurrentECX) + { + ResetColor(); + } + + // EDX + Print(REGISTER_WINDOW," EDX="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentEDX); + if(OldEDX!=CurrentEDX) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEDX!=CurrentEDX) + { + ResetColor(); + } + + // ESI + Print(REGISTER_WINDOW," ESI="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentESI); + if(OldESI!=CurrentESI) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldESI!=CurrentESI) + { + ResetColor(); + } + + // EDI + Print(REGISTER_WINDOW," EDI="); + PICE_sprintf(tempDisplayRegs,"%.8X\n",CurrentEDI); + if(OldEDI!=CurrentEDI) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEDI!=CurrentEDI) + { + ResetColor(); + } + + // EBP + Print(REGISTER_WINDOW,"EBP="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentEBP); + if(OldEBP!=CurrentEBP) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEBP!=CurrentEBP) + { + ResetColor(); + } + + // ESP + Print(REGISTER_WINDOW," ESP="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentESP); + if(OldESP!=CurrentESP) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldESP!=CurrentESP) + { + ResetColor(); + } + + // EIP + Print(REGISTER_WINDOW," EIP="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentEIP); + if(OldEIP!=CurrentEIP) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEIP!=CurrentEIP) + { + ResetColor(); + } + + // EFL + Print(REGISTER_WINDOW," EFLAGS="); + PICE_sprintf(tempDisplayRegs,"%.8X",CurrentEFL); + if(OldEFL!=CurrentEFL) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldEFL!=CurrentEFL) + { + ResetColor(); + } + + // visual flags + PICE_sprintf(tempDisplayRegs," %s\n",VisualizeFlags(CurrentEFL)); + Print(REGISTER_WINDOW,tempDisplayRegs); + + // CS + Print(REGISTER_WINDOW,"CS="); + PICE_sprintf(tempDisplayRegs,"%.4X",CurrentCS); + if(OldCS!=CurrentCS) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldCS!=CurrentCS) + { + ResetColor(); + } + + // DS + Print(REGISTER_WINDOW," DS="); + PICE_sprintf(tempDisplayRegs,"%.4X",CurrentDS); + if(OldDS!=CurrentDS) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldDS!=CurrentDS) + { + ResetColor(); + } + + // ES + Print(REGISTER_WINDOW," ES="); + PICE_sprintf(tempDisplayRegs,"%.4X",CurrentES); + if(OldES!=CurrentES) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldES!=CurrentES) + { + ResetColor(); + } + + // FS + Print(REGISTER_WINDOW," FS="); + PICE_sprintf(tempDisplayRegs,"%.4X",CurrentFS); + if(OldFS!=CurrentFS) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldFS!=CurrentFS) + { + ResetColor(); + } + + // GS + Print(REGISTER_WINDOW," GS="); + PICE_sprintf(tempDisplayRegs,"%.4X",CurrentGS); + if(OldGS!=CurrentGS) + { + ResetColor(); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldGS!=CurrentGS) + { + ResetColor(); + } + + // SS + Print(REGISTER_WINDOW," SS="); + PICE_sprintf(tempDisplayRegs,"%.4X",CurrentSS); + if(OldSS!=CurrentSS) + { + SetForegroundColor(COLOR_HILITE); + } + Print(REGISTER_WINDOW,tempDisplayRegs); + if(OldSS!=CurrentSS) + { + ResetColor(); + } + + LEAVE_FUNC(); +} + +//************************************************************************* +// SaveOldRegs() +// +//************************************************************************* +void SaveOldRegs(void) +{ + + ENTER_FUNC(); + + OldEAX=CurrentEAX; + OldEBX=CurrentEBX; + OldECX=CurrentECX; + OldEDX=CurrentEDX; + OldESI=CurrentESI; + OldEDI=CurrentEDI; + OldEBP=CurrentEBP; + OldESP=CurrentESP; + OldEIP=CurrentEIP; + OldEFL=CurrentEFL; + OldCS=CurrentCS; + OldDS=CurrentDS; + OldES=CurrentES; + OldFS=CurrentFS; + OldGS=CurrentGS; + OldSS=CurrentSS; + + LEAVE_FUNC(); +} + +//************************************************************************* +// GetKeyStatus() +// +//************************************************************************* +UCHAR GetKeyStatus(void) +{ + UCHAR ucRet; + ucRet = inb_p((PUCHAR)(I8042_PHYSICAL_BASE + I8042_STATUS_REGISTER_OFFSET)); + return ucRet; +} + +//************************************************************************* +// GetKeyData() +// +//************************************************************************* +UCHAR GetKeyData(void) +{ + UCHAR ucRet; + ucRet = inb_p((PUCHAR)(I8042_PHYSICAL_BASE + I8042_DATA_REGISTER_OFFSET)); + return ucRet; +} + +//************************************************************************* +// GetKeyPolled +// +//************************************************************************* +UCHAR KeyboardGetKeyPolled(void) +{ + UCHAR ucKey; + UCHAR ucStatus; + static BOOLEAN bExtended = FALSE; + + while(ucKey=0,(ucStatus=GetKeyStatus())&OUTPUT_BUFFER_FULL) + { + ucKey = 0; + ucKey = GetKeyData(); + + if(ucStatus&MOUSE_OUTPUT_BUFFER_FULL) + continue; + + DPRINT((1,"GetKeyPolled(): key = %x bExtended=%s\n",ucKey,bExtended?"TRUE":"FALSE")); + + if(SCANCODE_EXTENDED == ucKey) + { + DPRINT((1,"extended switched ON\n")); + bExtended = TRUE; + continue; + } + else + { + if(!(ucKey&0x80)) // keypress + { + switch(ucKey&0x7f) + { + case SCANCODE_L_CTRL: + case SCANCODE_R_CTRL: + if(!bExtended) + bControl=TRUE; + break; + case SCANCODE_L_SHIFT: + case SCANCODE_R_SHIFT: + if(!bExtended) + bShift=TRUE; + break; + case SCANCODE_L_ALT: + case SCANCODE_R_ALT: + if(!bExtended) + bAlt=TRUE; + break; + default: + DPRINT((0,"GetKeyPolled(): control = %u shift = %u alt = %u\n",bControl,bShift,bAlt)); + return ucKey; + } + } + else + { + switch(ucKey&0x7f) + { + case SCANCODE_L_CTRL: + case SCANCODE_R_CTRL: + if(!bExtended) + bControl=FALSE; + break; + case SCANCODE_L_SHIFT: + case SCANCODE_R_SHIFT: + if(!bExtended) + bShift=FALSE; + break; + case SCANCODE_L_ALT: + case SCANCODE_R_ALT: + if(!bExtended) + bAlt=FALSE; + break; + } + } + } + bExtended=FALSE; + } + + return ucKey; +} + +//************************************************************************* +// KeyboardFlushKeyboardQueue() +// +//************************************************************************* +void KeyboardFlushKeyboardQueue(void) +{ + //__udelay(10); + KeStallExecutionProcessor(10); + while(GetKeyStatus()&OUTPUT_BUFFER_FULL) + { + GetKeyData(); + //__udelay(10); + KeStallExecutionProcessor(10); + } +} + +//************************************************************************* +// CheckLoadAbort() +// +//************************************************************************* +BOOLEAN CheckLoadAbort(void) +{ +ULONG i; +UCHAR ucKey; + + MaskIrqs(); + + SaveGraphicsState(); + + FlushKeyboardQueue(); + + PrintLogo(TRUE); + + for(i=0;i<5000;i++) + { + if(!(i%1000) ) + { + PICE_sprintf(tempUtil,"\n LOAD WILL CONTINUE IN %u SEC (HIT 'C' TO CONTINUE OR ANY OTHER KEY TO ABORT)\n",5-i/1000); + Clear(REGISTER_WINDOW); + Print(REGISTER_WINDOW,tempUtil); + PrintLogo(TRUE); + } + + ucKey = GetKeyPolled(); + + if(ucKey) + { + if((ucKey&0x7f)!=46) + { + RestoreGraphicsState(); + UnmaskIrqs(); + return FALSE; + } + else + goto load; + } + KeStallExecutionProcessor(1000); + } +load: + Clear(REGISTER_WINDOW); + PrintLogo(TRUE); + + tempUtil[0] = 0; + FlushKeyboardQueue(); + + RestoreGraphicsState(); + + UnmaskIrqs(); + + return TRUE; +} + + + + +//************************************************************************* +// IntelStackWalk() +// +//************************************************************************* +void IntelStackWalk(ULONG pc,ULONG ebp,ULONG esp) +{ + PULONG pFrame, pPrevFrame; + LPSTR pSymbolName; + + DPRINT((0,"IntelStackWalk(): pc = %X ebp = %X esp = %X\n",pc,ebp,esp)); + + pFrame = pPrevFrame = (PULONG)ebp; + + PutStatusText("EIP FRAME NAME\n"); + while(1) + { + DPRINT((0,"IntelStackWalk(): pFrame = %X pPrevFrame = %X pc =%X\n",(ULONG)pFrame,(ULONG)pPrevFrame,pc)); + if ( ( (ULONG)pFrame & 3 ) || + ( (pFrame <= pPrevFrame) ) ) + { + DPRINT((0,"IntelStackWalk(): pFrame is either unaligned or not less than previous\n")); + if( !IsRangeValid((ULONG)pFrame, sizeof(PVOID)*2) ) + { + DPRINT((0,"IntelStackWalk(): pFrame not valid pointer!\n")); + break; + } + } + + if((pSymbolName = FindFunctionByAddress(pc,NULL,NULL)) ) + PICE_sprintf(tempUtil,"%08X %08X %s\n",pc, (ULONG)pFrame,pSymbolName); + else + PICE_sprintf(tempUtil,"%08X %08X\n",pc, (ULONG)pFrame); + Print(OUTPUT_WINDOW,tempUtil); + if(WaitForKey()==FALSE)break; + + pc = pFrame[1]; + + pPrevFrame = pFrame; + + pFrame = (PULONG)pFrame[0]; // proceed to next higher frame on stack + } +} + +//************************************************************************* +// FindPteForLinearAddress() +// +//************************************************************************* +PULONG FindPteForLinearAddress(ULONG address) +{ + PULONG pPGD; + PULONG pPTE; + BOOLEAN bResult = FALSE; + PEPROCESS my_current = IoGetCurrentProcess(); + + ENTER_FUNC(); + + address &= (~(_PAGE_SIZE-1)); + + if(my_current) + { + pPGD = ADDR_TO_PDE(address); + if(pPGD && ((*pPGD)&_PAGE_PRESENT)) + { + // not large page + if(!((*pPGD)&_PAGE_4M)) + { + pPTE = ADDR_TO_PTE(address); + if(pPTE) + { + LEAVE_FUNC(); + return pPTE; + } + } + // large page + else + { + LEAVE_FUNC(); + return NULL; + } + } + } + + LEAVE_FUNC(); + return NULL; +} + +//************************************************************************* +// InvalidateLB() +// +//************************************************************************* +void InvalidateLB(void) +{ + ENTER_FUNC(); + __asm__ __volatile__ + ( + "wbinvd\n\t \ + mov %%cr3,%%ecx\n\t \ + mov %%ecx,%%cr3" + :::"ecx" + ); + LEAVE_FUNC(); +} + +//************************************************************************* +// ReadPhysMem() +// +//************************************************************************* +ULONG ReadPhysMem(ULONG Address,ULONG ulSize) +{ + ULONG Page = ((ULONG)TwoPagesForPhysMem+_PAGE_SIZE)&~(_PAGE_SIZE-1); + PULONG pPTE; + ULONG temp = 0; + ULONG oldPTE; + + ENTER_FUNC(); + DPRINT((0,"ReadPhysMem(%.8X,%u)\n",Address,ulSize)); + DPRINT((0,"ReadPhysMem(): Page = %.8X\n",Page)); + pPTE = (PULONG)FindPteForLinearAddress(Page); + DPRINT((0,"ReadPhysMem(): pPTE = %.8X\n",pPTE)); + if(pPTE) + { + oldPTE = *pPTE; + DPRINT((0,"ReadPhysMem(): oldPTE = %.8X\n",oldPTE)); + temp = (Address & ~(_PAGE_SIZE-1)); + DPRINT((0,"ReadPhysMem(): page-aligned Address = %.8X\n",temp)); + *pPTE = temp|0x1; + DPRINT((0,"ReadPhysMem(): new PTE = %.8X\n",*pPTE)); + InvalidateLB(); + switch(ulSize) + { + case sizeof(UCHAR): // BYTE + temp = *(PUCHAR)(Page + (Address & (_PAGE_SIZE-1))); + temp = (UCHAR)temp; + break; + case sizeof(USHORT): // WORD + temp = *(PUSHORT)(Page + (Address & (_PAGE_SIZE-1))); + temp = (USHORT)temp; + break; + case sizeof(ULONG): // DWORD + temp = *(PULONG)(Page + (Address & (_PAGE_SIZE-1))); + break; + } + *pPTE = oldPTE; + InvalidateLB(); + } + LEAVE_FUNC(); + + return temp; +} + +//************************************************************************* +// WritePhysMem() +// +//************************************************************************* +void WritePhysMem(ULONG Address,ULONG Datum,ULONG ulSize) +{ + ULONG Page = ((ULONG)TwoPagesForPhysMem+_PAGE_SIZE)&~(_PAGE_SIZE-1); + PULONG pPTE; + ULONG temp; + ULONG oldPTE; + + pPTE = (PULONG)FindPteForLinearAddress(Page); + if(pPTE) + { + oldPTE = *pPTE; + temp = (Address & ~(_PAGE_SIZE-1)); + *pPTE = temp | 0x3; // present and writable + InvalidateLB(); + switch(ulSize) + { + case sizeof(UCHAR): // BYTE + *(PUCHAR)(Page + (Address & (_PAGE_SIZE-1))) = (UCHAR)Datum; + break; + case sizeof(USHORT): // WORD + *(PUSHORT)(Page + (Address & (_PAGE_SIZE-1))) = (USHORT)Datum; + break; + case sizeof(ULONG): // DWORD + *(PULONG)(Page + (Address & (_PAGE_SIZE-1))) = Datum; + break; + } + *pPTE = oldPTE; + InvalidateLB(); + } +} + +///////////////////////////////////////////////////////////////////////////// +unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) +{ + unsigned long result = 0,value; + + if (!base) { + base = 10; + if (*cp == '0') { + base = 8; + cp++; + if ((*cp == 'x') && PICE_isxdigit(cp[1])) { + cp++; + base = 16; + } + } + } + while (PICE_isxdigit(*cp) && (value = PICE_isdigit(*cp) ? *cp-'0' : (PICE_islower(*cp) + ? PICE_toupper(*cp) : *cp)-'A'+10) < base) { + result = result*base + value; + cp++; + } + if (endp) + *endp = (char *)cp; + return result; +} + +long simple_strtol(const char *cp,char **endp,unsigned int base) +{ + if(*cp=='-') + return -simple_strtoul(cp+1,endp,base); + return simple_strtoul(cp,endp,base); +} + +/* we use this so that we can do without the ctype library */ +#define is_digit(c) ((c) >= '0' && (c) <= '9') + +static int skip_atoi(const char **s) +{ + int i=0; + + while (is_digit(**s)) + i = i*10 + *((*s)++) - '0'; + return i; +} + +size_t PICE_strnlen(const char * s, size_t count) +{ + const char *sc; + + for (sc = s; count-- && IsAddressValid((ULONG)sc) && *sc != '\0'; ++sc) + /* nothing */; + return sc - s; +} + + +#define NUM_ZEROPAD 1 /* pad with zero */ +#define NUM_SIGN 2 /* unsigned/signed long */ +#define NUM_PLUS 4 /* show plus */ +#define NUM_SPACE 8 /* space if plus */ +#define NUM_LEFT 16 /* left justified */ +#define NUM_SPECIAL 32 /* 0x */ +#define NUM_LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ + +#define do_div(n,base) ({ \ +int __res; \ +__res = ((unsigned long) n) % (unsigned) base; \ +n = ((unsigned long) n) / (unsigned) base; \ +__res; }) + +static char * PICE_number(char * str, long num, int base, int size, int precision + ,int type) +{ + char c,sign,tmp[66]; + const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; + int i; + + if (type & NUM_LARGE) + digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + if (type & NUM_LEFT) + type &= ~NUM_ZEROPAD; + if (base < 2 || base > 36) + return 0; + c = (type & NUM_ZEROPAD) ? '0' : ' '; + sign = 0; + if (type & NUM_SIGN) { + if (num < 0) { + sign = '-'; + num = -num; + size--; + } else if (type & NUM_PLUS) { + sign = '+'; + size--; + } else if (type & NUM_SPACE) { + sign = ' '; + size--; + } + } + if (type & NUM_SPECIAL) { + if (base == 16) + size -= 2; + else if (base == 8) + size--; + } + i = 0; + if (num == 0) + tmp[i++]='0'; + else while (num != 0) + tmp[i++] = digits[do_div(num,base)]; + if (i > precision) + precision = i; + size -= precision; + if (!(type&(NUM_ZEROPAD+NUM_LEFT))) + while(size-->0) + *str++ = ' '; + if (sign) + *str++ = sign; + if (type & NUM_SPECIAL) { + if (base==8) + *str++ = '0'; + else if (base==16) { + *str++ = '0'; + *str++ = digits[33]; + } + } + if (!(type & NUM_LEFT)) + while (size-- > 0) + *str++ = c; + while (i < precision--) + *str++ = '0'; + while (i-- > 0) + *str++ = tmp[i]; + while (size-- > 0) + *str++ = ' '; + return str; +} + +/* Forward decl. needed for IP address printing stuff... */ +int PICE_sprintf(char * buf, const char *fmt, ...); + +int PICE_vsprintf(char *buf, const char *fmt, va_list args) +{ + int len; + unsigned long num; + int i, base; + char * str; + const char *s; + const wchar_t *sw; + + int flags; /* flags to PICE_number() */ + + int field_width; /* width of output field */ + int precision; /* min. # of digits for integers; max + PICE_number of chars for from string */ + int qualifier; /* 'h', 'l', or 'L' for integer fields */ + + for (str=buf ; *fmt ; ++fmt) { + if (*fmt != '%') { + *str++ = *fmt; + continue; + } + + /* process flags */ + flags = 0; + repeat: + ++fmt; /* this also skips first '%' */ + switch (*fmt) { + case '-': flags |= NUM_LEFT; goto repeat; + case '+': flags |= NUM_PLUS; goto repeat; + case ' ': flags |= NUM_SPACE; goto repeat; + case '#': flags |= NUM_SPECIAL; goto repeat; + case '0': flags |= NUM_ZEROPAD; goto repeat; + } + + /* get field width */ + field_width = -1; + if (is_digit(*fmt)) + field_width = skip_atoi(&fmt); + else if (*fmt == '*') { + ++fmt; + /* it's the next argument */ + field_width = va_arg(args, int); + if (field_width < 0) { + field_width = -field_width; + flags |= NUM_LEFT; + } + } + + /* get the precision */ + precision = -1; + if (*fmt == '.') { + ++fmt; + if (is_digit(*fmt)) + precision = skip_atoi(&fmt); + else if (*fmt == '*') { + ++fmt; + /* it's the next argument */ + precision = va_arg(args, int); + } + if (precision < 0) + precision = 0; + } + + /* get the conversion qualifier */ + qualifier = -1; + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { + qualifier = *fmt; + ++fmt; + } + + /* default base */ + base = 10; + + switch (*fmt) { + case 'c': + if (!(flags & NUM_LEFT)) + while (--field_width > 0) + *str++ = ' '; + *str++ = (unsigned char) va_arg(args, int); + while (--field_width > 0) + *str++ = ' '; + continue; + + case 's': + s = va_arg(args, char *); + if (!s) + s = ""; + + len = PICE_strnlen(s, precision); + + if (!(flags & NUM_LEFT)) + while (len < field_width--) + *str++ = ' '; + for (i = 0; i < len; ++i) + *str++ = *s++; + while (len < field_width--) + *str++ = ' '; + continue; + + case 'S': + if (qualifier == 'h') { + /* print ascii string */ + s = va_arg(args, char *); + if (s == NULL) + s = ""; + + len = PICE_strlen (s); + if ((unsigned int)len > (unsigned int)precision) + len = precision; + + if (!(flags & NUM_LEFT)) + while (len < field_width--) + *str++ = ' '; + for (i = 0; i < len; ++i) + *str++ = *s++; + while (len < field_width--) + *str++ = ' '; + } else { + /* print unicode string */ + sw = va_arg(args, wchar_t *); + if (sw == NULL) + sw = L""; + + len = wcslen (sw); + if ((unsigned int)len > (unsigned int)precision) + len = precision; + + if (!(flags & NUM_LEFT)) + while (len < field_width--) + *str++ = ' '; + for (i = 0; i < len; ++i) + *str++ = (unsigned char)(*sw++); + while (len < field_width--) + *str++ = ' '; + } + continue; + + case 'p': + if (field_width == -1) { + field_width = 2*sizeof(void *); + flags |= NUM_ZEROPAD; + } + str = PICE_number(str, + (unsigned long) va_arg(args, void *), 16, + field_width, precision, flags); + continue; + + + case 'n': + if (qualifier == 'l') { + long * ip = va_arg(args, long *); + *ip = (str - buf); + } else { + int * ip = va_arg(args, int *); + *ip = (str - buf); + } + continue; + + case '%': + *str++ = '%'; + continue; + + /* integer PICE_number formats - set up the flags and "break" */ + case 'o': + base = 8; + break; + + case 'X': + flags |= NUM_LARGE; + case 'x': + base = 16; + break; + + case 'd': + case 'i': + flags |= NUM_SIGN; + case 'u': + break; + + default: + *str++ = '%'; + if (*fmt) + *str++ = *fmt; + else + --fmt; + continue; + } + if (qualifier == 'l') + num = va_arg(args, unsigned long); + else if (qualifier == 'h') { + num = (unsigned short) va_arg(args, int); + if (flags & NUM_SIGN) + num = (short) num; + } else if (flags & NUM_SIGN) + num = va_arg(args, int); + else + num = va_arg(args, unsigned int); + str = PICE_number(str, num, base, field_width, precision, flags); + } + *str = '\0'; + return str-buf; +} + +int PICE_sprintf(char * buf, const char *fmt, ...) +{ + va_list args; + int i; + + va_start(args, fmt); + i = PICE_vsprintf(buf,fmt,args); + va_end(args); + return i; +} + +//************************************************************************* +// AsciiFromScan() +// +// Convert Scancode to ASCII +//************************************************************************* +UCHAR AsciiFromScan(UCHAR s) +{ + PSCANTOASCII table; + ULONG i; + + ENTER_FUNC(); + + if (bShift) + { + table = GetKeyboardLayout()->shifted; + } + else if(bAlt) + { + table = GetKeyboardLayout()->alted; + } + else + { + table = GetKeyboardLayout()->normal; + } + + + if (table) + { + for(i=0;table[i].s != 0;i++) + { + if(table[i].s==s) + { + LEAVE_FUNC(); + return table[i].a; + } + } + } + + DPRINT((0,"AsciiFromScan(): no translation for key\n")); + LEAVE_FUNC(); + return 0; +} + + +//************************************************************************* +// AsciiToScan() +// +// Convert Scancode to ASCII +//************************************************************************* +UCHAR AsciiToScan(UCHAR s) +{ + PSCANTOASCII table; + ULONG i; + + ENTER_FUNC(); + + if (bShift) + { + table = GetKeyboardLayout()->shifted; + } + else if(bAlt) + { + table = GetKeyboardLayout()->alted; + } + else + { + table = GetKeyboardLayout()->normal; + } + + if (table) + { + for(i=0;table[i].s != 0;i++) + { + if(table[i].a==s) + { + LEAVE_FUNC(); + return table[i].s; + } + } + } + + DPRINT((0,"AsciiToScan(): no translation for ASCII code\n")); + LEAVE_FUNC(); + return 0; +} + +//************************************************************************ +// outportb() +// +//************************************************************************ +void outportb(PUCHAR port,UCHAR data) +{ + WRITE_PORT_UCHAR((PUCHAR)port, data); +} + +void outb_p(UCHAR data, PUCHAR port) +{ + WRITE_PORT_UCHAR((PUCHAR)port, data); +} + +VOID outl(ULONG data, PULONG port) +{ + WRITE_PORT_ULONG(port, data); +} + + +//************************************************************************ +// inportb() +// +//************************************************************************ +UCHAR inportb(PUCHAR port) +{ + return READ_PORT_UCHAR((PUCHAR)port); +} + +UCHAR inb_p(PUCHAR port) +{ + return READ_PORT_UCHAR((PUCHAR)port); +} + +ULONG inl(PULONG port) +{ + return READ_PORT_ULONG(port); +} + +//************************************************************************* +// EnablePassThrough() +// +// enable MDA passthrough on AGP chipset +//************************************************************************* +void EnablePassThrough(void) +{ + ULONG oldCF8,flags; + + save_flags(flags); + cli(); + + oldCF8 = inl((PULONG)0xcf8); + outl(0x80000050,(PULONG)0xcf8); + outl(inl((PULONG)0xcfc)|0x00000020,(PULONG)0xcfc); + outl(oldCF8,(PULONG)0xcf8); + + restore_flags(flags); +} + +//*********************************************************************************** +// Pice_malloc - allocate memory from paged or non-paged pool +//*********************************************************************************** +void * PICE_malloc( size_t numBytes, BOOLEAN fromPaged ) +{ + void* res = ExAllocatePool( (fromPaged)?PagedPool:NonPagedPool, numBytes ); + ASSERT(res); + return res; +} + +//*********************************************************************************** +// PICE_free - free memory allocated by PICE_malloc +//*********************************************************************************** +void PICE_free( void* p ) +{ + ASSERT( p ); + ExFreePool( p ); +} + +long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes) +{ + DWORD NumberOfBytesRead; + IO_STATUS_BLOCK iosb; + + ASSERT( lpBuffer ); + + if (!NT_SUCCESS(NtReadFile( + (HANDLE) hFile, + NULL, NULL, NULL, &iosb, + (LPVOID) lpBuffer, + (DWORD) lBytes, + NULL, + NULL + ))) + { + return -1; + } + NumberOfBytesRead = iosb.Information; + return NumberOfBytesRead; +} + +HANDLE PICE_open (LPCWSTR lpPathName, int iReadWrite) +{ + DWORD dwAccessMask = 0; + DWORD dwShareMode = 0; + UNICODE_STRING TmpFileName; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK StatusBlock; + HANDLE hfile; + NTSTATUS status; + + + DPRINT((0,"PICE_open: %S\n", lpPathName)); + + if ( (iReadWrite & OF_READWRITE ) == OF_READWRITE ) + dwAccessMask = GENERIC_READ | GENERIC_WRITE; + else if ( (iReadWrite & OF_READ ) == OF_READ ) + dwAccessMask = GENERIC_READ; + else if ( (iReadWrite & OF_WRITE ) == OF_WRITE ) + dwAccessMask = GENERIC_WRITE; + + if ((iReadWrite & OF_SHARE_COMPAT) == OF_SHARE_COMPAT ) + dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE; + else if ((iReadWrite & OF_SHARE_DENY_NONE) == OF_SHARE_DENY_NONE) + dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE; + else if ((iReadWrite & OF_SHARE_DENY_READ) == OF_SHARE_DENY_READ) + dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_DELETE; + else if ((iReadWrite & OF_SHARE_DENY_WRITE) == OF_SHARE_DENY_WRITE ) + dwShareMode = FILE_SHARE_READ | FILE_SHARE_DELETE; + else if ((iReadWrite & OF_SHARE_EXCLUSIVE) == OF_SHARE_EXCLUSIVE) + dwShareMode = 0; + + RtlInitUnicodeString (&TmpFileName, lpPathName); + InitializeObjectAttributes(&ObjectAttributes, + &TmpFileName, + 0, + NULL, + NULL); + + status = NtOpenFile( &hfile, + dwAccessMask, + &ObjectAttributes, + &StatusBlock, dwShareMode, FILE_NO_INTERMEDIATE_BUFFERING); + //BUG BUG check status!!! + if( !NT_SUCCESS( status ) ){ + DPRINT((0,"PICE_open: NtOpenFile error: %x\n", status)); + return 0; + } + return hfile; +} + +int PICE_close (HANDLE hFile) +{ + if (NT_SUCCESS( ZwClose((HANDLE)hFile))) + { + return 0; + } + DPRINT((0,"ZwClose failed:\n")); + return -1; +} + +size_t PICE_len( HANDLE hFile ) +{ + FILE_STANDARD_INFORMATION fs; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + status = ZwQueryInformationFile( hFile, &iosb, &fs, sizeof fs, FileStandardInformation ); + if( !NT_SUCCESS( status ) ){ + DPRINT((0,"PICE_len: ZwQueryInformationFile error: %x\n", status)); + return 0; + } + //ASSERT(fs.EndOfFile.u.HighPart == 0); + return (size_t)fs.EndOfFile.u.LowPart; +} + +/* From kernel32 + * NOTE + * A raw converter for now. It assumes lpMultiByteStr is + * NEVER multi-byte (that is each input character is + * 8-bit ASCII) and is ALWAYS NULL terminated. + * FIXME-FIXME-FIXME-FIXME + */ + +INT +STDCALL +PICE_MultiByteToWideChar ( + UINT CodePage, + DWORD dwFlags, + LPCSTR lpMultiByteStr, + int cchMultiByte, + LPWSTR lpWideCharStr, + int cchWideChar + ) +{ + int InStringLength = 0; + BOOL InIsNullTerminated = TRUE; + PCHAR r; + PWCHAR w; + int cchConverted; + + /* + * Check the parameters. + */ + if ( /* --- CODE PAGE --- */ + ( (CP_ACP != CodePage) + && (CP_MACCP != CodePage) + && (CP_OEMCP != CodePage)) + /* --- FLAGS --- */ + /*|| (dwFlags ^ ( MB_PRECOMPOSED + | MB_COMPOSITE + | MB_ERR_INVALID_CHARS + | MB_USEGLYPHCHARS + ) + )*/ + /* --- INPUT BUFFER --- */ + || (NULL == lpMultiByteStr) + ) + { + DPRINT((0,"ERROR_INVALID_PARAMETER\n")); + return 0; + } + /* + * Compute the input buffer length. + */ + if (-1 == cchMultiByte) + { + InStringLength = PICE_strlen(lpMultiByteStr); + } + else + { + InIsNullTerminated = FALSE; + InStringLength = cchMultiByte; + } + /* + * Does caller query for output + * buffer size? + */ + if (0 == cchWideChar) + { + DPRINT((0,"ERROR_SUCCESS\n")); + return InStringLength; + } + /* + * Is space provided for the translated + * string enough? + */ + if (cchWideChar < InStringLength) + { + DPRINT((0,"ERROR_INSUFFICIENT_BUFFER: cchWideChar: %d, InStringLength: %d\n", cchWideChar, InStringLength)); + return 0; + } + /* + * Raw 8- to 16-bit conversion. + */ + for ( cchConverted = 0, + r = (PCHAR) lpMultiByteStr, + w = (PWCHAR) lpWideCharStr; + + ((*r) && (cchConverted < cchWideChar)); + + r++, w++, + cchConverted++ + ) + { + *w = (WCHAR) *r; + } + /* + * Is the input string NULL terminated? + */ + if (TRUE == InIsNullTerminated) + { + *w = L'\0'; + ++cchConverted; + } + /* + * Return how many characters we + * wrote in the output buffer. + */ + return cchConverted; +} + diff --git a/rosapps/sysutils/utils/pice/module/utils.h b/rosapps/sysutils/utils/pice/module/utils.h new file mode 100644 index 00000000000..902d2f5db93 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/utils.h @@ -0,0 +1,325 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + utils.h + +Abstract: + + HEADER for utils.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +#include +#include "../../../../ntoskrnl/include/internal/ps.h" +#define __STR(x) #x +#define STR(x) __STR(x) + +typedef enum { + kbDE, + kbUS, + kbDK, + kbMaximum +} KeyboardLayout; + +// scancode to ASCII conversion +typedef struct tagSCANTOASCII +{ + UCHAR s; // 0 terminates the table + UCHAR a; +}SCANTOASCII, *PSCANTOASCII; + +typedef struct tagKEYBOARD_LAYOUT +{ + LPSTR name; + PSCANTOASCII normal; + PSCANTOASCII shifted; + PSCANTOASCII alted; +} KEYBOARD_LAYOUT, *PKEYBOARD_LAYOUT; + +extern PKEYBOARD_LAYOUT CurrentKeyboard; + +typedef struct _FRAME +{ + ULONG error_code; + ULONG eip; + ULONG cs; + ULONG eflags; +}FRAME; + +#define SHOW_FIELD_BYTE(ptr,field,wait)\ +{\ + if(wait && WaitForKey()==FALSE)\ + return TRUE;\ + PICE_sprintf(tempCmd,#field" = %.2x\n",ptr->##field);\ + Print(OUTPUT_WINDOW,tempCmd);\ +} + +#define SHOW_FIELD_WORD(ptr,field,wait)\ +{\ + if(wait && WaitForKey()==FALSE)\ + return TRUE;\ + PICE_sprintf(tempCmd,#field" = %.4x\n",ptr->##field);\ + Print(OUTPUT_WINDOW,tempCmd);\ +} + +#define SHOW_FIELD_DWORD(ptr,field,wait)\ +{\ + if(wait && WaitForKey()==FALSE)\ + return TRUE;\ + PICE_sprintf(tempCmd,#field" = %.8x\n",ptr->##field);\ + Print(OUTPUT_WINDOW,tempCmd);\ +} + +#define SHOW_FIELD_SEG_OFS(ptr,field1,field2,wait)\ +{\ + if(wait && WaitForKey()==FALSE)\ + return TRUE;\ + PICE_sprintf(tempCmd,#field1":"#field2" = %.4x:%.8x\n",ptr->##field1,ptr->##field2);\ + Print(OUTPUT_WINDOW,tempCmd);\ +} + +typedef struct _PCI_NUMBER +{ + union { + struct + { + ULONG res2 : 2; + ULONG reg : 6; // 64 regs per function + ULONG func : 3; // 8 functions per device + ULONG dev : 5; // 32 device per bus + ULONG bus : 8; // 256 buses + ULONG res1 : 7; + ULONG ce : 1; // 1 to enable + }bits; + ULONG AsUlong; + }u; +}PCI_NUMBER; +/* +typedef struct _PCI_COMMON_CONFIG { + USHORT VendorID; // (ro) + USHORT DeviceID; // (ro) + USHORT Command; // Device control + USHORT Status; + UCHAR RevisionID; // (ro) + UCHAR ProgIf; // (ro) + UCHAR SubClass; // (ro) + UCHAR BaseClass; // (ro) + UCHAR CacheLineSize; // (ro+) + UCHAR LatencyTimer; // (ro+) + UCHAR HeaderType; // (ro) + UCHAR BIST; // Built in self test + ULONG BaseAddresses[6]; + ULONG CIS; + USHORT SubVendorID; + USHORT SubSystemID; + ULONG ROMBaseAddress; + UCHAR CapabilitiesPtr; + UCHAR Reserved1[3]; + ULONG Reserved2; + UCHAR InterruptLine; // + UCHAR InterruptPin; // (ro) + UCHAR MinimumGrant; // (ro) + UCHAR MaximumLatency; // (ro) +}PCI_COMMON_CONFIG; +*/ + +typedef struct tagPageDir +{ + ULONG P :1; + ULONG RW :1; + ULONG US :1; + ULONG PWT :1; + ULONG PCD :1; + ULONG A :1; + ULONG dummy :1; + ULONG PS :1; + ULONG G :1; + ULONG Avail :3; + ULONG PTBase :20; +}PAGEDIR,*PPAGEDIR; + +typedef struct tagGdt +{ + ULONG Limit_15_0 :16; + ULONG Base_15_0 :16; + ULONG Base_23_16 :8; + ULONG SegType :4; + ULONG DescType :1; + ULONG Dpl :2; + ULONG Present :1; + ULONG Limit_19_16 :4; + ULONG Avl :1; + ULONG Reserved :1; + ULONG DefOp :1; + ULONG Gran :1; + ULONG Base_31_24 :8; +}GDT,*PGDT; + +typedef struct tagIdt +{ + ULONG Offset_15_0 :16; + ULONG Selector :16; + ULONG Reserved :8; + ULONG DescType :5; + ULONG Dpl :2; + ULONG Present :1; + ULONG Offset_31_16 :16; +}IDT,*PIDT; + +typedef struct tagDESCRIPTOR +{ + USHORT Cpl :2; // current privilege level + USHORT Ti :1; // table index (GDT=0 LDT=1) + USHORT Val :13; // index into table +}DESCRIPTOR,*PDESCRIPTOR; + +PKEYBOARD_LAYOUT GetKeyboardLayout(); +PKEYBOARD_LAYOUT SetKeyboardLayoutByName(LPSTR Name); +void PICE_memset(void* p,unsigned char c,int sz); +void PICE_memcpy(void* t,void* s,int sz); +char *PICE_strrev(char *); +ULONG PICE_strcmp(char* s1,char* s2); +ULONG PICE_strcmpi(char* s1,char* s2); +ULONG PICE_strncmpi(char* s1,char* s2,ULONG len); +USHORT PICE_strlen(const char* s); +char* PICE_strcat(char* s1,char* s2); +BOOLEAN PICE_isprint(char c); +char* PICE_strcpy(char* s1,char* s2); +char* PICE_strncpy(char* s1,char* s2,int len); +char* PICE_strchr(char* s,char c); +int PICE_isdigit( int c ); +int PICE_isxdigit( int c ); +int PICE_islower( int c ); +int PICE_isalpha( int c ); + +int PICE_sprintf(char * buf, const char *fmt, ...); +int PICE_vsprintf(char *buf, const char *fmt, va_list args); + +BOOLEAN IsAddressValid(ULONG Addr); +BOOLEAN IsAddressWriteable(ULONG Addr); +BOOLEAN SetAddressWriteable(ULONG address,BOOLEAN bSet); +BOOLEAN IsRangeValid(ULONG addr,ULONG Length); +void IntelStackWalk(ULONG pc,ULONG ebp,ULONG esp); + +ULONG ReadPhysMem(ULONG Address,ULONG ulSize); +void WritePhysMem(ULONG Address,ULONG Datum,ULONG ulSize); + +BOOLEAN IsRetAtEIP(void); +BOOLEAN IsCallInstrAtEIP(void); + +ULONG GetLinearAddress(USHORT Segment,ULONG Offset); + +#define OUTPUT_BUFFER_FULL 0x01 +#define INPUT_BUFFER_FULL 0x02 +#define MOUSE_OUTPUT_BUFFER_FULL 0x20 + +void ShowStoppedMsg(void); +void ShowRunningMsg(void); + +void SetHardwareBreakPoints(void); +void SetHardwareBreakPoint(ULONG ulAddress,ULONG ulReg); + +// this should be in disasm.h but someone misused the header files +BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst); +////////////////////////////////////////////////////////////////// + +//segments defined in \include\napi\i386\segment.h +#define GLOBAL_CODE_SEGMENT (KERNEL_CS) +#define GLOBAL_DATA_SEGMENT (KERNEL_DS) + +//#define OVR_CS .byte 0x2e +//#define OVR_FS .byte 0x64 + +void DisplayRegs(void); +void SaveOldRegs(void); + +BOOLEAN CheckLoadAbort(void); + +UCHAR KeyboardGetKeyPolled(void); +void KeyboardFlushKeyboardQueue(void); + +#define _PAGE_PRESENT 0x001 +#define _PAGE_RW 0x002 +#define _PAGE_USER 0x004 +#define _PAGE_PWT 0x008 +#define _PAGE_PCD 0x010 +#define _PAGE_ACCESSED 0x020 +#define _PAGE_DIRTY 0x040 +#define _PAGE_PSE 0x080 +#define _PAGE_4M _PAGE_PSE +#define _PAGE_SIZE 0x1000 + + +UCHAR AsciiFromScan(UCHAR s); +UCHAR AsciiToScan(UCHAR s); + +void outportb(PUCHAR port,UCHAR data); +UCHAR inportb(PUCHAR port); + +void outb_p(UCHAR data, PUCHAR port); +UCHAR inb_p(PUCHAR port); + +VOID outl(ULONG l, PULONG port); +ULONG inl(PULONG port); + + +#define save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */) +#define restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc") +#define cli() __asm__ __volatile__("cli": : :"memory") +#define sti() __asm__ __volatile__("sti": : :"memory") + +#ifdef NDEBUG +#define ASSERT(x) +#else +#define ASSERT(x) if (!(x)) { DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__); KeBugCheck(0); } +#endif + +//extern unsigned long sys_call_table[]; + +//struct mm_struct *GetInitMm(void); + +PMADDRESS_SPACE my_init_mm; +LIST_ENTRY* pPsProcessListHead; + +void EnablePassThrough(void); + +#define PAGEDPOOL (1) +#define NONPAGEDPOOL (0) + +void * PICE_malloc( size_t numBytes, BOOLEAN fromPaged ); +void PICE_free( void* p ); + +HANDLE PICE_open (LPCWSTR lpPathName, int iReadWrite); +long PICE_read(HANDLE hFile, LPVOID lpBuffer, long lBytes); +int PICE_close (HANDLE hFile); +size_t PICE_len( HANDLE hFile ); +WCHAR * PICE_wcscpy(WCHAR * str1,const WCHAR * str2); +INT +STDCALL +PICE_MultiByteToWideChar ( + UINT CodePage, + DWORD dwFlags, + LPCSTR lpMultiByteStr, + int cchMultiByte, + LPWSTR lpWideCharStr, + int cchWideChar + ); diff --git a/rosapps/sysutils/utils/pice/module/vga.c b/rosapps/sysutils/utils/pice/module/vga.c new file mode 100644 index 00000000000..88d60f69a48 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/vga.c @@ -0,0 +1,572 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + vga.c + +Abstract: + + VGA HW dependent draw routines + +Environment: + + Kernel mode only + +Author: + + Klaus P. Gerlicher + Reactos Port by Eugene Ingerman + +Revision History: + + 04-Aug-1998: created + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//////////////////////////////////////////////////// +// INCLUDES +//// +#include "remods.h" +#include "precomp.h" + +//#include +//#include + + +//////////////////////////////////////////////////// +// PROTOTYPES +//// +extern void pice_save_current_registers(void); +extern void pice_restore_current_registers(void); +extern void pice_set_mode_3_80x50(void); +extern void pice_set_mode_3_80x25(void); + +extern UCHAR cGraphTable[8*256]; + +// storage for original VGA font +UCHAR cGraphTable2[16*256]; + +//////////////////////////////////////////////////// +// DEFINES +//// +#define VGA_EXTENDED // define this for 80x50 console mode + +#ifndef VGA_EXTENDED +#define SCREEN_BUFFER_SIZE (80*25*2) +#else +#define SCREEN_BUFFER_SIZE (80*50*2) +#endif + +/* Port addresses of control regs */ +#define MISCOUTPUT 0x3c2 +#define FEATURECONTROL 0x3da +#define SEQUENCER 0x3c4 +#define CRTC 0x03d4 +#define GRAPHICS 0x3ce +#define ATTRIBS 0x03c0 +#define PELADDRESSWRITE 0x3c8 +#define PELDATAREG 0x3c9 + +/* Number of regs on the various controllers */ + +#define MAXSEQ 5 +#define MAXCRTC 0x19 +#define MAXGRAPH 0x9 +#define MAXATTRIB 0x015 + +//////////////////////////////////////////////////// +// GLOBALS +//// +// used for HERCULES text and VGA text mode +WINDOW wWindowVga[4]= +#ifndef VGA_EXTENDED +{ + {1,3,1,0,FALSE}, + {5,4,1,0,FALSE}, + {10,9,1,0,FALSE}, + {20,4,1,0,FALSE} +}; +#else // VGA_EXTENDED +{ + {1,3,1,0,FALSE}, + {5,4,1,0,FALSE}, + {10,24,1,0,FALSE}, + {35,14,1,0,FALSE} +}; +#endif // VGA_EXTENDED + +PUCHAR pScreenBufferVga; +PUCHAR pScreenBufferSaveVga = NULL; +PUCHAR pScreenBufferTempVga; +PUCHAR pScreenBufferHardwareVga; +PUCHAR pFontBufferVga = NULL; + +UCHAR offset_a = 0; +UCHAR offset_c = 0,offset_d = 0; +UCHAR offset_e = 0,offset_f = 0; + +struct _attr +{ + union + { + struct + { + + UCHAR fgcol : 4; + UCHAR bkcol : 3; + UCHAR blink : 1; + }bits; + UCHAR Asuchar; + }u; +}attr; + +unsigned char oldgraphicsmode; +unsigned char oldgraphicsmisc; +unsigned char oldsqregmapmask; +unsigned char oldsqregmemory; +unsigned char oldgraphicssetresetenable; +unsigned char oldgraphicsreadmapsel; + +unsigned char read_vga_reg(int port, int reg) +{ + outportb(port,reg); + return(inportb(port+1)); +} + +void write_vga_reg(int port, unsigned char reg, unsigned char value) +{ + outportb(port,reg); + outportb(port+1,value); +} + +/* Registers within controllers */ +#define VREND 0x11 +#define GRREGSETRESET 0 +#define GRREGENABLESETRESET 1 +#define GRREGREADMAPSEL 4 +#define SQREGMAPMASK 2 +#define SQREGMEMORY 4 +#define GRREGWRMODE 5 +#define GRREGMISC 6 + +void map_font_memory(void) +{ + oldgraphicssetresetenable = read_vga_reg(GRAPHICS, GRREGENABLESETRESET); + oldgraphicsmode = read_vga_reg(GRAPHICS, GRREGWRMODE); + oldgraphicsmisc = read_vga_reg(GRAPHICS, GRREGMISC); + oldgraphicsreadmapsel = read_vga_reg(GRAPHICS, GRREGREADMAPSEL); + oldsqregmapmask = read_vga_reg(SEQUENCER, SQREGMAPMASK); + oldsqregmemory = read_vga_reg(SEQUENCER, SQREGMEMORY); + + + /* Make sure set/reset enable is off */ + write_vga_reg(GRAPHICS,GRREGENABLESETRESET,0); + /* Select read plane 2 */ + write_vga_reg(GRAPHICS,GRREGREADMAPSEL,0x02); + /* Make sure write and read mode = 0 */ + write_vga_reg(GRAPHICS,GRREGWRMODE,0x00); + /* Set mapping to 64K at a000:0 & turn off odd/even at the graphics reg */ + write_vga_reg(GRAPHICS,GRREGMISC, 0x04); + /* Set sequencer plane to 2 */ + write_vga_reg(SEQUENCER,SQREGMAPMASK, 0x04); + /* Turn off odd/even at the sequencer */ + write_vga_reg(SEQUENCER,SQREGMEMORY, 0x07); +} + +void unmap_font_memory(void) +{ + write_vga_reg(GRAPHICS,GRREGENABLESETRESET,oldgraphicssetresetenable); + write_vga_reg(GRAPHICS,GRREGWRMODE,oldgraphicsmode); + write_vga_reg(GRAPHICS,GRREGREADMAPSEL,oldgraphicsreadmapsel); + write_vga_reg(GRAPHICS,GRREGMISC, oldgraphicsmisc); + write_vga_reg(SEQUENCER,SQREGMAPMASK, oldsqregmapmask); + write_vga_reg(SEQUENCER,SQREGMEMORY, oldsqregmemory); +} + +/* Font and palette constants */ +#define BYTESPERFONT 8 +#define FONTENTRIES 256 +#define FONTBUFFERSIZE 8192 + +void save_font(UCHAR* graph_table) +{ + PUCHAR FontBase = pFontBufferVga; + int i,j; + map_font_memory(); + + for (i=0; i < FONTENTRIES; i++) + for (j=0; j < 16; j++) + graph_table[i*16+j] = FontBase[i*32+j]; + + unmap_font_memory(); +} + +void load_font(UCHAR* graph_table,int bEnter) +{ + PUCHAR FontBase = pFontBufferVga; + int i,j; + map_font_memory(); + + if(bEnter) + { +#ifdef VGA_EXTENDED + for (i=0; i < FONTENTRIES; i++) + for (j=0; j < 8; j++) + FontBase[i*32+j] = graph_table[i*BYTESPERFONT+j]; +#else // VGA_EXTENDED + for (i=0; i < FONTENTRIES; i++) + for (j=0; j < 16; j++) + FontBase[i*32+j] = graph_table[i*BYTESPERFONT+(j/2)] << (j&1); +#endif // VGA_EXTENDED + } + else + { + for (i=0; i < FONTENTRIES; i++) + for (j=0; j < 16; j++) + FontBase[i*32+j] = graph_table[i*16+j]; + } + + unmap_font_memory(); +} + +//************************************************************************* +// SetForegroundColorVga() +// +//************************************************************************* +void SetForegroundColorVga(ECOLORS col) +{ + attr.u.bits.fgcol = col; + attr.u.bits.blink = 0; +} + +//************************************************************************* +// SetBackgroundColorVga() +// +//************************************************************************* +void SetBackgroundColorVga(ECOLORS col) +{ + attr.u.bits.bkcol = col; + attr.u.bits.blink = 0; +} + +//************************************************************************* +// PrintGrafVga() +// +//************************************************************************* +void PrintGrafVga(ULONG x,ULONG y,UCHAR c) +{ + ((PUSHORT)pScreenBufferVga)[y*GLOBAL_SCREEN_WIDTH + x] = (USHORT)((attr.u.Asuchar<<8)|c); +} + +//************************************************************************* +// ShowCursor() +// +// show hardware cursor +//************************************************************************* +void ShowCursorVga(void) +{ + ENTER_FUNC(); + + bCursorEnabled=TRUE; + + outb_p(0x0a,0x3d4); + outb_p(inb_p(0x3d5)&~0x20,0x3d5); + + LEAVE_FUNC(); +} + +//************************************************************************* +// HideCursorVga() +// +// hide hardware cursor +//************************************************************************* +void HideCursorVga(void) +{ + ENTER_FUNC(); + bCursorEnabled=FALSE; + + outb_p(0x0a,0x3d4); + outb_p(inb_p(0x3d5)|0x20,0x3d5); + + LEAVE_FUNC(); +} + +//************************************************************************* +// CopyLineTo() +// +// copy a line from src to dest +//************************************************************************* +void CopyLineToVga(USHORT dest,USHORT src) +{ + PUSHORT p = (PUSHORT)pScreenBufferVga; + + ENTER_FUNC(); + + PICE_memcpy(&p[dest*GLOBAL_SCREEN_WIDTH],&p[src*GLOBAL_SCREEN_WIDTH],GLOBAL_SCREEN_WIDTH*sizeof(USHORT)); + + LEAVE_FUNC(); +} + +//************************************************************************* +// InvertLineVga() +// +// invert a line on the screen +//************************************************************************* +void InvertLineVga(ULONG line) +{ + ULONG i; + PUSHORT p = (PUSHORT)pScreenBufferVga; + USHORT attr; + + if(line < GLOBAL_SCREEN_HEIGHT) + { + attr = p[line*GLOBAL_SCREEN_WIDTH]>>8; + attr = ((attr & 0x07)<<4) | ((attr & 0xF0)>>4); + attr <<= 8; + for(i=0;i250 ) + { + count=0; + + charoffset = (y* GLOBAL_SCREEN_WIDTH + x); + + outb_p(0x0e,0x3d4); + data=(UCHAR)((charoffset>>8)&0xFF); + outb_p(data,0x3d5); + + outb_p(0x0f,0x3d4); + data=(UCHAR)(charoffset & 0xFF); + outb_p(data,0x3d5); + } +} + +//************************************************************************* +// SaveGraphicsVga() +// +//************************************************************************* +void SaveGraphicsStateVga(void) +{ + UCHAR data; + + // save current regs + pice_save_current_registers(); + + // unprotect crtc regs 0-7 + outb_p(0x11,0x3d4); + data = inb_p(0x3d5); + outb_p(data & 0x7F,0x3d5); + + // save current font + save_font(cGraphTable2); + + // restore original regs +#ifdef VGA_EXTENDED + pice_set_mode_3_80x50(); +#else + pice_set_mode_3_80x25(); +#endif + + // load a font + load_font(cGraphTable,1); + + // copy the screen content to temp area + PICE_memcpy(pScreenBufferTempVga,pScreenBufferHardwareVga,SCREEN_BUFFER_SIZE); + // copy the console to the screen + PICE_memcpy(pScreenBufferHardwareVga,pScreenBufferVga,SCREEN_BUFFER_SIZE); + // save original pointer + pScreenBufferSaveVga = pScreenBufferVga; + // pScreenBufferVga now points to screen + pScreenBufferVga = pScreenBufferHardwareVga; +} + +//************************************************************************* +// RestoreGraphicsStateVga() +// +//************************************************************************* +void RestoreGraphicsStateVga(void) +{ + UCHAR data; + + // unprotect crtc regs 0-7 + outb_p(0x11,0x3d4); + data = inb_p(0x3d5); + outb_p(data & 0x7F,0x3d5); + + // restore original regs + pice_restore_current_registers(); + + // load a font + load_font(cGraphTable2,0); + + pScreenBufferVga = pScreenBufferSaveVga; + // copy screen to the console + PICE_memcpy(pScreenBufferVga,pScreenBufferHardwareVga,SCREEN_BUFFER_SIZE); + // copy the temp area to the screen + PICE_memcpy(pScreenBufferHardwareVga,pScreenBufferTempVga,SCREEN_BUFFER_SIZE); +} + +//************************************************************************* +// ConsoleInitVga() +// +// init terminal screen +//************************************************************************* +BOOLEAN ConsoleInitVga(void) +{ + BOOLEAN bResult = FALSE; + PUSHORT p; + PHYSICAL_ADDRESS FrameBuffer; + PHYSICAL_ADDRESS FontBuffer; + + + ENTER_FUNC(); + + ohandlers.CopyLineTo = CopyLineToVga; + ohandlers.PrintGraf = PrintGrafVga; + ohandlers.ClrLine = ClrLineVga; + ohandlers.InvertLine = InvertLineVga; + ohandlers.HatchLine = HatchLineVga; + ohandlers.PrintLogo = PrintLogoVga; + ohandlers.PrintCursor = PrintCursorVga; + ohandlers.SaveGraphicsState = SaveGraphicsStateVga; + ohandlers.RestoreGraphicsState = RestoreGraphicsStateVga; + ohandlers.ShowCursor = ShowCursorVga; + ohandlers.HideCursor = HideCursorVga; + ohandlers.SetForegroundColor = SetForegroundColorVga; + ohandlers.SetBackgroundColor = SetBackgroundColorVga; + + ihandlers.GetKeyPolled = KeyboardGetKeyPolled; + ihandlers.FlushKeyboardQueue = KeyboardFlushKeyboardQueue; + + SetWindowGeometry(wWindowVga); + + GLOBAL_SCREEN_WIDTH = 80; +#ifndef VGA_EXTENDED + GLOBAL_SCREEN_HEIGHT = 25; +#else // VGA_EXTENDED + GLOBAL_SCREEN_HEIGHT = 50; +#endif // VGA_EXTENDED + + attr.u.Asuchar = 0x07; + + // the real framebuffer + FrameBuffer.u.LowPart = 0xB8000; + pScreenBufferHardwareVga = MmMapIoSpace(FrameBuffer,SCREEN_BUFFER_SIZE,MmNonCached); + + //The real font buffer + FontBuffer.u.LowPart = 0xA0000; + pFontBufferVga = MmMapIoSpace(FontBuffer,FONTBUFFERSIZE,MmNonCached); + + // the console + pScreenBufferVga = PICE_malloc(SCREEN_BUFFER_SIZE,NONPAGEDPOOL); + // the save area + pScreenBufferTempVga = PICE_malloc(SCREEN_BUFFER_SIZE,NONPAGEDPOOL); + + if(pScreenBufferVga) + { + DPRINT((0,"VGA memory phys. 0x000b0000 mapped to virt. 0x%x\n",pScreenBufferVga)); + + bResult = TRUE; + + p = (PUSHORT)pScreenBufferVga; + + PICE_memset(pScreenBufferVga,0x0,SCREEN_BUFFER_SIZE); + + DPRINT((0,"VGA memory cleared!\n")); + + EmptyRingBuffer(); + + DPRINT((0,"ConsoleInitVga() SUCCESS!\n")); + } + + LEAVE_FUNC(); + + return bResult; +} + +//************************************************************************* +// ConsoleShutdownVga() +// +// exit terminal screen +//************************************************************************* +void ConsoleShutdownVga(void) +{ + ENTER_FUNC(); + + if(pScreenBufferVga) + { + PICE_free(pScreenBufferVga); + PICE_free(pScreenBufferTempVga); + MmUnmapIoSpace(pScreenBufferHardwareVga,SCREEN_BUFFER_SIZE); + MmUnmapIoSpace(pFontBufferVga,FONTBUFFERSIZE); + } + + LEAVE_FUNC(); +} + + diff --git a/rosapps/sysutils/utils/pice/module/vga.h b/rosapps/sysutils/utils/pice/module/vga.h new file mode 100644 index 00000000000..ec3e1d798cb --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/vga.h @@ -0,0 +1,32 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + vga.h + +Abstract: + + HEADER for vga.c + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + +Revision History: + + 15-Nov-2000: general cleanup of source files + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ +BOOLEAN ConsoleInitVga(void); +void ConsoleShutdownVga(void); diff --git a/rosapps/sysutils/utils/pice/module/vga_utils.asm b/rosapps/sysutils/utils/pice/module/vga_utils.asm new file mode 100644 index 00000000000..96028177db2 --- /dev/null +++ b/rosapps/sysutils/utils/pice/module/vga_utils.asm @@ -0,0 +1,729 @@ +;/*++ +; +;Copyright (c) 1998-2001 Klaus P. Gerlicher +; +;Module Name: +; +; vga_utils.asm +; +;Abstract: +; +; assembler function for directly programming standard VGA +; +;Environment: +; +; LINUX 2.2.X +; Kernel mode only +; +;Author: +; +; Klaus P. Gerlicher +; Reactos Port by Eugene Ingerman +; +;Revision History: +; +; 30-Oct-2001: created +; +;Copyright notice: +; +; This file may be distributed under the terms of the GNU Public License. +; +;--*/ + +global _pice_save_current_registers +global _pice_restore_current_registers +global _pice_set_mode_3_80x50 +global _pice_set_mode_3_80x25 + +;**************************************************************************** +;* some assign's ************************************************************ +;**************************************************************************** +%assign VGA_CRT_REGISTERS 24 +%assign VGA_ATTRIBUTE_REGISTERS 21 +%assign VGA_GRAPHIC_REGISTERS 9 +%assign VGA_SEQUENCER_REGISTERS 5 +%assign VGA_MISC_REGISTERS 1 + +%assign VGA_IO_BASE 03c0h +%assign VGA_IO_SIZE 020h + +%assign VGA_ATTRIBUTE_INDEX 03c0h +%assign VGA_ATTRIBUTE_DATA_WRITE 03c0h +%assign VGA_ATTRIBUTE_DATA_READ 03c1h +%assign VGA_MISC_DATA_WRITE 03c2h +%assign VGA_SEQUENCER_INDEX 03c4h +%assign VGA_SEQUENCER_DATA 03c5h +%assign VGA_PEL_MASK 03c6h +%assign VGA_PEL_INDEX_READ 03c7h +%assign VGA_PEL_INDEX_WRITE 03c8h +%assign VGA_PEL_DATA 03c9h +%assign VGA_MISC_DATA_READ 03cch +%assign VGA_GRAPHIC_INDEX 03ceh +%assign VGA_GRAPHIC_DATA 03cfh +%assign VGA_CRT_INDEX 03d4h +%assign VGA_CRT_DATA 03d5h +%assign VGA_INPUT_STATUS 03dah + +section .data +pice_mode3_80x50_registers: +; offsets 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 +.crt: db 0x5f,0x4f,0x50,0x82,0x55,0x80,0xbf,0x1f,0x00,0x67,0x06,0x07,0x00,0x00,0x00,0x00,0x9c,0x8f,0x8f,0x28,0x1f,0x96,0xb9,0xa3,0xff +.attribute db 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x08,0x00,0x0f,0x00,0x00 +.graphic: db 0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,0xff +.sequencer: db 0x03,0x00,0x03,0x00,0x02 ; 9 bits per char +;.sequencer: db 0x03,0x01,0x03,0x00,0x02 ; 8 bits per char +.misc: db 0x67 + +pice_mode3_80x25_registers: +; offsets 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 +.crt: db 0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,0x00,0x4f,0x0d,0x0e,0x00,0x00,0x30,0xe8,0x9c,0x0e,0x8f,0x28,0x1f,0x96,0xb9,0xa3 +.attribute db 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x0c,0x00,0x0f,0x08,0x00 +.graphic: db 0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,0xff +.sequencer: db 0x03,0x00,0x03,0x00,0x02 +.misc: db 0x67 + + + +section .bss +pice_current_registers: +.crt: resb VGA_CRT_REGISTERS +.attribute: resb VGA_ATTRIBUTE_REGISTERS +.graphic: resb VGA_GRAPHIC_REGISTERS +.sequencer: resb VGA_SEQUENCER_REGISTERS +.misc: resb VGA_MISC_REGISTERS + align 4 +.colormap: resd 256 + +;**************************************************************************** +;* pice_save_current_charset ************************************************ +;**************************************************************************** +section .text +pice_address dd 0xc00a0000 +pice_save_current_charset: + xor dword ebx, ebx + call pice_select_read_plane + mov dword ecx, 04000h + mov dword esi, [pice_address] + mov dword edi, pice_charset_saved + cld + rep movsd + mov dword ebx, 00100h + call pice_select_read_plane + mov dword ecx, 04000h + mov dword esi, [pice_address] + mov dword edi, (pice_charset_saved + 010000h) + cld + rep movsd + mov dword ebx, 00200h + call pice_select_read_plane + mov dword ecx, 04000h + mov dword esi, [pice_address] + mov dword edi, (pice_charset_saved + 020000h) + cld + rep movsd + mov dword ebx, 00300h + call pice_select_read_plane + mov dword ecx, 04000h + mov dword esi, [pice_address] + mov dword edi, (pice_charset_saved + 030000h) + cld + rep movsd +.end: ret + + + +;**************************************************************************** +;* pice_restore_current_charset **************************************************** +;**************************************************************************** +section .text +pice_restore_current_charset: + mov dword ebx, 00100h + call pice_select_write_plane + mov dword ecx, 04000h + mov dword esi, pice_charset_saved + mov dword edi, [pice_address] + cld + rep movsd + mov dword ebx, 00200h + call pice_select_write_plane + mov dword ecx, 04000h + mov dword esi, (pice_charset_saved + 010000h) + mov dword edi, [pice_address] + cld + rep movsd + mov dword ebx, 00400h + call pice_select_write_plane + mov dword ecx, 04000h + mov dword esi, (pice_charset_saved + 020000h) + mov dword edi, [pice_address] + cld + rep movsd + mov dword ebx, 00800h + call pice_select_write_plane + mov dword ecx, 04000h + mov dword esi, (pice_charset_saved + 030000h) + mov dword edi, [pice_address] + cld + rep movsd +.end: ret + +;**************************************************************************** +;* pice_get_crt_registers ************************************************** +;**************************************************************************** +;* ebx=> pointer where to store crt registers +;**************************************************************************** +section .text +pice_get_crt_registers: + xor dword ecx, ecx +.loop: mov dword edx, VGA_CRT_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_CRT_DATA + in byte al, dx + mov byte [ebx + ecx], al + inc dword ecx + cmp dword ecx, VGA_CRT_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_get_attribute_registers ******************************************** +;**************************************************************************** +;* ebx=> pointer where to store attribute registers +;**************************************************************************** +section .text +pice_get_attribute_registers: + xor dword ecx, ecx +.loop: mov dword edx, VGA_INPUT_STATUS + in byte al, dx + mov dword edx, VGA_ATTRIBUTE_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_ATTRIBUTE_DATA_READ + in byte al, dx + mov byte [ebx + ecx], al + inc dword ecx + cmp dword ecx, VGA_ATTRIBUTE_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_get_graphic_registers ********************************************** +;**************************************************************************** +;* ebx=> pointer where to store graphics registers +;**************************************************************************** +section .text +pice_get_graphic_registers: + xor dword ecx, ecx +.loop: mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + in byte al, dx + mov byte [ebx + ecx], al + inc dword ecx + cmp dword ecx, VGA_GRAPHIC_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_get_sequencer_registers ******************************************** +;**************************************************************************** +;* ebx=> pointer where to store sequencer registers +;**************************************************************************** +section .text +pice_get_sequencer_registers: + xor dword ecx, ecx +.loop: mov dword edx, VGA_SEQUENCER_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + in byte al, dx + mov byte [ebx + ecx], al + inc dword ecx + cmp dword ecx, VGA_SEQUENCER_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_get_misc_registers ************************************************* +;**************************************************************************** +;* ebx=> pointer where to store misc register +;**************************************************************************** +section .text +pice_get_misc_registers: + mov dword edx, VGA_MISC_DATA_READ + in byte al, dx + mov byte [ebx], al + ret + + + +;**************************************************************************** +;* pice_get_colormap ******************************************************* +;**************************************************************************** +;* ebx=> pointer where to store colormap +;**************************************************************************** +section .text +pice_get_colormap: + xor dword ecx, ecx + xor dword eax, eax + mov dword edx, VGA_PEL_INDEX_READ + out word dx, al + mov dword edx, VGA_PEL_DATA +.loop: in byte al, dx + shl dword eax, 8 + in byte al, dx + shl dword eax, 8 + in byte al, dx + mov dword [ebx + 4 * ecx], eax + inc dword ecx + test byte cl, cl + jnz .loop + ret + + + +;**************************************************************************** +;* pice_set_crt_registers ************************************************** +;**************************************************************************** +;* ebx=> pointer to stored crt registers +;**************************************************************************** +section .text +pice_set_crt_registers: + + ;deprotect CRT registers 0 - 7 + + mov dword edx, VGA_CRT_INDEX + mov byte al, 011h + out word dx, al + mov dword edx, VGA_CRT_DATA + in byte al, dx + and byte al, 07fh + out word dx, al + + ;write to the registers + + xor dword ecx, ecx +.loop: mov dword edx, VGA_CRT_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_CRT_DATA + mov byte al, [ebx + ecx] + out word dx, al + inc dword ecx + cmp dword ecx, VGA_CRT_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_set_attribute_registers ******************************************** +;**************************************************************************** +;* ebx=> pointer to stored attibute registers +;**************************************************************************** +section .text +pice_set_attribute_registers: + xor dword ecx, ecx +.loop: mov dword edx, VGA_INPUT_STATUS + in byte al, dx + mov dword edx, VGA_ATTRIBUTE_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_ATTRIBUTE_DATA_WRITE + mov byte al, [ebx + ecx] + out word dx, al + inc dword ecx + cmp dword ecx, VGA_ATTRIBUTE_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_set_graphic_registers ********************************************** +;**************************************************************************** +;* ebx=> pointer to stored graphic registers +;**************************************************************************** +section .text +pice_set_graphic_registers: + xor dword ecx, ecx +.loop: mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + mov byte al, [ebx + ecx] + out word dx, al + inc dword ecx + cmp dword ecx, VGA_GRAPHIC_REGISTERS + jb .loop + ret + + + +;**************************************************************************** +;* pice_set_sequencer_registers ******************************************** +;**************************************************************************** +;* ebx=> pointer to stored sequencer registers +;**************************************************************************** +section .text +pice_set_sequencer_registers: + + ;synchronous reset on + + mov dword edx, VGA_SEQUENCER_INDEX + xor dword eax, eax + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + inc dword eax + out word dx, al + + ;write to the registers + + mov dword edx, VGA_SEQUENCER_INDEX + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + mov byte al, [ebx + 1] + or byte al, 020h + out word dx, al + mov dword ecx, 2 +.loop: mov dword edx, VGA_SEQUENCER_INDEX + mov byte al, cl + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + mov byte al, [ebx + ecx] + out word dx, al + inc dword ecx + cmp dword ecx, VGA_SEQUENCER_REGISTERS + jb .loop + + ;synchronous reset off + + mov dword edx, VGA_SEQUENCER_INDEX + xor dword eax, eax + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + mov byte al, 3 + out word dx, al + ret + + + +;**************************************************************************** +;* pice_set_misc_registers ************************************************* +;**************************************************************************** +;* ebx=> pointer to stored misc register +;**************************************************************************** +section .text +pice_set_misc_registers: + mov dword edx, VGA_MISC_DATA_WRITE + mov byte al, [ebx] + out word dx, al + ret + + + +;**************************************************************************** +;* pice_set_colormap ******************************************************* +;**************************************************************************** +;* ebx=> pointer to stored colormap +;**************************************************************************** +section .text +pice_set_colormap: + xor dword ecx, ecx + xor dword eax, eax + mov dword edx, VGA_PEL_INDEX_WRITE + out word dx, al + mov dword edx, VGA_PEL_DATA +.loop: mov dword eax, [ebx + 4 * ecx] + rol dword eax, 16 + out word dx, al + rol dword eax, 8 + out word dx, al + rol dword eax, 8 + out word dx, al + inc dword ecx + test byte cl, cl + jnz .loop + ret + + + +;**************************************************************************** +;* pice_screen_on ********************************************************** +;**************************************************************************** +section .text +pice_screen_on: + + ;turn on the screen + + mov dword edx, VGA_SEQUENCER_INDEX + mov byte al, 1 + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + in byte al, dx + and byte al, 0dfh + out word dx, al + + ;enable video output + + mov dword edx, VGA_INPUT_STATUS + in byte al, dx + mov dword edx, VGA_ATTRIBUTE_DATA_WRITE + mov byte al, 020h + out word dx, al + ret + +;**************************************************************************** +;* pice_select_write_plane ************************************************* +;**************************************************************************** +;* bl==> write mode +;* bh==> write plane +;**************************************************************************** +section .text +pice_select_write_plane: + and dword ebx, 00f03h + + ;enable set/reset = 0 + + mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, 1 + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + xor dword eax, eax + out word dx, al + + ;logical operation = none, rotate = 0 + + mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, 3 + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + xor dword eax, eax + out word dx, al + + ;select write mode + + mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, 5 + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + in byte al, dx + and byte al, 0fch + or byte al, bl + out word dx, al + + ;bitmask = 0ffh + + mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, 8 + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + mov byte al, 0ffh + out word dx, al + + ;select write plane + + mov dword edx, VGA_SEQUENCER_INDEX + mov byte al, 2 + out word dx, al + mov dword edx, VGA_SEQUENCER_DATA + mov byte al, bh + out word dx, al + ret + + + +;**************************************************************************** +;* pice_select_read_plane ************************************************** +;**************************************************************************** +;* bl==> read mode +;* bh==> read plane +;**************************************************************************** +section .text +pice_select_read_plane: + and dword ebx, 00301h + shl byte bl, 3 + + ;select read mode + + mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, 5 + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + in byte al, dx + and byte al, 0f7h + or byte al, bl + out word dx, al + + ;select read plane + + mov dword edx, VGA_GRAPHIC_INDEX + mov byte al, 4 + out word dx, al + mov dword edx, VGA_GRAPHIC_DATA + mov byte al, bh + out word dx, al + ret + + + +;**************************************************************************** +;* pice_save_current_registers ********************************************** +;**************************************************************************** +section .text +_pice_save_current_registers: + push esi + push edi + push ebx + +; call pice_save_current_charset + +.crt: mov dword ebx, pice_current_registers.crt + call pice_get_crt_registers + +.attribute: mov dword ebx, pice_current_registers.attribute + call pice_get_attribute_registers + +.graphic: mov dword ebx, pice_current_registers.graphic + call pice_get_graphic_registers + +.sequencer: mov dword ebx, pice_current_registers.sequencer + call pice_get_sequencer_registers + +.misc: mov dword ebx, pice_current_registers.misc + call pice_get_misc_registers + +.colormap: mov dword ebx, pice_current_registers.colormap + call pice_get_colormap + + pop ebx + pop edi + pop esi +.end: ret + +;**************************************************************************** +;* pice_restore_current_registers ******************************************* +;**************************************************************************** +section .text +_pice_restore_current_registers: + push esi + push edi + push ebx + +; call pice_restore_current_charset + +.misc: mov dword ebx, pice_current_registers.misc + call pice_set_misc_registers + +.crt: mov dword ebx, pice_current_registers.crt + call pice_set_crt_registers + +.attribute: mov dword ebx, pice_current_registers.attribute + call pice_set_attribute_registers + +.graphic: mov dword ebx, pice_current_registers.graphic + call pice_set_graphic_registers + +.sequencer: mov dword ebx, pice_current_registers.sequencer + call pice_set_sequencer_registers + +.screen_on: call pice_screen_on + +.colormap: mov dword ebx, pice_current_registers.colormap + call pice_set_colormap + + pop ebx + pop edi + pop esi + +.end: ret + + +;**************************************************************************** +;* pice_set_mode_3_80x50***************************************************** +;**************************************************************************** +section .text +_pice_set_mode_3_80x50: + push esi + push edi + push ebx + +.crt: mov dword ebx, pice_mode3_80x50_registers.crt + call pice_set_crt_registers + +.attribute: mov dword ebx, pice_mode3_80x50_registers.attribute + call pice_set_attribute_registers + +.graphic: mov dword ebx, pice_mode3_80x50_registers.graphic + call pice_set_graphic_registers + +.sequencer: mov dword ebx, pice_mode3_80x50_registers.sequencer + call pice_set_sequencer_registers + +.misc: mov dword ebx, pice_mode3_80x50_registers.misc + call pice_set_misc_registers + +.screen_on: call pice_screen_on + +;.colormap: mov dword ebx, pice_current_registers.colormap +; call pice_set_colormap + + pop ebx + pop edi + pop esi + +.end: ret + +;**************************************************************************** +;* pice_set_mode_3_80x25***************************************************** +;**************************************************************************** +section .text +_pice_set_mode_3_80x25: + push esi + push edi + push ebx + +.crt: mov dword ebx, pice_mode3_80x25_registers.crt + call pice_set_crt_registers + +.attribute: mov dword ebx, pice_mode3_80x25_registers.attribute + call pice_set_attribute_registers + +.graphic: mov dword ebx, pice_mode3_80x25_registers.graphic + call pice_set_graphic_registers + +.sequencer: mov dword ebx, pice_mode3_80x25_registers.sequencer + call pice_set_sequencer_registers + +.misc: mov dword ebx, pice_mode3_80x25_registers.misc + call pice_set_misc_registers + +.screen_on: call pice_screen_on + +;.colormap: mov dword ebx, pice_current_registers.colormap +; call pice_set_colormap + + pop ebx + pop edi + pop esi + +.end: ret + +;**************************************************************************** +;* uninitialized data ******************************************************* +;**************************************************************************** +section .bss + alignb 4 +pice_charset_saved: resb 040000h + + diff --git a/rosapps/sysutils/utils/pice/pice.cfg b/rosapps/sysutils/utils/pice/pice.cfg new file mode 100644 index 00000000000..e15cb50eb79 --- /dev/null +++ b/rosapps/sysutils/utils/pice/pice.cfg @@ -0,0 +1,4 @@ +# sample ++vga +\\SystemRoot\symbols\pice.dbg +\\SystemRoot\symbols\ntoskrnl.dbg diff --git a/rosapps/sysutils/utils/pice/readme.txt b/rosapps/sysutils/utils/pice/readme.txt new file mode 100644 index 00000000000..c1d534144bb --- /dev/null +++ b/rosapps/sysutils/utils/pice/readme.txt @@ -0,0 +1,107 @@ +This is some preliminary information on using PICE. I am planning to write +a detailed manual later. + +BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA + + PICE for Reactos is in early beta stage of development. It still has many bugs. + +BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA-BETA + + +PICE is a kernel debugger that was ported for Reactos (the original Linux +project by Klaus P. Gerlicher and Goran Devic may be found here: +http://pice.sourceforge.net). + +Installation and use: + +1. PICE is loaded like a regular device driver. The only limitation - it must +be loaded after keyboard.sys driver. You should add: + + LdrLoadAutoConfigDriver( L"pice.sys" ); + +in ntoskrnl/ldr/loader.c after the line loading keyboard driver. + +2. You should copy pice.cfg and ntoskrnl.sym to \SystemRoot\symbols directory +of Reactos. + +3. If you want to add symbolic information you should use loader.exe to +create .dbg file from the unstrippped version of exe or driver: +For example: +pice\loader\loader.exe -t ntoskrnl.nostrip.exe + +After that copy .dbg file to \SystemRoot\symbols and add a line to pice.cfg: +\\SystemRoot\symbols\ntoskrnl.dbg. + +Pice will load the symbols during boot. For large .dbg files it may take a +while (ntoskrnl.dbg is ~3Mb). You may find that loading time under bochs is +quite slow, although otherwise performance should be fine. + +Key combination to break into debugger is CTRL-D. +You may need to press CTRL button upon return from the debugger if you get +"funny" symbols when you type. + +List of commands: + +gdt display current global descriptor table +idt display current interrupt descriptor table +x return to Reactos +t single step one instruction +vma displays VMAs +h list help on commands +page dump page directories +proc list all processes +dd display dword memory +db display byte memory +u disassemble at address +mod displays all modules +bpx set code breakpoint +bl list breakpoints +bc clear breakpoints +ver display pICE version and state information +hboot hard boot the system +cpu display CPU special registers +stack display call stack +. unassemble at current instruction +p single step over call +i single step into call +locals display local symbols +table display loaded symbol tables +file display source files in symbol table +sym list known symbol information +? evaluate an expression (global symbols only) +src sets disassembly mode +wc change size of code window +wd change size of data window +r sets or displays registers +cls clear output window +pci show PCI devices +next advance EIP to next instruction +i3here catch INT 3s +layout sets keyboard layout +syscall displays syscall (table) +altkey set alternate break key +addr show/set address contexts + +[CTRL/SHIFT/ALT] arrow up/down +TAB + +Not implemented yet: + +dpd display dword physical memory +code toggle code display +peek peek at physical memory +poke poke to physical memory +phys show all mappings for linear address +timers show all active timers + +TODO: +1. Evaluation of pointers. +2. Virtual breakpoints +3. Unimplemented commands. +4. Video mode switching (to debug gdi applications). + + +Enjoy, +Eugene + + diff --git a/rosapps/sysutils/utils/pice/shared/shared.h b/rosapps/sysutils/utils/pice/shared/shared.h new file mode 100644 index 00000000000..c362d2b158a --- /dev/null +++ b/rosapps/sysutils/utils/pice/shared/shared.h @@ -0,0 +1,204 @@ +/*++ + +Copyright (c) 1998-2001 Klaus P. Gerlicher + +Module Name: + + shared.h + +Abstract: + + shared stuff between module and loader + +Environment: + + LINUX 2.2.X + Kernel mode only + +Author: + + Klaus P. Gerlicher + + reactos port by: + Eugene Ingerman + +Revision History: + + 13-Nov-1999: created + 15-Nov-2000: general cleanup of source files + + 10/20/2001: porting to reactos begins + +Copyright notice: + + This file may be distributed under the terms of the GNU Public License. + +--*/ + +//#include +//#include + +//temporary +#ifndef CTL_CODE +#define CTL_CODE(Dev, Func, Meth, Acc) ( ((Dev)<<16) | ((Acc)<<14) | ((Func)<<2) | (Meth)) +// IOCTL Parameter buffering methods +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 + +// IOCTL File access type +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS 1 +#define FILE_WRITE_ACCESS 2 +#endif + +// define custom device type +#define PICE_DEVICE_DEBUGGER 64787 + +#define PICE_IOCTL_LOAD CTL_CODE(PICE_DEVICE_DEBUGGER, 2049, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define PICE_IOCTL_UNLOAD CTL_CODE(PICE_DEVICE_DEBUGGER, 2050, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define PICE_IOCTL_RELOAD CTL_CODE(PICE_DEVICE_DEBUGGER, 2051, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define PICE_IOCTL_BREAK CTL_CODE(PICE_DEVICE_DEBUGGER, 2052, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define PICE_IOCTL_STATUS CTL_CODE(PICE_DEVICE_DEBUGGER, 2053, METHOD_BUFFERED, FILE_ANY_ACCESS) + + +typedef struct _DEBUGGER_STATUS_BLOCK +{ + char filename[256]; +}DEBUGGER_STATUS_BLOCK,*PDEBUGGER_STATUS_BLOCK; + +#define MAGIC_ULONG( ch0, ch1, ch2, ch3 ) \ + ( (ULONG)(UCHAR)(ch0) | \ + ( (ULONG)(UCHAR)(ch1) << 8 ) | \ + ( (ULONG)(UCHAR)(ch2) << 16 ) | \ + ( (ULONG)(UCHAR)(ch3) << 24 ) ) + +#define PICE_MAGIC MAGIC_ULONG('P','I','C','E') + +#define DEBUG_MODULE_NAME_LEN 32 +typedef struct _PICE_SYMBOLFILE_HEADER +{ + ULONG magic; + WCHAR name[DEBUG_MODULE_NAME_LEN]; + ULONG ulOffsetToHeaders,ulSizeOfHeader; + ULONG ulOffsetToGlobals,ulSizeOfGlobals; + ULONG ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings; + ULONG ulOffsetToStabs,ulSizeOfStabs; + ULONG ulOffsetToStabsStrings,ulSizeOfStabsStrings; + ULONG ulOffsetToSrcFiles,ulNumberOfSrcFiles; +}PICE_SYMBOLFILE_HEADER; + +typedef struct _STAB_ENTRY +{ + unsigned long n_strx; + unsigned char n_type; + unsigned char n_other; + unsigned short n_desc; + unsigned long n_value; +}STAB_ENTRY,*PSTAB_ENTRY; + +typedef struct _PICE_SYMBOLFILE_SOURCE +{ + char filename[256]; + ULONG ulOffsetToNext; +}PICE_SYMBOLFILE_SOURCE; + + + + + +/////////////////////////////////////////////////////////////////////////////////// +// serial stuff +typedef struct _SERIAL_PACKET_HEADER +{ + ULONG packet_size; + ULONG packet_header_chksum; + ULONG packet_chksum; +}SERIAL_PACKET_HEADER,*PSERIAL_PACKET_HEADER; + +typedef struct _SERIAL_PACKET +{ + SERIAL_PACKET_HEADER header; + UCHAR data[1]; +}SERIAL_PACKET,*PSERIAL_PACKET; + +#define ACK (0) + +typedef enum _ECOLORS +{ + BLACK = 0, + BLUE, + GREEN, + TURK, + RED, + VIOLET, + BROWN, + LTGRAY, + GRAY, + LTBLUE, + LT_GREEN, + LTTURK, + LTRED, + LTVIOLET, + YELLOW, + WHITE +}ECOLORS; + +typedef struct _SERIAL_DATA_PACKET +{ + UCHAR type; + UCHAR data[1]; +}SERIAL_DATA_PACKET,*PSERIAL_DATA_PACKET; + +#define PACKET_TYPE_CLRLINE (0) +typedef struct _SERIAL_DATA_PACKET_CLRLINE +{ + UCHAR type; + ECOLORS fgcol,bkcol; + UCHAR line; +}SERIAL_DATA_PACKET_CLRLINE,*PSERIAL_DATA_PACKET_CLRLINE; + +#define PACKET_TYPE_PRINT (1) +typedef struct _SERIAL_DATA_PACKET_PRINT +{ + UCHAR type; + UCHAR x; + UCHAR y; + ECOLORS fgcol,bkcol; + UCHAR string[1]; +}SERIAL_DATA_PACKET_PRINT,*PSERIAL_DATA_PACKET_PRINT; + +#define PACKET_TYPE_CONNECT (2) +typedef struct _SERIAL_DATA_PACKET_CONNECT +{ + UCHAR type; + UCHAR xsize,ysize; +}SERIAL_DATA_PACKET_CONNECT,*PSERIAL_DATA_PACKET_CONNECT; + +#define PACKET_TYPE_CURSOR (3) +typedef struct _SERIAL_DATA_PACKET_CURSOR +{ + UCHAR type; + UCHAR state,x,y; +}SERIAL_DATA_PACKET_CURSOR,*PSERIAL_DATA_PACKET_CURSOR; + +#define PACKET_TYPE_INVERTLINE (4) +typedef struct _SERIAL_DATA_PACKET_INVERTLINE +{ + UCHAR type; + UCHAR line; +}SERIAL_DATA_PACKET_INVERTLINE,*PSERIAL_DATA_PACKET_INVERTLINE; + +#define PACKET_TYPE_POLL (5) +typedef struct _SERIAL_DATA_PACKET_POLL +{ + UCHAR type; + USHORT major_version,minor_version,build_number; +}SERIAL_DATA_PACKET_POLL,*PSERIAL_DATA_PACKET_POLL; + +// END of serial stuff +/////////////////////////////////////////////////////////////////////////////////// + + +// EOF diff --git a/rosapps/sysutils/utils/pnpdump/pnpdump.c b/rosapps/sysutils/utils/pnpdump/pnpdump.c new file mode 100644 index 00000000000..542eb0c461e --- /dev/null +++ b/rosapps/sysutils/utils/pnpdump/pnpdump.c @@ -0,0 +1,855 @@ +/* + * pnpdump - PnP BIOS information dumper + */ + +#include +#include +#include +#include +#include + +#include + +#include + +typedef struct _CM_PNP_BIOS_DEVICE_NODE +{ + USHORT Size; + UCHAR Node; + ULONG ProductId; + UCHAR DeviceType[3]; + USHORT DeviceAttributes; +} CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE; + +typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK +{ + UCHAR Signature[4]; // $PnP (ascii) + UCHAR Revision; + UCHAR Length; + USHORT ControlField; + UCHAR Checksum; + ULONG EventFlagAddress; // Physical address + USHORT RealModeEntryOffset; + USHORT RealModeEntrySegment; + USHORT ProtectedModeEntryOffset; + ULONG ProtectedModeCodeBaseAddress; + ULONG OemDeviceId; + USHORT RealModeDataBaseAddress; + ULONG ProtectedModeDataBaseAddress; +} CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK; + +#include + +typedef struct _PNP_ID_NAME_ +{ + char *PnpId; + char *DeviceName; +} PNP_ID_NAME, *PPNP_ID_NAME; + + +static char Hex[] = "0123456789ABCDEF"; + +static PNP_ID_NAME PnpName[] = +{ + /* Interrupt Controllers */ + {"PNP0000", "AT Interrupt Controller"}, + {"PNP0001", "EISA Interrupt Controller"}, + {"PNP0002", "MCA Interrupt Controller"}, + {"PNP0003", "APIC"}, + {"PNP0004", "Cyrix SLiC MP Interrupt Controller"}, + + /* Timers */ + {"PNP0100", "AT Timer"}, + {"PNP0101", "EISA Timer"}, + {"PNP0102", "MCA Timer"}, + + /* DMA Controllers */ + {"PNP0200", "AT DMA Controller"}, + {"PNP0201", "EISA DMA Controller"}, + {"PNP0202", "MCA DMA Controller"}, + + /* Keyboards */ + {"PNP0300", "IBM PC/XT Keyboard (83 keys)"}, + {"PNP0301", "IBM PC/AT Keyboard (86 keys)"}, + {"PNP0302", "IBM PC/XT Keyboard (84 keys)"}, + {"PNP0303", "IBM Enhanced (101/102 keys)"}, + {"PNP0304", "Olivetti Keyboard (83 keys)"}, + {"PNP0305", "Olivetti Keyboard (102 keys)"}, + {"PNP0306", "Olivetti Keyboard (86 keys)"}, + {"PNP0307", "Microsoft Windows(R) Keyboard"}, + {"PNP0308", "General Input Device Emulation Interface (GIDEI) legacy"}, + {"PNP0309", "Olivetti Keyboard (A101/102 key)"}, + {"PNP030A", "AT&T 302 keyboard"}, + {"PNP030B", "Reserved by Microsoft"}, + {"PNP0320", "Japanese 101-key keyboard"}, + {"PNP0321", "Japanese AX keyboard"}, + {"PNP0322", "Japanese 106-key keyboard A01"}, + {"PNP0323", "Japanese 106-key keyboard 002/003"}, + {"PNP0324", "Japanese 106-key keyboard 001"}, + {"PNP0325", "Japanese Toshiba Desktop keyboard"}, + {"PNP0326", "Japanese Toshiba Laptop keyboard"}, + {"PNP0327", "Japanese Toshiba Notebook keyboard"}, + {"PNP0340", "Korean 84-key keyboard"}, + {"PNP0341", "Korean 86-key keyboard"}, + {"PNP0342", "Korean Enhanced keyboard"}, + {"PNP0343", "Korean Enhanced keyboard 101b"}, + {"PNP0343", "Korean Enhanced keyboard 101c"}, + {"PNP0344", "Korean Enhanced keyboard 103"}, + + /* Parallel Ports */ + {"PNP0400", "Standard LPT printer port"}, + {"PNP0401", "ECP printer port"}, + + /* Serial Ports */ + {"PNP0500", "Standard PC COM port"}, + {"PNP0501", "16550A-compatible COM port"}, + {"PNP0510", "Generic IRDA-compatible port"}, + + /* Harddisk Controllers */ + {"PNP0600", "Generic ESDI/ATA/IDE harddisk controller"}, + {"PNP0601", "Plus Hardcard II"}, + {"PNP0602", "Plus Hardcard IIXL/EZ"}, + {"PNP0603", "Generic IDE supporting Microsoft Device Bay Specification"}, + + /* Floppy Controllers */ + {"PNP0700", "PC standard floppy disk controller"}, + {"PNP0701", "Standard floppy controller supporting MS Device Bay Specification"}, + + /* obsolete devices */ + {"PNP0800", "Microsoft Sound System compatible device"}, + + /* Display Adapters */ + {"PNP0900", "VGA Compatible"}, + {"PNP0901", "Video Seven VRAM/VRAM II/1024i"}, + {"PNP0902", "8514/A Compatible"}, + {"PNP0903", "Trident VGA"}, + {"PNP0904", "Cirrus Logic Laptop VGA"}, + {"PNP0905", "Cirrus Logic VGA"}, + {"PNP0906", "Tseng ET4000"}, + {"PNP0907", "Western Digital VGA"}, + {"PNP0908", "Western Digital Laptop VGA"}, + {"PNP0909", "S3 Inc. 911/924"}, + {"PNP090A", "ATI Ultra Pro/Plus (Mach 32)"}, + {"PNP090B", "ATI Ultra (Mach 8)"}, + {"PNP090C", "XGA Compatible"}, + {"PNP090D", "ATI VGA Wonder"}, + {"PNP090E", "Weitek P9000 Graphics Adapter"}, + {"PNP090F", "Oak Technology VGA"}, + {"PNP0910", "Compaq QVision"}, + {"PNP0911", "XGA/2"}, + {"PNP0912", "Tseng Labs W32/W32i/W32p"}, + {"PNP0913", "S3 Inc. 801/928/964"}, + {"PNP0914", "Cirrus Logic 5429/5434 (memory mapped)"}, + {"PNP0915", "Compaq Advanced VGA (AVGA)"}, + {"PNP0916", "ATI Ultra Pro Turbo (Mach64)"}, + {"PNP0917", "Reserved by Microsoft"}, + {"PNP0918", "Matrox MGA"}, + {"PNP0919", "Compaq QVision 2000"}, + {"PNP091A", "Tseng W128"}, + {"PNP0930", "Chips & Technologies Super VGA"}, + {"PNP0931", "Chips & Technologies Accelerator"}, + {"PNP0940", "NCR 77c22e Super VGA"}, + {"PNP0941", "NCR 77c32blt"}, + {"PNP09FF", "Plug and Play Monitors (VESA DDC)"}, + + /* Peripheral Buses */ + {"PNP0A00", "ISA Bus"}, + {"PNP0A01", "EISA Bus"}, + {"PNP0A02", "MCA Bus"}, + {"PNP0A03", "PCI Bus"}, + {"PNP0A04", "VESA/VL Bus"}, + {"PNP0A05", "Generic ACPI Bus"}, + {"PNP0A06", "Generic ACPI Extended-IO Bus (EIO bus)"}, + + /* System devices */ + {"PNP0800", "AT-style speaker sound"}, + {"PNP0B00", "AT Real-Time Clock"}, + {"PNP0C00", "Plug and Play BIOS (only created by the root enumerator)"}, + {"PNP0C01", "System Board"}, + {"PNP0C02", "General Plug and Play motherboard registers."}, + {"PNP0C03", "Plug and Play BIOS Event Notification Interrupt"}, + {"PNP0C04", "Math Coprocessor"}, + {"PNP0C05", "APM BIOS (Version independent)"}, + {"PNP0C06", "Reserved for identification of early Plug and Play BIOS implementation"}, + {"PNP0C07", "Reserved for identification of early Plug and Play BIOS implementation"}, + {"PNP0C08", "ACPI system board hardware"}, + {"PNP0C09", "ACPI Embedded Controller"}, + {"PNP0C0A", "ACPI Control Method Battery"}, + {"PNP0C0B", "ACPI Fan"}, + {"PNP0C0C", "ACPI power button device"}, + {"PNP0C0D", "ACPI lid device"}, + {"PNP0C0E", "ACPI sleep button device"}, + {"PNP0C0F", "PCI interrupt link device"}, + {"PNP0C10", "ACPI system indicator device"}, + {"PNP0C11", "ACPI thermal zone"}, + {"PNP0C12", "Device Bay Controller"}, + + /* PCMCIA Controllers */ + {"PNP0E00", "Intel 82365-Compatible PCMCIA Controller"}, + {"PNP0E01", "Cirrus Logic CL-PD6720 PCMCIA Controller"}, + {"PNP0E02", "VLSI VL82C146 PCMCIA Controller"}, + {"PNP0E03", "Intel 82365-compatible CardBus controller"}, + + /* Mice */ + {"PNP0F00", "Microsoft Bus Mouse"}, + {"PNP0F01", "Microsoft Serial Mouse"}, + {"PNP0F02", "Microsoft InPort Mouse"}, + {"PNP0F03", "Microsoft PS/2-style Mouse"}, + {"PNP0F04", "Mouse Systems Mouse"}, + {"PNP0F05", "Mouse Systems 3-Button Mouse (COM2)"}, + {"PNP0F06", "Genius Mouse (COM1)"}, + {"PNP0F07", "Genius Mouse (COM2)"}, + {"PNP0F08", "Logitech Serial Mouse"}, + {"PNP0F09", "Microsoft BallPoint Serial Mouse"}, + {"PNP0F0A", "Microsoft Plug and Play Mouse"}, + {"PNP0F0B", "Microsoft Plug and Play BallPoint Mouse"}, + {"PNP0F0C", "Microsoft-compatible Serial Mouse"}, + {"PNP0F0D", "Microsoft-compatible InPort-compatible Mouse"}, + {"PNP0F0E", "Microsoft-compatible PS/2-style Mouse"}, + {"PNP0F0F", "Microsoft-compatible Serial BallPoint-compatible Mouse"}, + {"PNP0F10", "Texas Instruments QuickPort Mouse"}, + {"PNP0F11", "Microsoft-compatible Bus Mouse"}, + {"PNP0F12", "Logitech PS/2-style Mouse"}, + {"PNP0F13", "PS/2 Port for PS/2-style Mice"}, + {"PNP0F14", "Microsoft Kids Mouse"}, + {"PNP0F15", "Logitech bus mouse"}, + {"PNP0F16", "Logitech SWIFT device"}, + {"PNP0F17", "Logitech-compatible serial mouse"}, + {"PNP0F18", "Logitech-compatible bus mouse"}, + {"PNP0F19", "Logitech-compatible PS/2-style Mouse"}, + {"PNP0F1A", "Logitech-compatible SWIFT Device"}, + {"PNP0F1B", "HP Omnibook Mouse"}, + {"PNP0F1C", "Compaq LTE Trackball PS/2-style Mouse"}, + {"PNP0F1D", "Compaq LTE Trackball Serial Mouse"}, + {"PNP0F1E", "Microsoft Kids Trackball Mouse"}, + {"PNP0F1F", "Reserved by Microsoft Input Device Group"}, + {"PNP0F20", "Reserved by Microsoft Input Device Group"}, + {"PNP0F21", "Reserved by Microsoft Input Device Group"}, + {"PNP0F22", "Reserved by Microsoft Input Device Group"}, + {"PNP0F23", "Reserved by Microsoft Input Device Group"}, + {"PNP0FFF", "Reserved by Microsoft Systems"}, + + /* List Terminator */ + {NULL, NULL} +}; + + +/* FUNCTIONS ****************************************************************/ + +static char * +GetDeviceName(char *PnpId) +{ + PPNP_ID_NAME IdName; + + IdName = PnpName; + while (IdName->PnpId != NULL) + { + if (!strcmp(IdName->PnpId, PnpId)) + return IdName->DeviceName; + + IdName++; + } + + return "Unknown Device"; +} + + +LONG +GetPnpKey(PHKEY PnpKey) +{ + LONG lError; + char szBuffer[80]; + HKEY hAdapterKey; + HKEY hBusKey; + DWORD dwBus; + DWORD dwType; + DWORD dwSize; + + *PnpKey = 0; + + lError = RegOpenKey(HKEY_LOCAL_MACHINE, + "HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter", + &hAdapterKey); + if (lError != ERROR_SUCCESS) + return 0; + + /* Enumerate buses */ + for (dwBus = 0; ; dwBus++) + { + sprintf(szBuffer, "%lu", dwBus); + + lError = RegOpenKey(hAdapterKey, + szBuffer, + &hBusKey); + if (lError != ERROR_SUCCESS) + { + RegCloseKey(hAdapterKey); + return lError; + } + + dwSize = 80; + lError = RegQueryValueEx(hBusKey, + "Identifier", + NULL, + &dwType, + (LPBYTE)szBuffer, + &dwSize); + if (lError != ERROR_SUCCESS) + { + RegCloseKey(hBusKey); + RegCloseKey(hAdapterKey); + return lError; + } + + if (dwType == REG_SZ && stricmp(szBuffer, "pnp bios") == 0) + { + *PnpKey = hBusKey; + RegCloseKey(hAdapterKey); + return ERROR_SUCCESS; + } + + RegCloseKey(hBusKey); + } + + return 1; +} + + +static VOID +PnpDecodeIrq(unsigned char *Ptr) +{ + USHORT IrqMask; + int i; + + IrqMask = *Ptr; + Ptr++; + IrqMask |= (*Ptr << 8); + + printf(" IRQs:"); + + for (i = 0; i < 16; i++) + { + if (IrqMask & (1 << i)) + { + printf(" %u", i); + } + } + + printf("\n"); +} + + +static VOID +PnpDecodeDma(unsigned char *Ptr) +{ + unsigned char DmaChannel; + unsigned char DmaStatus; + int i; + + DmaChannel = *Ptr; + Ptr++; + DmaStatus = *Ptr; + + printf(" DMAs:"); + + for (i = 0; i < 8; i++) + { + if (DmaChannel & (1 << i)) + { + printf(" %u", i); + } + } + + printf("\n"); +} + + +static VOID +PnpDecodeIoPort(unsigned char *Ptr) +{ + USHORT MinBase; + USHORT MaxBase; + UCHAR Align; + UCHAR Length; + + // Info = *Ptr; + Ptr++; + MinBase = *Ptr; + Ptr++; + MinBase += (*Ptr << 8); + Ptr++; + MaxBase = *Ptr; + Ptr++; + MaxBase += (*Ptr << 8); + Ptr++; + Align = *Ptr; + Ptr++; + Length = *Ptr; + + printf(" I/O Port descriptor\n"); + printf(" MinBase 0x%x MaxBase 0x%x Align %u Length %u\n", + MinBase, MaxBase, Align, Length); +} + + +static VOID +PnpDecodeFixedIoPort(unsigned char *Ptr) +{ + USHORT IoPort; + UCHAR Length; + + IoPort = *Ptr; + Ptr++; + IoPort += (*Ptr << 8); + Ptr++; + Length = *Ptr; + + printf(" Fixed I/O Port descriptor\n"); + printf(" PortBase 0x%hx Length 0x%x\n", + IoPort, Length); + +#if 0 + if (Length == 1) + { + printf(" Fixed location I/O Port descriptor: 0x%x\n", + IoPort); + } + else + { + printf(" Fixed location I/O Port descriptor: 0x%x - 0x%x\n", + IoPort, + IoPort + Length - 1); + } +#endif +} + + +static VOID +PnpDecodeMemory16(unsigned char *Ptr) +{ + UCHAR Info; + USHORT MinBase; + USHORT MaxBase; + USHORT Align; + USHORT Length; + + Info = *Ptr; + Ptr++; + + MinBase = *Ptr; + Ptr++; + MinBase += (*Ptr << 8); + Ptr++; + + MaxBase = *Ptr; + Ptr++; + MaxBase += (*Ptr << 8); + Ptr++; + + Align = *Ptr; + Ptr++; + Align += (*Ptr << 8); + Ptr++; + + Length = *Ptr; + Ptr++; + Length += (*Ptr << 8); + + printf(" 16-Bit memory range descriptor\n"); + printf(" MinBase 0x%hx MaxBase 0x%hx Align 0x%hx Length 0x%hx Flags 0x%02x\n", + MinBase, MaxBase, Align,Length, Info); +} + + +static VOID +PnpDecodeMemory32(unsigned char *Ptr) +{ + UCHAR Info; + ULONG MinBase; + ULONG MaxBase; + ULONG Align; + ULONG Length; + + Info = *Ptr; + Ptr++; + + MinBase = *Ptr; + Ptr++; + MinBase += (*Ptr << 8); + Ptr++; + MinBase += (*Ptr << 16); + Ptr++; + MinBase += (*Ptr << 24); + Ptr++; + + MaxBase = *Ptr; + Ptr++; + MaxBase += (*Ptr << 8); + Ptr++; + MaxBase += (*Ptr << 16); + Ptr++; + MaxBase += (*Ptr << 24); + Ptr++; + + Align = *Ptr; + Ptr++; + Align += (*Ptr << 8); + Ptr++; + Align += (*Ptr << 16); + Ptr++; + Align += (*Ptr << 24); + Ptr++; + + Length = *Ptr; + Ptr++; + Length += (*Ptr << 8); + Ptr++; + Length += (*Ptr << 16); + Ptr++; + Length += (*Ptr << 24); + + printf(" 32-Bit memory range descriptor\n"); + printf(" MinBase 0x%lx MaxBase 0x%lx Align 0x%lx Length 0x%lx Flags 0x%02x\n", + MinBase, MaxBase, Align,Length, Info); +} + + +static VOID +PnpDecodeFixedMemory(unsigned char *Ptr) +{ + UCHAR Info; + ULONG Base; + ULONG Length; + + Info = *Ptr; + Ptr++; + + Base = *Ptr; + Ptr++; + Base += (*Ptr << 8); + Ptr++; + Base += (*Ptr << 16); + Ptr++; + Base += (*Ptr << 24); + Ptr++; + + Length = *Ptr; + Ptr++; + Length += (*Ptr << 8); + Ptr++; + Length += (*Ptr << 16); + Ptr++; + Length += (*Ptr << 24); + + printf(" 32-Bit fixed location memory range descriptor\n"); + printf(" Base 0x%lx Length 0x%lx Flags 0x%02x\n", + Base, Length, Info); +} + + +void PrintDeviceData (PCM_PNP_BIOS_DEVICE_NODE DeviceNode) +{ + char PnpId[8]; + unsigned char *Ptr; + unsigned int TagSize; + unsigned int TagType; + + unsigned char Id[4]; + + printf ("Node: %x Size %hu (0x%hx)\n", + DeviceNode->Node, + DeviceNode->Size, + DeviceNode->Size); + + memcpy(Id, &DeviceNode->ProductId, 4); + + PnpId[0] = ((Id[0] >> 2) & 0x1F) + 0x40; + PnpId[1] = ((Id[0] << 3) & 0x18) + + ((Id[1] >> 5) & 0x07) + 0x40; + PnpId[2] = (Id[1] & 0x1F) + 0x40; + + PnpId[3] = Hex[(Id[2] >> 4) & 0xF]; + PnpId[4] = Hex[Id[2] & 0x0F]; + + PnpId[5] = Hex[(Id[3] >> 4) & 0x0F]; + PnpId[6] = Hex[Id[3] & 0x0F]; + PnpId[7] = 0; + + printf(" '%s' (%s)\n", + PnpId, GetDeviceName(PnpId)); + + if (DeviceNode->Size > sizeof(CM_PNP_BIOS_DEVICE_NODE)) + { + Ptr = (unsigned char *)(DeviceNode + 1); + while (TRUE) + { + if (*Ptr & 0x80) + { + TagType = *Ptr & 0x7F; + Ptr++; + TagSize = *Ptr; + Ptr++; + TagSize += (*Ptr << 16); + Ptr++; + + + switch (TagType) + { + case 1: + PnpDecodeMemory16(Ptr); + break; + + case 5: + PnpDecodeMemory32(Ptr); + break; + + case 6: + PnpDecodeFixedMemory(Ptr); + break; + + default: + printf(" Large tag: type %u size %u\n", + TagType, + TagSize); + break; + } + } + else + { + TagType = (*Ptr >> 3) & 0x0F; + TagSize = *Ptr & 0x07; + Ptr++; + + switch (TagType) + { + case 2: + printf(" Logical device ID\n"); + break; + + case 3: + printf(" Compatible device ID\n"); + break; + + case 4: + PnpDecodeIrq(Ptr); + break; + + case 5: + PnpDecodeDma(Ptr); + break; + + case 8: + PnpDecodeIoPort(Ptr); + break; + + case 9: + PnpDecodeFixedIoPort(Ptr); + break; + + case 0x0F: /* end tag */ + break; + + default: + printf(" Small tag: type %u size %u\n", + TagType, + TagSize); + break; + } + + /* end tag */ + if (TagType == 0x0F) + break; + } + + Ptr = Ptr + TagSize; + } + } +} + + +int main (int argc, char *argv[]) +{ + LONG lError; + HKEY hPnpKey; + DWORD dwType; + DWORD dwSize; + BOOL Ask; + PCM_FULL_RESOURCE_DESCRIPTOR lpBuffer; + PCM_PNP_BIOS_INSTALLATION_CHECK lpPnpInst; + PCM_PNP_BIOS_DEVICE_NODE lpDevNode; + DWORD dwDataSize; + DWORD dwResourceSize; + + hPnpKey = 0; + + Ask = TRUE; + if (argc >1 && (!strcmp(argv[1],"/S") || !strcmp(argv[1],"/s"))) + { + Ask = FALSE; + } + + if (argc >1 && !strcmp(argv[1],"/?")) + { + printf("This utility prints the PnP-nodes from the registry\n"); + printf("\"/s\" prevents the \"Press any key\"\n\n"); + return 0; + } + + lError = GetPnpKey(&hPnpKey); + if (lError != ERROR_SUCCESS) + { + printf("Failed to get PnP-BIOS key\n"); + return 0; + } + + if (hPnpKey != 0) + { + printf("Found PnP-BIOS key\n"); + } + + /* Allocate buffer */ + dwSize = 2048; + lpBuffer = malloc(dwSize); + if (lpBuffer == NULL) + { + printf("Error: malloc() failed\n"); + RegCloseKey(hPnpKey); + return 0; + } + + do + { + lError = RegQueryValueEx(hPnpKey, + "Configuration Data", + NULL, + &dwType, + (LPBYTE)lpBuffer, + &dwSize); + if (lError == ERROR_MORE_DATA) + { + lpBuffer = realloc(lpBuffer, dwSize); + if (lpBuffer == NULL) + { + printf("Error: realloc() of %u bytes failed\n", (unsigned) dwSize); + RegCloseKey(hPnpKey); + return 0; + } + } + } + while (lError == ERROR_MORE_DATA); + if (lError != ERROR_SUCCESS) + { + printf("Failed to read 'Configuration Data' value\n"); + free(lpBuffer); + RegCloseKey(hPnpKey); + return 0; + } + +// printf ("Data size: %lu\n", dwSize); + + RegCloseKey(hPnpKey); + +// printf("Resource count %lu\n", lpBuffer->PartialResourceList.Count); + + if (lpBuffer->PartialResourceList.Count == 0) + { + printf("Invalid resource count!\n"); + free(lpBuffer); + return 0; + } + +// printf("lpBuffer %p\n", lpBuffer); + + dwResourceSize = lpBuffer->PartialResourceList.PartialDescriptors[0].u.DeviceSpecificData.DataSize; +// printf("ResourceSize: %lu\n", dwResourceSize); + + lpPnpInst = (PCM_PNP_BIOS_INSTALLATION_CHECK) + ((ULONG_PTR)(&lpBuffer->PartialResourceList.PartialDescriptors[0]) + + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); + +// printf("lpPnpInst %p\n", lpPnpInst); + + printf("Signature '%.4s'\n", lpPnpInst->Signature); + if (strncmp((PCHAR)lpPnpInst->Signature, "$PnP", 4)) + { + printf("Error: Invalid PnP signature\n"); + free(lpBuffer); + return 0; + } + +// printf("InstCheck length: %lu\n", lpPnpInst->Length); + + dwDataSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK); + lpDevNode = (PCM_PNP_BIOS_DEVICE_NODE)((DWORD)lpPnpInst + sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)); + + if (lpDevNode->Size == 0) + { + printf("Error: Device node size is zero!\n"); + return 0; + } + +#if 0 + printf("Node: %x Size %hu (0x%hx)\n", + lpDevNode->Node, + lpDevNode->Size, + lpDevNode->Size); + + printf("Done.\n"); +return 0; +#endif + + + while (dwDataSize < dwResourceSize) + { + if (lpDevNode->Size == 0) + break; + + printf("Node: %x Size %hu (0x%hx)\n", + lpDevNode->Node, + lpDevNode->Size, + lpDevNode->Size); + + dwDataSize += lpDevNode->Size; + lpDevNode = (PCM_PNP_BIOS_DEVICE_NODE)((DWORD)lpDevNode + lpDevNode->Size); + } + + if (Ask) + { + printf("\n Press any key...\n"); + getch(); + } + else + { + printf("\n"); + } + + dwDataSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK); + lpDevNode = (PCM_PNP_BIOS_DEVICE_NODE)((DWORD)lpPnpInst + sizeof(CM_PNP_BIOS_INSTALLATION_CHECK)); + + while (dwDataSize < dwResourceSize) + { + if (lpDevNode->Size == 0) + break; + + PrintDeviceData(lpDevNode); + + if (Ask) + { + printf("\n Press any key...\n"); + getch(); + } + else + { + printf("\n"); + } + + dwDataSize += lpDevNode->Size; + lpDevNode = (PCM_PNP_BIOS_DEVICE_NODE)((DWORD)lpDevNode + lpDevNode->Size); + } + + free(lpBuffer); + + return 0; +} + +/* EOF */ diff --git a/rosapps/sysutils/utils/ps/ps.c b/rosapps/sysutils/utils/ps/ps.c new file mode 100644 index 00000000000..64aa4736885 --- /dev/null +++ b/rosapps/sysutils/utils/ps/ps.c @@ -0,0 +1,281 @@ +/* + * + * ReactOS ps - process list console viewer + * + * ps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + Thanks to Filip Navara patch for fixing the Xp crash problem. +*/ + +#define NTOS_MODE_USER +#define WIN32_NO_STATUS +#include +#include + +typedef struct _SYSTEM_THREADS + { + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER CreateTime; + ULONG WaitTime; + PVOID StartAddress; + CLIENT_ID ClientId; + KPRIORITY Priority; + LONG BasePriority; + ULONG ContextSwitches; + ULONG ThreadState; + ULONG WaitReason; + } SYSTEM_THREADS, *PSYSTEM_THREADS; + + typedef struct _SYSTEM_PROCESSES + { + ULONG NextEntryOffset; + ULONG NumberOfThreads; + LARGE_INTEGER SpareLi1; + LARGE_INTEGER SpareLi2; + LARGE_INTEGER SpareLi3; + LARGE_INTEGER CreateTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER KernelTime; + UNICODE_STRING ImageName; + KPRIORITY BasePriority; + HANDLE UniqueProcessId; + HANDLE InheritedFromUniqueProcessId; + ULONG HandleCount; + ULONG SessionId; + ULONG PageDirectoryFrame; + + /* + * This part corresponds to VM_COUNTERS_EX. + * NOTE: *NOT* THE SAME AS VM_COUNTERS! + */ + ULONG PeakVirtualSize; + ULONG VirtualSize; + ULONG PageFaultCount; + ULONG PeakWorkingSetSize; + ULONG WorkingSetSize; + ULONG QuotaPeakPagedPoolUsage; + ULONG QuotaPagedPoolUsage; + ULONG QuotaPeakNonPagedPoolUsage; + ULONG QuotaNonPagedPoolUsage; + ULONG PagefileUsage; + ULONG PeakPagefileUsage; + ULONG PrivateUsage; + + /* This part corresponds to IO_COUNTERS */ + LARGE_INTEGER ReadOperationCount; + LARGE_INTEGER WriteOperationCount; + LARGE_INTEGER OtherOperationCount; + LARGE_INTEGER ReadTransferCount; + LARGE_INTEGER WriteTransferCount; + LARGE_INTEGER OtherTransferCount; + + SYSTEM_THREADS Threads [1]; + } SYSTEM_PROCESSES, *PSYSTEM_PROCESSES; + + +// x00000000 00000000 000:00:00 000:00:00 () +static char title[] = "P PID PPID KTime UTime NAME\n"; +static char title1[] = "t TID KTime UTime State WaitResson\n"; +static char title2[] = "w PID Hwnd WndStile TID WndName\n"; + + +struct status { + DWORD state; + const char desc[10]; +} thread_stat[8 + 1] = { + {0, "Init "}, + {1, "Ready "}, + {2, "Running "}, + {3, "Standby "}, + {4, "Terminated"}, + {5, "Wait "}, + {6, "Transition"}, + {7, "Unknown "}, + {-1," ? "} +}; + +struct waitres { + DWORD state; + char desc[17]; +} waitreason[35 + 1] = { + {0, "Executive "}, + {1, "FreePage "}, + {2, "PageIn "}, + {3, "PoolAllocation "}, + {4, "DelayExecution "}, + {5, "Suspended "}, + {6, "UserRequest "}, + {7, "WrExecutive "}, + {8, "WrFreePage "}, + {9, "WrPageIn "}, + {10,"WrPoolAllocation "}, + {11,"WrDelayExecution "}, + {12,"WrSuspended "}, + {13,"WrUserRequest "}, + {14,"WrEventPair "}, + {15,"WrQueue "}, + {16,"WrLpcReceive "}, + {17,"WrLpcReply "}, + {18,"WrVirtualMemory "}, + {19,"WrPageOut "}, + {20,"WrRendezvous "}, + {21,"Spare2 "}, + {22,"WrGuardedMutex "}, + {23,"Spare4 "}, + {24,"Spare5 "}, + {25,"Spare6 "}, + {26,"WrKernel "}, + {27,"WrResource "}, + {28,"WrPushLock "}, + {29,"WrMutex "}, + {30,"WrQuantumEnd "}, + {31,"WrDispatchInt "}, + {32,"WrPreempted "}, + {33,"WrYieldExecution "}, + {34,"MaximumWaitReason"}, + {-1," ? "} +}; + +static BOOL CALLBACK +EnumThreadProc(HWND hwnd, LPARAM lp) +{ + DWORD r, pid, tid; + LONG style; + char buf[256]; + HANDLE Stdout = GetStdHandle(STD_OUTPUT_HANDLE); + + GetWindowText(hwnd, (LPTSTR)lp, 30); + + if(hwnd != 0) + { + style = GetWindowLong(hwnd, GWL_STYLE); + + tid = GetWindowThreadProcessId(hwnd, &pid); + + wsprintf (buf,"w%8d %8x %08x %8d %s\n",pid, hwnd , style, tid, lp ); + WriteFile(Stdout, buf, lstrlen(buf), &r, NULL); + } + return (TRUE); +} + +int main() +{ + DWORD r; + ANSI_STRING astring; + HANDLE Stdout = GetStdHandle(STD_OUTPUT_HANDLE); + PSYSTEM_PROCESSES SystemProcesses = NULL; + PSYSTEM_PROCESSES CurrentProcess; + ULONG BufferSize, ReturnSize; + NTSTATUS Status; + char buf[256]; + char buf1[256]; + + WriteFile(Stdout, title, lstrlen(title), &r, NULL); + WriteFile(Stdout, title1, lstrlen(title1), &r, NULL); + WriteFile(Stdout, title2, lstrlen(title2), &r, NULL); + + /* Get process information. */ + BufferSize = 0; + do + { + BufferSize += 0x10000; + SystemProcesses = HeapAlloc(GetProcessHeap(), 0, BufferSize); + Status = NtQuerySystemInformation(SystemProcessInformation, + SystemProcesses, BufferSize, + &ReturnSize); + if (Status == STATUS_INFO_LENGTH_MISMATCH) + HeapFree(GetProcessHeap(), 0, SystemProcesses); + } while (Status == STATUS_INFO_LENGTH_MISMATCH); + + /* If querying system information failed, bail out. */ + if (!NT_SUCCESS(Status)) + return 1; + + /* For every process print the information. */ + CurrentProcess = SystemProcesses; + while (CurrentProcess->NextEntryOffset != 0) + { + int hour, hour1, thour, thour1; + unsigned char minute, minute1, tmin, tmin1; + unsigned char seconds, seconds1, tsec, tsec1; + + unsigned int ti; + LARGE_INTEGER ptime; + + ptime.QuadPart = CurrentProcess->KernelTime.QuadPart; + hour = (ptime.QuadPart / (10000000LL * 3600LL)); + minute = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; + seconds = (ptime.QuadPart / 10000000LL) % 60LL; + + ptime.QuadPart = CurrentProcess->UserTime.QuadPart; + hour1 = (ptime.QuadPart / (10000000LL * 3600LL)); + minute1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; + seconds1 = (ptime.QuadPart / 10000000LL) % 60LL; + + RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ImageName, TRUE); + + wsprintf(buf,"P%8d %8d %3d:%02d:%02d %3d:%02d:%02d ProcName: %s\n", + CurrentProcess->UniqueProcessId, CurrentProcess->InheritedFromUniqueProcessId, + hour, minute, seconds, hour1, minute1, seconds1, + astring.Buffer); + WriteFile(stdout, buf, lstrlen(buf), &r, NULL); + + RtlFreeAnsiString(&astring); + + for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++) + { + struct status *statt; + struct waitres *waitt; + char szWindowName[30] = {" "}; + + ptime = CurrentProcess->Threads[ti].KernelTime; + thour = (ptime.QuadPart / (10000000LL * 3600LL)); + tmin = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; + tsec = (ptime.QuadPart / 10000000LL) % 60LL; + + ptime = CurrentProcess->Threads[ti].UserTime; + thour1 = (ptime.QuadPart / (10000000LL * 3600LL)); + tmin1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL; + tsec1 = (ptime.QuadPart / 10000000LL) % 60LL; + + statt = thread_stat; + while (statt->state != CurrentProcess->Threads[ti].ThreadState && statt->state >= 0) + statt++; + + waitt = waitreason; + while (waitt->state != CurrentProcess->Threads[ti].WaitReason && waitt->state >= 0) + waitt++; + + wsprintf (buf1, + "t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n", + CurrentProcess->Threads[ti].ClientId.UniqueThread, + thour, tmin, tsec, thour1, tmin1, tsec1, + statt->desc , waitt->desc); + WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL); + + EnumThreadWindows(PtrToUlong(CurrentProcess->Threads[ti].ClientId.UniqueThread), + (WNDENUMPROC) EnumThreadProc, + (LPARAM)(LPTSTR) szWindowName ); + } + + CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess + + (ULONG_PTR)CurrentProcess->NextEntryOffset); + } + return (0); +} diff --git a/rosapps/sysutils/utils/ps/ps.c.toolhelp b/rosapps/sysutils/utils/ps/ps.c.toolhelp new file mode 100644 index 00000000000..544343a7301 --- /dev/null +++ b/rosapps/sysutils/utils/ps/ps.c.toolhelp @@ -0,0 +1,70 @@ +/* $Id$ + * + * ReactOS ps - process list console viewer + * + * ps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +static char* title = " PID PARENT TIME NAME\n"; +char buf[256]; + +int main() +{ + DWORD r; + HANDLE pl; + PROCESSENTRY32 pe; + HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE); + + WriteFile(stdout, title, lstrlen(title), &r, NULL); + pl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + pe.dwSize = sizeof(PROCESSENTRY32); + pe.th32ParentProcessID = 0; + + if (Process32First(pl, &pe)) do { + int hour; + int minute; + WORD fatdate; + WORD fattime; + HANDLE p = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pe.th32ProcessID); + FILETIME cr; + FILETIME ex; + FILETIME kt; + FILETIME ut; + GetProcessTimes(p, &cr, &ex, &kt, &ut); + FileTimeToDosDateTime(&cr, &fatdate, &fattime); + hour = (fattime & 0xf800) >> 11; + minute = (fattime & 0x07e0) >> 5; + wsprintf(buf,"%08X %08X %2d:%02d %s\n", pe.th32ProcessID, pe.th32ParentProcessID, hour, minute, pe.szExeFile); + WriteFile(stdout, buf, lstrlen(buf), &r, NULL); + CloseHandle(p); + pe.th32ParentProcessID = 0; + } while (Process32Next(pl, &pe)); + + CloseHandle(pl); +} +/* +BOOL +STDCALL +FileTimeToDosDateTime( + CONST FILETIME *lpFileTime, + LPWORD lpFatDate, + LPWORD lpFatTime + ); + */ diff --git a/rosapps/sysutils/utils/ps/ps.rbuild b/rosapps/sysutils/utils/ps/ps.rbuild new file mode 100644 index 00000000000..dbb0d7fd8ee --- /dev/null +++ b/rosapps/sysutils/utils/ps/ps.rbuild @@ -0,0 +1,8 @@ + + . + + user32 + kernel32 + ntdll + ps.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/rosperf/alphablend.c b/rosapps/sysutils/utils/rosperf/alphablend.c new file mode 100644 index 00000000000..d517f369491 --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/alphablend.c @@ -0,0 +1,88 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include "rosperf.h" + +typedef struct _ALPHABLEND_CONTEXT { + HDC BitmapDc; + HBITMAP Bitmap; +} ALPHABLEND_CONTEXT, *PALPHABLEND_CONTEXT; + +unsigned +AlphaBlendInit(void **Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + PALPHABLEND_CONTEXT ctx = HeapAlloc(GetProcessHeap(), 0, sizeof (ALPHABLEND_CONTEXT)); + INT x, y; + + ctx->BitmapDc = CreateCompatibleDC(PerfInfo->BackgroundDc); + ctx->Bitmap = CreateCompatibleBitmap(PerfInfo->BackgroundDc, PerfInfo->WndWidth, PerfInfo->WndHeight); + SelectObject(ctx->BitmapDc, ctx->Bitmap); + + for (y = 0; y < PerfInfo->WndHeight; y++) + { + for (x = 0; x < PerfInfo->WndWidth; x++) + { + SetPixel(ctx->BitmapDc, x, y, RGB(0xff, 0x00, 0x00)); + } + } + + *Context = ctx; + + return Reps; +} + +void +AlphaBlendCleanup(void *Context, PPERF_INFO PerfInfo) +{ + PALPHABLEND_CONTEXT ctx = Context; + DeleteDC(ctx->BitmapDc); + DeleteObject(ctx->Bitmap); + HeapFree(GetProcessHeap(), 0, ctx); +} + + +ULONG +DbgPrint( + IN PCSTR Format, + IN ...); + +void +AlphaBlendProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + PALPHABLEND_CONTEXT ctx = Context; + unsigned Rep; + BLENDFUNCTION BlendFunc = { AC_SRC_OVER, 0, 0, 0 }; + + for (Rep = 0; Rep < Reps; Rep++) + { + BlendFunc.SourceConstantAlpha = 255 * Rep / Reps; +#if 0 + PatBlt(PerfInfo->BackgroundDc, 0, 0, PerfInfo->WndWidth, PerfInfo->WndHeight, PATCOPY); +#endif + if (!AlphaBlend(PerfInfo->BackgroundDc, 0, 0, PerfInfo->WndWidth, PerfInfo->WndHeight, + ctx->BitmapDc, 0, 0, PerfInfo->WndWidth, PerfInfo->WndHeight, + BlendFunc)) + { + DbgPrint("AlphaBlend failed (0x%lx)\n", GetLastError()); + } + } +} + +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/fill.c b/rosapps/sysutils/utils/rosperf/fill.c new file mode 100644 index 00000000000..1e22f03ce7c --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/fill.c @@ -0,0 +1,60 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "rosperf.h" + +void +FillProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + + for (Rep = 0; Rep < Reps; Rep++) + { + PatBlt((Rep & 0x100) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc, 0, 0, + PerfInfo->WndWidth, PerfInfo->WndHeight, PATCOPY); + } +} + +void +FillSmallProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ +#define SMALL_SIZE 16 + unsigned Rep; + int x, y; + + x = 0; + y = 0; + + for (Rep = 0; Rep < Reps; Rep++) + { + PatBlt((Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc, x, y, + SMALL_SIZE, SMALL_SIZE, PATCOPY); + x += SMALL_SIZE + 1; + if (PerfInfo->WndWidth < x + SMALL_SIZE) + { + x = 0; + y += SMALL_SIZE + 1; + if (PerfInfo->WndHeight < y + SMALL_SIZE) + { + y = 0; + } + } + } +} +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/gradient.c b/rosapps/sysutils/utils/rosperf/gradient.c new file mode 100644 index 00000000000..4ba2c93da2a --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/gradient.c @@ -0,0 +1,154 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program (gradient.c) + * + * Copyright 2006 Timo Kreuzer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "rosperf.h" + +void +GradientProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + HDC Dc; + TRIVERTEX vert[6]; + static GRADIENT_TRIANGLE gcap[4]; + + Dc = PerfInfo->ForegroundDc; + vert[0].x = 0; + vert[0].y = 0; + vert[0].Red = 0xff00; + vert[0].Green = 0; + vert[0].Blue = 0; + vert[0].Alpha = 0; + vert[1].x = PerfInfo->WndWidth;; + vert[1].y = 0; + vert[1].Red = 0; + vert[1].Green = 0xff00; + vert[1].Blue = 0; + vert[1].Alpha = 0; + vert[2].x = PerfInfo->WndWidth; + vert[2].y = PerfInfo->WndHeight; + vert[2].Red = 0; + vert[2].Green = 0; + vert[2].Blue = 0xff00; + vert[2].Alpha = 0; + vert[3].x = 0; + vert[3].y = PerfInfo->WndHeight; + vert[3].Red = 0; + vert[3].Green = 0xff00; + vert[3].Blue = 0; + vert[3].Alpha = 0; + vert[4].Red = 0; + vert[4].Green = 0; + vert[4].Blue = 0; + vert[4].Alpha = 0; + vert[5].Red = 0; + vert[5].Green = 0; + vert[5].Blue = 0; + vert[5].Alpha = 0; + + for (Rep = 0; Rep < Reps; Rep++) + { + switch (2 * Rep / Reps) + { + case 0: + vert[4].x = PerfInfo->WndWidth * 2 * Rep / Reps; + vert[4].y = 0; + vert[5].x = PerfInfo->WndWidth - vert[4].x; + vert[5].y = PerfInfo->WndHeight; + gcap[0].Vertex1 = 5; gcap[0].Vertex2 = 0; gcap[0].Vertex3 = 4; + gcap[1].Vertex1 = 5; gcap[1].Vertex2 = 4; gcap[1].Vertex3 = 1; + gcap[2].Vertex1 = 5; gcap[2].Vertex2 = 1; gcap[2].Vertex3 = 2; + gcap[3].Vertex1 = 5; gcap[3].Vertex2 = 3; gcap[3].Vertex3 = 0; + break; + case 1: + vert[4].x = PerfInfo->WndWidth; + vert[4].y = PerfInfo->WndHeight * 2 * Rep / Reps - PerfInfo->WndHeight; + vert[5].x = 0; + vert[5].y = PerfInfo->WndHeight - vert[4].y; + gcap[0].Vertex1 = 5; gcap[0].Vertex2 = 1; gcap[0].Vertex3 = 4; + gcap[1].Vertex1 = 5; gcap[1].Vertex2 = 4; gcap[1].Vertex3 = 2; + gcap[2].Vertex1 = 5; gcap[2].Vertex2 = 2; gcap[2].Vertex3 = 3; + gcap[3].Vertex1 = 5; gcap[3].Vertex2 = 0; gcap[3].Vertex3 = 1; + break; + } + + GradientFill(Dc, vert, 6, &gcap, 4, GRADIENT_FILL_TRIANGLE); + } +} + +void +GradientHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + HDC Dc; + TRIVERTEX vert[2]; + static GRADIENT_RECT gcap = {0, 1}; + + Dc = PerfInfo->ForegroundDc; + for (Rep = 0; Rep < Reps; Rep++) + { + vert[0].x = 0; + vert[0].y = 0; + vert[0].Red = 0xff00; + vert[0].Green = 0xff00 - 0xff00 * Rep / Reps; + vert[0].Blue = 0xff00 * Rep / Reps; + vert[0].Alpha = 0; + + vert[1].x = PerfInfo->WndWidth; + vert[1].y = PerfInfo->WndHeight; + vert[1].Red = 0xff00 - 0xff00 * Rep / Reps; + vert[1].Green = 0xff00 * Rep / Reps; + vert[1].Blue = 0xff00; + vert[1].Alpha = 0; + + GradientFill(Dc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H); + } +} + +void +GradientVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + HDC Dc; + TRIVERTEX vert[2]; + static GRADIENT_RECT gcap = {0, 1}; + + Dc = PerfInfo->ForegroundDc; + for (Rep = 0; Rep < Reps; Rep++) + { + vert[0].x = 0; + vert[0].y = 0; + vert[0].Red = 0xff00 * Rep / Reps; + vert[0].Green = 0xff00 - 0xff00 * Rep / Reps; + vert[0].Blue = 0xff00; + vert[0].Alpha = 0; + + vert[1].x = PerfInfo->WndWidth; + vert[1].y = PerfInfo->WndHeight; + vert[1].Red = 0xff00 - 0xff00 * Rep / Reps; + vert[1].Green = 0xff00; + vert[1].Blue = 0xff00 * Rep / Reps; + vert[1].Alpha = 0; + + GradientFill(Dc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_V); + } +} + +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/lines.c b/rosapps/sysutils/utils/rosperf/lines.c new file mode 100644 index 00000000000..1465935aef0 --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/lines.c @@ -0,0 +1,97 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "rosperf.h" + +void +LinesProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + int Dest; + HDC Dc; + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x1000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + + for (Dest = 2; Dest < PerfInfo->WndHeight && Rep < Reps; Rep++, Dest += 2) + { + MoveToEx(Dc, 0, 0, NULL); + LineTo(Dc, PerfInfo->WndWidth, Dest); + } + + for (Dest = PerfInfo->WndWidth - 2; 0 <= Dest && Rep < Reps; Rep++, Dest -= 2) + { + MoveToEx(Dc, PerfInfo->WndWidth, 0, NULL); + LineTo(Dc, Dest, PerfInfo->WndHeight); + } + + for (Dest = PerfInfo->WndHeight - 2; 0 <= Dest && Rep < Reps; Rep++, Dest -= 2) + { + MoveToEx(Dc, PerfInfo->WndWidth, PerfInfo->WndHeight, NULL); + LineTo(Dc, 0, Dest); + } + + for (Dest = 2; Dest < PerfInfo->WndWidth && Rep < Reps; Rep++, Dest += 2) + { + MoveToEx(Dc, 0, PerfInfo->WndHeight, NULL); + LineTo(Dc, Dest, 0); + } + } +} + +void +LinesHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + int y; + HDC Dc; + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + + for (y = 0; y < PerfInfo->WndHeight && Rep < Reps; Rep++, y += 3) + { + MoveToEx(Dc, 0, y, NULL); + LineTo(Dc, PerfInfo->WndWidth, y); + } + } +} + +void +LinesVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + int x; + HDC Dc; + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x1000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + + for (x = 0; x < PerfInfo->WndWidth && Rep < Reps; Rep++, x += 3) + { + MoveToEx(Dc, x, 0, NULL); + LineTo(Dc, x, PerfInfo->WndHeight); + } + } +} + +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/rosperf.c b/rosapps/sysutils/utils/rosperf/rosperf.c new file mode 100644 index 00000000000..91cd0d5f0aa --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/rosperf.c @@ -0,0 +1,923 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Ideas copied from x11perf: + * + * Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#include "rosperf.h" + +#define MAINWND_WIDTH 400 +#define MAINWND_HEIGHT 400 + +static HWND LabelWnd; + +unsigned +NullInit(void **Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + *Context = NULL; + + return Reps; +} + +void +NullCleanup(void *Context, PPERF_INFO PerfInfo) +{ +} + +static void +ProcessMessages(void) +{ + MSG Msg; + + while (PeekMessageW(&Msg, NULL, 0, 0, PM_REMOVE)) + { + if (WM_QUIT == Msg.message) + { + exit(Msg.wParam); + } + TranslateMessage(&Msg); + DispatchMessageW(&Msg); + } +} + +static void +ClearWindow(PPERF_INFO PerfInfo) +{ + InvalidateRect(PerfInfo->Wnd, NULL, TRUE); + UpdateWindow(PerfInfo->Wnd); +} + +static unsigned +CalibrateTest(PTEST Test, PPERF_INFO PerfInfo) +{ +#define GOAL 2500 /* Try to get up to 2.5 seconds */ +#define ENOUGH 2000 /* But settle for 2.0 seconds */ +#define TICK 10 /* Assume clock not faster than .01 seconds */ + + unsigned Reps, DidReps; /* Reps desired, reps performed */ + unsigned Exponent; + void *Context; + DWORD StartTick; + DWORD Duration; + + /* Attempt to get an idea how long each rep lasts by getting enough + reps to last more than ENOUGH. Then scale that up to the number of + seconds desired. + + If init call to test ever fails, return False and test will be skipped. + */ + + Reps = 1; + for (;;) + { + ClearWindow(PerfInfo); + DidReps = (*Test->Init)(&Context, PerfInfo, Reps); + ProcessMessages(); + if (0 == DidReps) + { + return 0; + } + StartTick = GetTickCount(); + (*Test->Proc)(Context, PerfInfo, Reps); + Duration = GetTickCount() - StartTick; + (*Test->PassCleanup) (Context, PerfInfo); + (*Test->Cleanup)(Context, PerfInfo); + ProcessMessages(); + + if (DidReps != Reps) + { + /* The test can't do the number of reps as we asked for. + Give up */ + return DidReps; + } + /* Did we go long enough? */ + if (ENOUGH <= Duration) + { + break; + } + + /* Don't let too short a clock make new reps wildly high */ + if (Duration <= TICK) + { + Reps *= 10; + } + else + { + /* Try to get up to GOAL seconds. */ + Reps = (int)(GOAL * (double) Reps / (double) Duration) + 1; + } + } + + Reps = (int) ((double) PerfInfo->Seconds * 1000.0 * (double) Reps / (double) Duration) + 1; + + /* Now round reps up to 1 digit accuracy, so we don't get stupid-looking + numbers of repetitions. */ + Reps--; + Exponent = 1; + while (9 < Reps) + { + Reps /= 10; + Exponent *= 10; + } + Reps = (Reps + 1) * Exponent; + + return Reps; +} + +static void +DisplayStatus(HWND Label, LPCWSTR Message, LPCWSTR Test, int Try) +{ + WCHAR Status[128]; + + snwprintf(Status, sizeof(Status) / sizeof(Status[0]), L"%d %s %s", Try, Message, Test); + SetWindowTextW(Label, Status); + InvalidateRect(Label, NULL, TRUE); + UpdateWindow(Label); +} + +static double +RoundTo3Digits(double d) +{ + /* It's kind of silly to print out things like ``193658.4/sec'' so just + junk all but 3 most significant digits. */ + + double exponent, sign; + + exponent = 1.0; + /* the code below won't work if d should happen to be non-positive. */ + if (d < 0.0) + { + d = -d; + sign = -1.0; + } + else + { + sign = 1.0; + } + + if (1000.0 <= d) + { + do + { + exponent *= 10.0; + } + while (1000.0 <= d / exponent); + d = (double)((int)(d / exponent + 0.5)); + d *= exponent; + } + else + { + if (0.0 != d) + { + while (d * exponent < 100.0) + { + exponent *= 10.0; + } + } + d = (double)((int)(d * exponent + 0.5)); + d /= exponent; + } + + return d * sign; +} + +static void +ReportTimes(DWORD Time, int Reps, LPCWSTR Label, BOOL Average) +{ + double MSecsPerObj, ObjsPerSec; + + if (0 != Time) + { + MSecsPerObj = (double) Time / (double) Reps; + ObjsPerSec = (double) Reps * 1000.0 / (double) Time; + + /* Round obj/sec to 3 significant digits. Leave msec untouched, to + allow averaging results from several repetitions. */ + ObjsPerSec = RoundTo3Digits(ObjsPerSec); + + wprintf(L"%7d %s @ %8.4f msec (%8.1f/sec): %s\n", + Reps, Average ? L"trep" : L"reps", MSecsPerObj, ObjsPerSec, Label); + } + else + { + wprintf(L"%6d %sreps @ 0.0 msec (unmeasurably fast): %s\n", + Reps, Average ? L"t" : L"", Label); + } + +} + +static void +ProcessTest(PTEST Test, PPERF_INFO PerfInfo) +{ + unsigned Reps; + unsigned Repeat; + void *Context; + DWORD StartTick; + DWORD Time, TotalTime; + + DisplayStatus(LabelWnd, L"Calibrating", Test->Label, 0); + Reps = CalibrateTest(Test, PerfInfo); + if (0 == Reps) + { + return; + } + + Reps = Test->Init(&Context, PerfInfo, Reps); + if (0 == Reps) + { + return; + } + TotalTime = 0; + for (Repeat = 0; Repeat < PerfInfo->Repeats; Repeat++) + { + DisplayStatus(LabelWnd, L"Testing", Test->Label, Repeat + 1); + ClearWindow(PerfInfo); + StartTick = GetTickCount(); + (*Test->Proc)(Context, PerfInfo, Reps); + Time = GetTickCount() - StartTick; + ProcessMessages(); + TotalTime += Time; + ReportTimes(Time, Reps, Test->Label, FALSE); + (*Test->PassCleanup)(Context, PerfInfo); + ProcessMessages(); + } + (*Test->Cleanup)(Context, PerfInfo); + ReportTimes(TotalTime, Repeat * Reps, Test->Label, TRUE); + ProcessMessages(); +} + +static void +PrintOSVersion(void) +{ +#define BUFSIZE 160 + OSVERSIONINFOEXW VersionInfo; + BOOL OsVersionInfoEx; + HKEY hKey; + WCHAR ProductType[BUFSIZE]; + DWORD BufLen; + LONG Ret; + unsigned RosVersionLen; + LPWSTR RosVersion; + + /* Try calling GetVersionEx using the OSVERSIONINFOEX structure. + * If that fails, try using the OSVERSIONINFO structure. */ + + ZeroMemory(&VersionInfo, sizeof(OSVERSIONINFOEXW)); + VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); + + OsVersionInfoEx = GetVersionExW((OSVERSIONINFOW *) &VersionInfo); + if (! OsVersionInfoEx) + { + VersionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (! GetVersionExW((OSVERSIONINFOW *) &VersionInfo)) + { + return; + } + } + + RosVersion = VersionInfo.szCSDVersion + wcslen(VersionInfo.szCSDVersion) + 1; + RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) - + (RosVersion - VersionInfo.szCSDVersion); + if (7 <= RosVersionLen && 0 == _wcsnicmp(RosVersion, L"ReactOS", 7)) + { + wprintf(L"Running on %s\n", RosVersion); + return; + } + + switch (VersionInfo.dwPlatformId) + { + /* Test for the Windows NT product family. */ + case VER_PLATFORM_WIN32_NT: + + /* Test for the specific product. */ + if (5 == VersionInfo.dwMajorVersion && 2 == VersionInfo.dwMinorVersion) + { + wprintf(L"Running on Microsoft Windows Server 2003, "); + } + else if (5 == VersionInfo.dwMajorVersion && 1 == VersionInfo.dwMinorVersion) + { + wprintf(L"Running on Microsoft Windows XP "); + } + else if (5 == VersionInfo.dwMajorVersion && 0 == VersionInfo.dwMinorVersion) + { + wprintf(L"Running on Microsoft Windows 2000 "); + } + else if (VersionInfo.dwMajorVersion <= 4 ) + { + wprintf(L"Running on Microsoft Windows NT "); + } + + /* Test for specific product on Windows NT 4.0 SP6 and later. */ + if (OsVersionInfoEx) + { + /* Test for the workstation type. */ + if (VER_NT_WORKSTATION == VersionInfo.wProductType) + { + if (4 == VersionInfo.dwMajorVersion) + { + wprintf(L"Workstation 4.0 "); + } + else if (0 != (VersionInfo.wSuiteMask & VER_SUITE_PERSONAL)) + { + wprintf(L"Home Edition "); + } + else + { + wprintf(L"Professional "); + } + } + + /* Test for the server type. */ + else if (VER_NT_SERVER == VersionInfo.wProductType || + VER_NT_DOMAIN_CONTROLLER == VersionInfo.wProductType) + { + if (5 == VersionInfo.dwMajorVersion && 2 == VersionInfo.dwMinorVersion) + { + if (0 != (VersionInfo.wSuiteMask & VER_SUITE_DATACENTER)) + { + wprintf(L"Datacenter Edition "); + } + else if (0 != (VersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE)) + { + wprintf(L"Enterprise Edition "); + } + else if (VER_SUITE_BLADE == VersionInfo.wSuiteMask) + { + wprintf(L"Web Edition "); + } + else + { + wprintf(L"Standard Edition "); + } + } + + else if (5 == VersionInfo.dwMajorVersion && 0 == VersionInfo.dwMinorVersion) + { + if (0 != (VersionInfo.wSuiteMask & VER_SUITE_DATACENTER)) + { + wprintf(L"Datacenter Server "); + } + else if (0 != (VersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE)) + { + wprintf(L"Advanced Server " ); + } + else + { + wprintf(L"Server " ); + } + } + + else /* Windows NT 4.0 */ + { + if (0 != (VersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE)) + { + wprintf(L"Server 4.0, Enterprise Edition "); + } + else + { + wprintf(L"Server 4.0 "); + } + } + } + } + else /* Test for specific product on Windows NT 4.0 SP5 and earlier */ + { + BufLen = BUFSIZE; + + Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", + 0, KEY_QUERY_VALUE, &hKey); + if (ERROR_SUCCESS != Ret) + { + return; + } + + Ret = RegQueryValueExW(hKey, L"ProductType", NULL, NULL, + (LPBYTE) ProductType, &BufLen); + if (ERROR_SUCCESS != Ret || BUFSIZE < BufLen) + { + return; + } + + RegCloseKey(hKey); + + if (0 == lstrcmpiW(L"WINNT", ProductType)) + { + wprintf(L"Workstation "); + } + else if (0 == lstrcmpiW(L"LANMANNT", ProductType)) + { + wprintf(L"Server "); + } + else if (0 == lstrcmpiW(L"SERVERNT", ProductType)) + { + wprintf(L"Advanced Server "); + } + + wprintf(L"%d.%d ", VersionInfo.dwMajorVersion, VersionInfo.dwMinorVersion); + } + + /* Display service pack (if any) and build number. */ + + if (4 == VersionInfo.dwMajorVersion && + 0 == lstrcmpiW(VersionInfo.szCSDVersion, L"Service Pack 6")) + { + /* Test for SP6 versus SP6a. */ + Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009", + 0, KEY_QUERY_VALUE, &hKey); + if (ERROR_SUCCESS == Ret) + { + wprintf(L"Service Pack 6a (Build %d)\n", VersionInfo.dwBuildNumber & 0xFFFF); + } + else /* Windows NT 4.0 prior to SP6a */ + { + wprintf(L"%s (Build %d)\n", + VersionInfo.szCSDVersion, + VersionInfo.dwBuildNumber & 0xFFFF); + } + + RegCloseKey(hKey); + } + else /* not Windows NT 4.0 */ + { + wprintf(L"%s (Build %d)\n", + VersionInfo.szCSDVersion, + VersionInfo.dwBuildNumber & 0xFFFF); + } + + + break; + + /* Test for the Windows Me/98/95. A bit silly since we're using Unicode... */ + case VER_PLATFORM_WIN32_WINDOWS: + + if (4 == VersionInfo.dwMajorVersion && 0 == VersionInfo.dwMinorVersion) + { + wprintf(L"Running on Microsoft Windows 95 "); + if (L'C' == VersionInfo.szCSDVersion[1] || L'B' == VersionInfo.szCSDVersion[1]) + { + wprintf(L"OSR2"); + } + } + + else if (4 == VersionInfo.dwMajorVersion && 10 == VersionInfo.dwMinorVersion) + { + wprintf(L"Running on Microsoft Windows 98 "); + if (L'A' == VersionInfo.szCSDVersion[1]) + { + wprintf(L"SE"); + } + } + + else if (4 == VersionInfo.dwMajorVersion && 90 == VersionInfo.dwMinorVersion) + { + wprintf(L"Running on Microsoft Windows Millennium Edition"); + } + wprintf(L"\n"); + break; + + case VER_PLATFORM_WIN32s: /* Even silier... */ + + wprintf(L"Running on Microsoft Win32s\n"); + break; + } +} + +static void +PrintAppVersion(void) +{ + wprintf(L"RosPerf %S (Build %S)\n", KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR); +} + +static void +PrintDisplayInfo(void) +{ + HDC Dc; + + Dc = GetDC(NULL); + if (NULL == Dc) + { + return; + } + + wprintf(L"Display settings %d * %d * %d\n", GetDeviceCaps(Dc, HORZRES), + GetDeviceCaps(Dc, VERTRES), GetDeviceCaps(Dc, BITSPIXEL) * GetDeviceCaps(Dc, PLANES)); + + ReleaseDC(NULL, Dc); +} + +static void +PrintStartupInfo(void) +{ + PrintAppVersion(); + PrintOSVersion(); + PrintDisplayInfo(); +} + +static LRESULT CALLBACK +MainWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT Ps; + HDC Dc; + LRESULT Result; + + switch (Msg) + { + case WM_DESTROY: + PostQuitMessage(0); + Result = 0; + break; + + case WM_PAINT: + Dc = BeginPaint(Wnd, &Ps); + EndPaint (Wnd, &Ps); + Result = 0; + break; + + default: + Result = DefWindowProcW(Wnd, Msg, wParam, lParam); + break; + } + + return Result; +} + +static LRESULT CALLBACK +LabelWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT Ps; + HDC Dc; + RECT ClientRect, WindowRect; + TEXTMETRICW Tm; + LRESULT Result; + WCHAR Title[80]; + + switch (Msg) + { + case WM_CREATE: + /* Make text fit */ + Dc = GetDC(Wnd); + if (NULL != Dc && GetClientRect(Wnd, &ClientRect) && GetWindowRect(Wnd, &WindowRect) + && GetTextMetricsW(Dc, &Tm)) + { + if (Tm.tmHeight != ClientRect.bottom) + { + SetWindowPos(Wnd, NULL, 0, 0, WindowRect.right - WindowRect.left, + (WindowRect.bottom - WindowRect.top) + (Tm.tmHeight - ClientRect.bottom), + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); + } + } + if (NULL != Dc) + { + ReleaseDC(Wnd, Dc); + } + Result = DefWindowProcW(Wnd, Msg, wParam, lParam); + break; + + case WM_PAINT: + Dc = BeginPaint(Wnd, &Ps); + GetWindowTextW(Wnd, Title, sizeof(Title) / sizeof(Title[0])); + TextOutW(Dc, 0, 0, Title, wcslen(Title)); + EndPaint (Wnd, &Ps); + Result = 0; + break; + + default: + Result = DefWindowProcW(Wnd, Msg, wParam, lParam); + break; + } + + return Result; +} + +static HWND +CreatePerfWindows(HINSTANCE hInstance, PPERF_INFO PerfInfo) +{ + WNDCLASSW wc; + HWND MainWnd; + + wc.lpszClassName = L"RosPerfMain"; + wc.lpfnWndProc = MainWndProc; + wc.style = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIconW(NULL, (LPCWSTR) IDI_APPLICATION); + wc.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); + wc.hbrBackground = CreateSolidBrush(PerfInfo->BackgroundColor); + wc.lpszMenuName = NULL; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + if (RegisterClassW(&wc) == 0) + { + fwprintf(stderr, L"Failed to register RosPerfMain (last error %d)\n", + GetLastError()); + return NULL; + } + + wc.lpszClassName = L"RosPerfLabel"; + wc.lpfnWndProc = LabelWndProc; + wc.style = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIconW(NULL, (LPCWSTR) IDI_APPLICATION); + wc.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + if (RegisterClassW(&wc) == 0) + { + fwprintf(stderr, L"Failed to register RosPerfLabel (last error %d)\n", + GetLastError()); + return NULL; + } + + MainWnd = CreateWindowW(L"RosPerfMain", + L"ReactOS performance test", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, + 0, + MAINWND_WIDTH, + MAINWND_HEIGHT, + NULL, + NULL, + hInstance, + NULL); + if (NULL == MainWnd) + { + fwprintf(stderr, L"Failed to create main window (last error %d)\n", + GetLastError()); + return NULL; + } + + LabelWnd = CreateWindowW(L"RosPerfLabel", + L"", + WS_POPUP | WS_THICKFRAME | WS_VISIBLE, + 0, + MAINWND_HEIGHT + 10, + MAINWND_WIDTH, + 20, + MainWnd, + NULL, + hInstance, + NULL); + if (NULL == LabelWnd) + { + fwprintf(stderr, L"Failed to create label window (last error 0x%lX)\n", + GetLastError()); + return NULL; + } + + SetActiveWindow(MainWnd); + + return MainWnd; +} + +static BOOL +ProcessCommandLine(PPERF_INFO PerfInfo, unsigned *TestCount, PTEST *Tests) +{ + int ArgC, Arg; + LPWSTR *ArgV; + LPWSTR EndPtr; + PTEST AllTests; + BOOL *DoTest; + BOOL DoAll; + unsigned AllTestCount, i, j; + + ArgV = CommandLineToArgvW(GetCommandLineW(), &ArgC); + if (NULL == ArgV) + { + fwprintf(stderr, L"CommandLineToArgvW failed\n"); + return FALSE; + } + + GetTests(&AllTestCount, &AllTests); + DoTest = malloc(AllTestCount * sizeof(BOOL)); + if (NULL == DoTest) + { + fwprintf(stderr, L"Out of memory\n"); + return FALSE; + } + DoAll = TRUE; + + for (Arg = 1; Arg < ArgC; Arg++) + { + if (L'/' == ArgV[Arg][0] || L'-' == ArgV[Arg][0]) + { + if (0 == _wcsicmp(ArgV[Arg] + 1, L"repeat")) + { + if (ArgC <= Arg + 1) + { + fwprintf(stderr, L"%s needs a repeat count\n", ArgV[Arg]); + free(DoTest); + GlobalFree(ArgV); + return FALSE; + } + Arg++; + PerfInfo->Repeats = wcstoul(ArgV[Arg], &EndPtr, 0); + if (L'\0' != *EndPtr || (long) PerfInfo->Repeats <= 0 || ULONG_MAX == PerfInfo->Repeats) + { + fwprintf(stderr, L"Invalid repeat count %s\n", ArgV[Arg]); + free(DoTest); + GlobalFree(ArgV); + return FALSE; + } + } + else if (0 == _wcsicmp(ArgV[Arg] + 1, L"seconds")) + { + if (ArgC <= Arg + 1) + { + fwprintf(stderr, L"%s needs a number of seconds\n", ArgV[Arg]); + free(DoTest); + GlobalFree(ArgV); + return FALSE; + } + Arg++; + PerfInfo->Seconds = wcstoul(ArgV[Arg], &EndPtr, 0); + if (L'\0' != *EndPtr || (long) PerfInfo->Seconds < 0 || ULONG_MAX == PerfInfo->Seconds) + { + fwprintf(stderr, L"Invalid duration %s\n", ArgV[Arg]); + free(DoTest); + GlobalFree(ArgV); + return FALSE; + } + } + else + { + fwprintf(stderr, L"Unrecognized option %s\n", ArgV[Arg]); + free(DoTest); + GlobalFree(ArgV); + return FALSE; + } + } + else + { + if (DoAll) + { + for (i = 0; i < AllTestCount; i++) + { + DoTest[i] = FALSE; + } + DoAll = FALSE; + } + for (i = 0; i < AllTestCount; i++) + { + if (0 == _wcsicmp(ArgV[Arg], AllTests[i].Option)) + { + DoTest[i] = TRUE; + break; + } + } + if (AllTestCount <= i) + { + fwprintf(stderr, L"Unrecognized test %s\n", ArgV[Arg]); + free(DoTest); + GlobalFree(ArgV); + return FALSE; + } + } + } + + GlobalFree(ArgV); + + if (DoAll) + { + for (i = 0; i < AllTestCount; i++) + { + DoTest[i] = TRUE; + } + } + + *TestCount = 0; + for (i = 0; i < AllTestCount; i++) + { + if (DoTest[i]) + { + (*TestCount)++; + } + } + *Tests = malloc(*TestCount * sizeof(TEST)); + if (NULL == *Tests) + { + fwprintf(stderr, L"Out of memory\n"); + free(DoTest); + return FALSE; + } + j = 0; + for (i = 0; i < AllTestCount; i++) + { + if (DoTest[i]) + { + (*Tests)[j] = AllTests[i]; + j++; + } + } + free(DoTest); + + return TRUE; +} + +int WINAPI +WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, + int nCmdShow) +{ + PTEST Tests; + unsigned TestCount; + unsigned CurrentTest; + RECT Rect; + PERF_INFO PerfInfo; + + PrintStartupInfo(); + + PerfInfo.Seconds = 15; + PerfInfo.Repeats = 4; + PerfInfo.ForegroundColor = RGB(0, 0, 0); + PerfInfo.BackgroundColor = RGB(255, 255, 255); + + if (! ProcessCommandLine(&PerfInfo, &TestCount, &Tests)) + { + exit(1); + } + + PerfInfo.Wnd = CreatePerfWindows(hInstance, &PerfInfo); + if (NULL == PerfInfo.Wnd) + { + exit(1); + } + + GetClientRect(PerfInfo.Wnd, &Rect); + PerfInfo.WndWidth = Rect.right - Rect.left; + PerfInfo.WndHeight = Rect.bottom - Rect.top; + PerfInfo.ForegroundDc = GetDC(PerfInfo.Wnd); + PerfInfo.BackgroundDc = GetDC(PerfInfo.Wnd); + if (NULL == PerfInfo.ForegroundDc || NULL == PerfInfo.BackgroundDc) + { + fwprintf(stderr, L"Failed to create device contexts (last error %d)\n", + GetLastError()); + exit(1); + } + SelectObject(PerfInfo.ForegroundDc, CreateSolidBrush(PerfInfo.ForegroundColor)); + SelectObject(PerfInfo.ForegroundDc, CreatePen(PS_SOLID, 0, PerfInfo.ForegroundColor)); + SelectObject(PerfInfo.BackgroundDc, CreateSolidBrush(PerfInfo.BackgroundColor)); + SelectObject(PerfInfo.BackgroundDc, CreatePen(PS_SOLID, 0, PerfInfo.BackgroundColor)); + + ProcessMessages(); + + /* Move cursor out of the way */ + GetWindowRect(LabelWnd, &Rect); + SetCursorPos(Rect.right, Rect.bottom); + + for (CurrentTest = 0; CurrentTest < TestCount; CurrentTest++) + { + wprintf(L"\n"); + ProcessTest(Tests + CurrentTest, &PerfInfo); + } + + GlobalFree(Tests); + + return 0; +} + +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/rosperf.h b/rosapps/sysutils/utils/rosperf/rosperf.h new file mode 100644 index 00000000000..2eddc01082b --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/rosperf.h @@ -0,0 +1,74 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef ROSPERF_H_INCLUDED +#define ROSPERF_H_INCLUDED + +typedef struct tagPERF_INFO +{ + HWND Wnd; + unsigned Seconds; + unsigned Repeats; + COLORREF ForegroundColor; + COLORREF BackgroundColor; + HDC ForegroundDc; + HDC BackgroundDc; + INT WndWidth; + INT WndHeight; +} PERF_INFO, *PPERF_INFO; + +typedef unsigned (*INITTESTPROC)(void **Context, PPERF_INFO PerfInfo, unsigned Reps); +typedef void (*TESTPROC)(void *Context, PPERF_INFO PerfInfo, unsigned Reps); +typedef void (*CLEANUPTESTPROC)(void *Context, PPERF_INFO PerfInfo); + +typedef struct tagTEST +{ + LPCWSTR Option; + LPCWSTR Label; + INITTESTPROC Init; + TESTPROC Proc; + CLEANUPTESTPROC PassCleanup; + CLEANUPTESTPROC Cleanup; +} TEST, *PTEST; + +void GetTests(unsigned *TestCount, PTEST *Tests); + +/* Tests */ +unsigned NullInit(void **Context, PPERF_INFO PerfInfo, unsigned Reps); +void NullCleanup(void *Context, PPERF_INFO PerfInfo); + +void FillProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); +void FillSmallProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); + +void LinesHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); +void LinesVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); +void LinesProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); + +void TextProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); + +unsigned AlphaBlendInit(void **Context, PPERF_INFO PerfInfo, unsigned Reps); +void AlphaBlendCleanup(void *Context, PPERF_INFO PerfInfo); +void AlphaBlendProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); + +void GradientHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); +void GradientVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); +void GradientProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps); + +#endif /* ROSPERF_H_INCLUDED */ + +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/rosperf.rbuild b/rosapps/sysutils/utils/rosperf/rosperf.rbuild new file mode 100644 index 00000000000..68882be0425 --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/rosperf.rbuild @@ -0,0 +1,22 @@ + + . + + + 0x0501 + version + msimg32 + gdi32 + shell32 + advapi32 + user32 + kernel32 + ntdll + rosperf.c + lines.c + fill.c + text.c + alphablend.c + testlist.c + gradient.c + rosperf.rc + diff --git a/rosapps/sysutils/utils/rosperf/rosperf.rc b/rosapps/sysutils/utils/rosperf/rosperf.rc new file mode 100644 index 00000000000..26841ca1d03 --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/rosperf.rc @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS performance tester\0" +#define REACTOS_STR_INTERNAL_NAME "rosperf\0" +#define REACTOS_STR_ORIGINAL_FILENAME "rosperf.exe\0" +#include diff --git a/rosapps/sysutils/utils/rosperf/testlist.c b/rosapps/sysutils/utils/rosperf/testlist.c new file mode 100644 index 00000000000..f008fc1b4b1 --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/testlist.c @@ -0,0 +1,44 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "rosperf.h" + +static TEST TestList[] = + { + { L"fill", L"Fill", NullInit, FillProc, NullCleanup, NullCleanup }, + { L"smallfill", L"Small Fill", NullInit, FillSmallProc, NullCleanup, NullCleanup }, + { L"hlines", L"Horizontal Lines", NullInit, LinesHorizontalProc, NullCleanup, NullCleanup }, + { L"vlines", L"Vertical Lines", NullInit, LinesVerticalProc, NullCleanup, NullCleanup }, + { L"lines", L"Lines", NullInit, LinesProc, NullCleanup, NullCleanup }, + { L"text", L"Text", NullInit, TextProc, NullCleanup, NullCleanup }, + { L"alpha", L"Alpha Blend", AlphaBlendInit, AlphaBlendProc, NullCleanup, AlphaBlendCleanup }, + { L"hgradient", L"Horizontal Gradient", NullInit, GradientHorizontalProc, NullCleanup, NullCleanup }, + { L"vgradient", L"Vertical Gradient", NullInit, GradientVerticalProc, NullCleanup, NullCleanup }, + { L"gradient", L"Gradient", NullInit, GradientProc, NullCleanup, NullCleanup } + }; + + +void +GetTests(unsigned *TestCount, PTEST *Tests) + { + *TestCount = sizeof(TestList) / sizeof(TEST); + *Tests = TestList; + } + +/* EOF */ diff --git a/rosapps/sysutils/utils/rosperf/text.c b/rosapps/sysutils/utils/rosperf/text.c new file mode 100644 index 00000000000..4c0bed416d0 --- /dev/null +++ b/rosapps/sysutils/utils/rosperf/text.c @@ -0,0 +1,44 @@ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "rosperf.h" + +void +TextProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + int y; + HDC Dc = NULL; + HFONT hfFont = GetStockObject(DEFAULT_GUI_FONT); + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + SelectObject(Dc, hfFont); + + for (y = 0; y < PerfInfo->WndHeight && Rep < Reps; Rep++, y += 15) + { + TextOut(Dc, 0, y, L"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:?<>0123456789", 66); + } + InvalidateRect(PerfInfo->Wnd, NULL, TRUE); + UpdateWindow(PerfInfo->Wnd); + } +} + +/* EOF */ diff --git a/rosapps/sysutils/utils/sdkparse/EnumDirs.h b/rosapps/sysutils/utils/sdkparse/EnumDirs.h new file mode 100644 index 00000000000..1c9507a8918 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/EnumDirs.h @@ -0,0 +1,15 @@ +// +// EnumDirs.h +// + +#ifndef __ENUMDIRS_H +#define __ENUMDIRS_H + +//#include "win.h" +#define WIN32_LEAN_AND_MEAN +#include + +typedef BOOL (*MYENUMDIRSPROC) ( PWIN32_FIND_DATA, long ); +BOOL EnumDirs ( const TCHAR* szDirectory, const TCHAR* szFileSpec, MYENUMDIRSPROC pProc, long lParam ); + +#endif//__ENUMDIRS_H diff --git a/rosapps/sysutils/utils/sdkparse/EnumDirsImpl.h b/rosapps/sysutils/utils/sdkparse/EnumDirsImpl.h new file mode 100644 index 00000000000..23ac3a14e36 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/EnumDirsImpl.h @@ -0,0 +1,42 @@ +// +// EnumDirs.cpp +// + +#include "EnumDirs.h" +#include + +#if defined(UNDER_CE) && !defined(assert) +#define assert(x) +#endif + +BOOL EnumDirs ( const TCHAR* szDirectory_, const TCHAR* szFileSpec, MYENUMDIRSPROC pProc, long lParam ) +{ + assert ( szDirectory_ && szFileSpec && pProc ); + TCHAR szDirectory[MAX_PATH+1]; + TCHAR szSearchPath[MAX_PATH+1]; + TCHAR szTemp[MAX_PATH+1]; + _tcscpy ( szDirectory, szDirectory_ ); + if ( szDirectory[_tcslen(szDirectory)-1] != '\\' ) + _tcscat ( szDirectory, _T("\\") ); + _sntprintf ( szSearchPath, _MAX_PATH, _T("%s%s"), szDirectory, szFileSpec ); + WIN32_FIND_DATA wfd; + HANDLE hfind = FindFirstFile ( szSearchPath, &wfd ); + if ( hfind == INVALID_HANDLE_VALUE ) + return TRUE; + do + { + if ( !_tcscmp ( wfd.cFileName, _T(".") ) || !_tcscmp ( wfd.cFileName, _T("..") ) ) + continue; + _sntprintf ( szTemp, _MAX_PATH, _T("%s%s"), szDirectory, wfd.cFileName ); + if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { + if ( !pProc ( &wfd, lParam ) ) + { + FindClose ( hfind ); + return FALSE; + } + } + } while ( FindNextFile ( hfind, &wfd ) ); + FindClose ( hfind ); + return TRUE; +} diff --git a/rosapps/sysutils/utils/sdkparse/EnumFiles.h b/rosapps/sysutils/utils/sdkparse/EnumFiles.h new file mode 100644 index 00000000000..8b2994644cf --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/EnumFiles.h @@ -0,0 +1,11 @@ +// +// EnumFiles.h +// + +#ifndef ENUMFILES_H +#define ENUMFILES_H + +typedef BOOL (*MYENUMFILESPROC) ( PWIN32_FIND_DATA, const TCHAR*, long ); +BOOL EnumFilesInDirectory ( const TCHAR* szDirectory, const TCHAR* szFileSpec, MYENUMFILESPROC pProc, long lParam, BOOL bSubsToo, BOOL bSubsMustMatchFileSpec = FALSE ); + +#endif//ENUMFILES_H diff --git a/rosapps/sysutils/utils/sdkparse/EnumFilesImpl.h b/rosapps/sysutils/utils/sdkparse/EnumFilesImpl.h new file mode 100644 index 00000000000..dbfba7c67d6 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/EnumFilesImpl.h @@ -0,0 +1,92 @@ +// +// EnumFilesImpl.h +// + +#include "EnumFiles.h" +#include "FixLFN.h" +#include "safestr.h" +#ifndef UNDER_CE +#include +#endif//UNDER_CE +#include + +BOOL EnumFilesInDirectory ( const TCHAR* szDirectory_, const TCHAR* szFileSpec, MYENUMFILESPROC pProc, long lParam, BOOL bSubsToo, BOOL bSubsMustMatchFileSpec ) +{ + TCHAR szDirectory[MAX_PATH+1]; + TCHAR szSearchPath[MAX_PATH+1]; + TCHAR szTemp[MAX_PATH+1]; + + if ( safestrlen(szDirectory_) > MAX_PATH || !szFileSpec || !pProc ) + return FALSE; + if ( szDirectory_ ) + _tcscpy ( szDirectory, szDirectory_ ); + else +#ifdef UNDER_CE + _tcscpy ( szDirectory, _T("") ); +#else//UNDER_CE + getcwd ( szDirectory, sizeof(szDirectory)-1 ); +#endif//UNDER_CE + int dirlen = _tcslen(szDirectory); + if ( dirlen > 0 && szDirectory[dirlen-1] != '\\' ) + _tcscat ( szDirectory, _T("\\") ); + + // first search for all files in directory that match szFileSpec... + _sntprintf ( szSearchPath, sizeof(szSearchPath)-1, _T("%s%s"), szDirectory, szFileSpec ); + WIN32_FIND_DATA wfd; + HANDLE hfind = FindFirstFile ( szSearchPath, &wfd ); + if ( hfind != INVALID_HANDLE_VALUE ) + { + do + { + if ( !_tcscmp ( wfd.cFileName, _T(".") ) || !_tcscmp ( wfd.cFileName, _T("..") ) ) + continue; + if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { + if ( !bSubsMustMatchFileSpec ) + continue; + _sntprintf ( szTemp, sizeof(szTemp)-1, _T("%s%s"), szDirectory, wfd.cFileName ); + if ( bSubsToo ) + { + if ( !EnumFilesInDirectory ( szTemp, szFileSpec, pProc, lParam, bSubsToo, bSubsMustMatchFileSpec ) ) + { + FindClose ( hfind ); + return FALSE; + } + } + } + _sntprintf ( szTemp, sizeof(szTemp)-1, _T("%s%s"), szDirectory, wfd.cFileName ); + FixLFN(szTemp,szTemp); + if ( !pProc ( &wfd, szTemp, lParam ) ) + { + FindClose ( hfind ); + return FALSE; + } + } while ( FindNextFile ( hfind, &wfd ) ); + FindClose ( hfind ); + } + if ( !bSubsToo || bSubsMustMatchFileSpec ) + return TRUE; + + // now search for all subdirectories... + _sntprintf ( szSearchPath, sizeof(szSearchPath)-1, _T("%s*.*"), szDirectory ); + hfind = FindFirstFile ( szSearchPath, &wfd ); + if ( hfind != INVALID_HANDLE_VALUE ) + { + do + { + if ( !_tcscmp ( wfd.cFileName, _T(".") ) || !_tcscmp ( wfd.cFileName, _T("..") ) ) + continue; + if ( !(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) + continue; + _sntprintf ( szTemp, sizeof(szTemp)-1, _T("%s%s"), szDirectory, wfd.cFileName ); + if ( FALSE == EnumFilesInDirectory ( szTemp, szFileSpec, pProc, lParam, bSubsToo, bSubsMustMatchFileSpec ) ) + { + FindClose ( hfind ); + return FALSE; + } + } while ( FindNextFile ( hfind, &wfd ) ); + FindClose ( hfind ); + } + + return TRUE; +} diff --git a/rosapps/sysutils/utils/sdkparse/File.cpp b/rosapps/sysutils/utils/sdkparse/File.cpp new file mode 100644 index 00000000000..4dac41cb428 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/File.cpp @@ -0,0 +1,129 @@ +// File.cpp +// This file is (C) 2002-2003 Royce Mitchell III and released under the BSD license + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#include "File.h" + +bool File::open ( const char* filename, const char* mode ) +{ + close(); + _f = fopen ( filename, mode ); + return _f != 0; +} + +std::string File::getline ( bool strip_crlf /*= false*/ ) +{ + std::string s = ""; + char buf[256]; + for ( ;; ) + { + *buf = 0; + fgets ( buf, sizeof(buf)-1, _f ); + if ( !*buf ) + break; + s += buf; + if ( strchr ( "\r\n", buf[strlen(buf)-1] ) ) + break; + } + if ( strip_crlf ) + { + char* p = strpbrk ( &s[0], "\r\n" ); + if ( p ) + { + *p = '\0'; + s.resize ( p-&s[0] ); + } + } + return s; +} + +// this function searches for the next end-of-line and puts all data it +// finds until then in the 'line' parameter. +// +// call continuously until the function returns false ( no more data ) +bool File::next_line ( std::string& line, bool strip_crlf ) +{ + line = getline(strip_crlf); + // indicate that we're done *if*: + // 1) there's no more data, *and* + // 2) we're at the end of the file + return line.size()>0 || !eof(); +} + +/* +example usage: + +bool mycallback ( const std::string& line, int line_number, long lparam ) +{ + std::cout << line << std::endl; + return true; // continue enumeration +} + +File f ( "file.txt", "rb" ); // open file for binary read-only ( i.e. "rb" ) +f.enum_lines ( mycallback, 0, true ); +*/ + +bool File::enum_lines ( bool (*callback)(const std::string& line, int line_number, long lparam), long lparam, bool strip_crlf ) +{ + int line_number = 0; + for ( ;; ) + { + std::string s = getline(strip_crlf); + line_number++; + if ( !s.size() ) + { + if ( eof() ) + return true; + else + continue; + } + if ( !(*callback) ( s, line_number, lparam ) ) + return false; + } +} + +size_t File::length() +{ +#ifdef WIN32 + return _filelength ( _fileno(_f) ); +#elif defined(UNIX) + struct stat file_stat; + verify(fstat(fileno(_f), &file_stat) == 0); + return file_stat.st_size; +#endif +} + +void File::close() +{ + if ( _f ) + { + fclose(_f); + _f = 0; + } +} + +/*static*/ bool File::LoadIntoString ( std::string& s, const char* filename ) +{ + File in ( filename, "rb" ); + if ( !in.isopened() ) + return false; + size_t len = in.length(); + s.resize ( len + 1 ); + if ( !in.read ( &s[0], len ) ) + return false; + s[len] = '\0'; + s.resize ( len ); + return true; +} + +/*static*/ bool File::SaveFromString ( const char* filename, const std::string& s, bool binary ) +{ + File out ( filename, binary ? "wb" : "w" ); + if ( !out.isopened() ) + return false; + out.write ( s.c_str(), s.size() ); + return true; +} diff --git a/rosapps/sysutils/utils/sdkparse/File.h b/rosapps/sysutils/utils/sdkparse/File.h new file mode 100644 index 00000000000..b81f0e473da --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/File.h @@ -0,0 +1,111 @@ +// File.h +// This file is (C) 2002-2003 Royce Mitchell III and released under the BSD license + +#ifndef FILE_H +#define FILE_H + +#ifdef WIN32 +# include +#elif defined(UNIX) +# include +# include +#endif +#include + +class File +{ +public: + File() : _f(0) + { + } + + File ( const char* filename, const char* mode ) : _f(0) + { + open ( filename, mode ); + } + + ~File() + { + close(); + } + + bool open ( const char* filename, const char* mode ); + + bool seek ( long offset ) + { + return !fseek ( _f, offset, SEEK_SET ); + } + + int get() + { + return fgetc ( _f ); + } + + bool put ( int c ) + { + return fputc ( c, _f ) != EOF; + } + + std::string getline ( bool strip_crlf = false ); + + // this function searches for the next end-of-line and puts all data it + // finds until then in the 'line' parameter. + // + // call continuously until the function returns false ( no more data ) + bool next_line ( std::string& line, bool strip_crlf ); + + /* + example usage: + + bool mycallback ( const std::string& line, int line_number, long lparam ) + { + std::cout << line << std::endl; + return true; // continue enumeration + } + + File f ( "file.txt", "rb" ); // open file for binary read-only ( i.e. "rb" ) + f.enum_lines ( mycallback, 0, true ); + */ + + bool enum_lines ( bool (*callback)(const std::string& line, int line_number, long lparam), long lparam, bool strip_crlf ); + + bool read ( void* data, unsigned len ) + { + return len == fread ( data, 1, len, _f ); + } + + bool write ( const void* data, unsigned len ) + { + return len == fwrite ( data, 1, len, _f ); + } + + size_t length(); + + void close(); + + bool isopened() + { + return _f != 0; + } + + bool eof() + { + return feof(_f) ? true : false; + } + + FILE* operator * () + { + return _f; + } + + static bool LoadIntoString ( std::string& s, const char* filename ); + static bool SaveFromString ( const char* filename, const std::string& s, bool binary ); + +private: + File(const File&) {} + const File& operator = ( const File& ) { return *this; } + + FILE * _f; +}; + +#endif//FILE_H diff --git a/rosapps/sysutils/utils/sdkparse/FixLFN.h b/rosapps/sysutils/utils/sdkparse/FixLFN.h new file mode 100644 index 00000000000..3269e261a74 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/FixLFN.h @@ -0,0 +1,32 @@ +// +// FixLFN.h +// + +#ifndef __FIXLFN_H +#define __FIXLFN_H + +#include +#include +#include + +inline int FixLFN ( const TCHAR* pBadFileName, TCHAR* pGoodFileName ) +{ + SHFILEINFO sfi; + TCHAR* p; + + DWORD dwResult = SHGetFileInfo ( pBadFileName, 0, &sfi, sizeof(sfi), SHGFI_DISPLAYNAME ); + if ( dwResult ) + { + if ( pGoodFileName != pBadFileName ) + _tcscpy ( pGoodFileName, pBadFileName ); + if ( (p = _tcsrchr ( pGoodFileName, '\\' )) ) + _tcscpy ( p+1, sfi.szDisplayName ); + else if ( (p = _tcsrchr ( pGoodFileName, '/' )) ) + _tcscpy ( p+1, sfi.szDisplayName ); + else + _tcscpy ( pGoodFileName, sfi.szDisplayName ); + } + return dwResult; +} + +#endif//__FIXLFN_H diff --git a/rosapps/sysutils/utils/sdkparse/Header.h b/rosapps/sysutils/utils/sdkparse/Header.h new file mode 100644 index 00000000000..9c14ef5d2c4 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/Header.h @@ -0,0 +1,26 @@ +// Header.h + +#ifndef HEADER_H +#define HEADER_H + +#include "Symbol.h" + +class Header +{ +public: + std::string filename; + std::vector includes, libc_includes, pragmas; + std::vector symbols; + bool done, externc; + + std::vector ifs, ifspreproc; + + Header ( const std::string& filename_ ) + : filename(filename_) + { + done = false; + externc = false; + } +}; + +#endif//HEADER_H diff --git a/rosapps/sysutils/utils/sdkparse/Symbol.h b/rosapps/sysutils/utils/sdkparse/Symbol.h new file mode 100644 index 00000000000..9af0378ea0b --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/Symbol.h @@ -0,0 +1,18 @@ +// Symbol.h + +#ifndef SYMBOL_H +#define SYMBOL_H + +#include "Type.h" + +class Symbol +{ +public: + Type type; + std::vector names; + std::vector dependencies; + std::vector ifs; + std::string definition; +}; + +#endif//SYMBOL_H diff --git a/rosapps/sysutils/utils/sdkparse/Type.h b/rosapps/sysutils/utils/sdkparse/Type.h new file mode 100644 index 00000000000..1178f11eb79 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/Type.h @@ -0,0 +1,22 @@ +// Type.h + +#ifndef TYPE_H +#define TYPE_H + +typedef enum +{ + T_UNKNOWN = -1, + T_IGNORED_STATEMENT, + T_TIDENT, + T_MACRO, + T_DEFINE, + T_VARIABLE, + T_FUNCTION, + T_FUNCTION_PTR, + T_IF, + T_WHILE, + T_DO, + T_STRUCT +} Type; + +#endif//TYPE_H diff --git a/rosapps/sysutils/utils/sdkparse/assert.h b/rosapps/sysutils/utils/sdkparse/assert.h new file mode 100644 index 00000000000..f2f7ea41c3e --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/assert.h @@ -0,0 +1,47 @@ +// +// assert.h +// + +#ifndef __ASSERT_H +#define __ASSERT_H + +#ifndef _MFC_VER +#ifdef _WIN32_WCE + +#else//_WIN32_WCE + #include +#endif//_WIN32_WCE +#endif + +#ifndef ASSERT + #ifdef _DEBUG + #include + #include // _snprintf + //#ifndef WINVER + #ifdef _CONSOLE + #define ASSERT(x) if(!(x)){printf("ASSERT FAILURE: (%s) at %s:%i\n", #x, __FILE__, __LINE__); _CrtDbgBreak(); } + #else//_CONSOLE/WINVER + #define ASSERT(x) if(!(x)){char stmp_assert[1024+1]; _snprintf(stmp_assert,1024,"ASSERT FAILURE: (%s) at %s:%i\n",#x,__FILE__,__LINE__); ::MessageBox(NULL,stmp_assert,"Assertion Failure",MB_OK|MB_ICONSTOP); _CrtDbgBreak(); } + #endif//_CONSOLE/WINVER + #else//_DEBUG + #define ASSERT(x) + #endif//_DEBUG +#endif//ASSERT + +#undef VERIFY +#ifdef _DEBUG + #define VERIFY(x) ASSERT(x) +#else//_DEBUG + #define VERIFY(x) x +#endif//_DEBUG + +// code for ASSERTing in Release mode... +#ifdef RELEASE_ASSERT + #undef ASSERT + #include + #define ASSERT(x) if ( !(x) ) { char s[1024+1]; _snprintf(s,1024,"ASSERTION FAILURE:\n%s\n\n%s: line %i", #x, __FILE__, __LINE__ ); ::MessageBox(NULL,s,"Assertion Failure",MB_OK|MB_ICONERROR); } + #undef VERIFY + #define VERIFY ASSERT +#endif//RELEASE_ASSERT + +#endif//__ASSERT_H diff --git a/rosapps/sysutils/utils/sdkparse/binary2cstr.cpp b/rosapps/sysutils/utils/sdkparse/binary2cstr.cpp new file mode 100644 index 00000000000..83c0aeb6855 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/binary2cstr.cpp @@ -0,0 +1,49 @@ +// binary2cstr.cpp + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#include "binary2cstr.h" + +using std::string; + +string binary2cstr ( const string& src ) +{ + string dst; + for ( int i = 0; i < src.size(); i++ ) + { + char c = src[i]; + switch ( c ) + { + case '\n': + dst += "\\n"; + break; + case '\r': + dst += "\\r"; + break; + case '\t': + dst += "\\t"; + break; + case '\v': + dst += "\\v"; + break; + case '\"': + dst += "\x22"; + break; + default: + if ( isprint ( c ) ) + dst += c; + else + { + dst += "\\x"; + char tmp[16]; + _snprintf ( tmp, sizeof(tmp)-1, "%02X", (unsigned)(unsigned char)c ); + tmp[sizeof(tmp)-1] = '\0'; + dst += tmp; + } + break; + } + } + return dst; +} \ No newline at end of file diff --git a/rosapps/sysutils/utils/sdkparse/binary2cstr.h b/rosapps/sysutils/utils/sdkparse/binary2cstr.h new file mode 100644 index 00000000000..ea708af221f --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/binary2cstr.h @@ -0,0 +1,10 @@ +// binary2cstr.h + +#ifndef BINARY2CSTR_H +#define BINARY2CSTR_H + +#include + +std::string binary2cstr ( const std::string& src ); + +#endif//BINARY2CSTR_H diff --git a/rosapps/sysutils/utils/sdkparse/input.lst b/rosapps/sysutils/utils/sdkparse/input.lst new file mode 100644 index 00000000000..1d678e5fda3 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/input.lst @@ -0,0 +1,349 @@ +accctrl.h +aclapi.h +ascii.h +base.h +basetsd.h +coff.h +d3d.h +d3dcaps.h +d3dtypes.h +ddentry.h +ddraw.h +debug.h +defines.h +devices.h +epsapi.h +errors.h +excpt.h +fmifs.h +funcs.h +getopt.h +icmpapi.h +ipexport.h +iphlpapi.h +ipifcons.h +iprtrmib.h +iptypes.h +messages.h +mmddk.h +ndis.h +ntddk.h +ntos.h +ntsecapi.h +pe.h +richedit.h +roscfg.h +roskrnl.h +schemadef.h +snmp.h +sockets.h +structs.h +syssetup.h +tchar.h +tgetopt.h +tmschema.h +unicode.h +uxtheme.h +wdm.h +wincrypt.h +windows.h +winsock2.h +ws2spi.h +wsahelp.h +afd\shared.h +csrss\csrss.h +ddk\af_irda.h +ddk\ccfuncs.h +ddk\cctypes.h +ddk\class2.h +ddk\cmtypes.h +ddk\d3dhal.h +ddk\d3dnthal.h +ddk\dbgfuncs.h +ddk\ddrawi.h +ddk\ddrawint.h +ddk\defines.h +ddk\exfuncs.h +ddk\extypes.h +ddk\fsfuncs.h +ddk\fstypes.h +ddk\halfuncs.h +ddk\ioctrl.h +ddk\iodef.h +ddk\iofuncs.h +ddk\iotypes.h +ddk\kedef.h +ddk\kefuncs.h +ddk\ketypes.h +ddk\ldrfuncs.h +ddk\miniport.h +ddk\mmfuncs.h +ddk\mmtypes.h +ddk\ntbootvid.h +ddk\ntdd8042.h +ddk\ntddbeep.h +ddk\ntddblue.h +ddk\ntddk.h +ddk\ntddkbd.h +ddk\ntddmou.h +ddk\ntddscsi.h +ddk\ntddser.h +ddk\ntddvid.h +ddk\ntdef.h +ddk\ntifs.h +ddk\obfuncs.h +ddk\pnpfuncs.h +ddk\pnptypes.h +ddk\pofuncs.h +ddk\potypes.h +ddk\psfuncs.h +ddk\pstypes.h +ddk\scsi.h +ddk\sefuncs.h +ddk\setypes.h +ddk\srb.h +ddk\status.h +ddk\structs.h +ddk\types.h +ddk\winddi.h +ddk\i386\irql.h +ddk\i386\pagesize.h +dflat32\classdef.h +dflat32\classes.h +dflat32\commands.h +dflat32\config.h +dflat32\dflat.h +dflat32\dflatmsg.h +dflat32\dialbox.h +dflat32\htree.h +dflat32\keys.h +dflat32\menu.h +dflat32\rect.h +dflat32\system.h +dflat32\video.h +fslib\vfatlib.h +kernel32\cptable.h +kernel32\error.h +kernel32\heap.h +kernel32\kernel32.h +kernel32\lctable.h +kernel32\nls.h +kernel32\proc.h +kernel32\process.h +kernel32\thread.h +kernel32\winnls.h +libc\atexit.h +libc\file.h +libc\ieee.h +lsass\lsass.h +lsass\ntsecapi.h +msvcrt\alloc.h +msvcrt\assert.h +msvcrt\conio.h +msvcrt\crttypes.h +msvcrt\ctype.h +msvcrt\dir.h +msvcrt\direct.h +msvcrt\errno.h +msvcrt\fcntl.h +msvcrt\float.h +msvcrt\io.h +msvcrt\locale.h +msvcrt\malloc.h +msvcrt\math.h +msvcrt\mbctype.h +msvcrt\mbstring.h +msvcrt\msvcrtdbg.h +msvcrt\process.h +msvcrt\search.h +msvcrt\share.h +msvcrt\signal.h +msvcrt\stdarg.h +msvcrt\stddef.h +msvcrt\stdio.h +msvcrt\stdlib.h +msvcrt\string.h +msvcrt\time.h +msvcrt\wchar.h +msvcrt\internal\atexit.h +msvcrt\internal\console.h +msvcrt\internal\file.h +msvcrt\internal\ieee.h +msvcrt\internal\rterror.h +msvcrt\internal\stdio.h +msvcrt\internal\tls.h +msvcrt\sys\fcntl.h +msvcrt\sys\file.h +msvcrt\sys\locking.h +msvcrt\sys\stat.h +msvcrt\sys\time.h +msvcrt\sys\timeb.h +msvcrt\sys\types.h +msvcrt\sys\unistd.h +msvcrt\sys\utime.h +napi\core.h +napi\dbg.h +napi\lpc.h +napi\npipe.h +napi\shared_data.h +napi\teb.h +napi\types.h +napi\win32.h +napi\i386\floatsave.h +napi\i386\segment.h +net\miniport.h +net\ndis.h +net\ndisoid.h +net\netevent.h +net\netpnp.h +net\ntddndis.h +net\ntddtdi.h +net\tdi.h +net\tdiinfo.h +net\tdikrnl.h +net\tdistat.h +ntdll\base.h +ntdll\csr.h +ntdll\dbg.h +ntdll\ldr.h +ntdll\napi.h +ntdll\ntdll.h +ntdll\pagesize.h +ntdll\rtl.h +ntdll\trace.h +ntos\bootvid.h +ntos\cdrom.h +ntos\console.h +ntos\dbgfuncs.h +ntos\disk.h +ntos\except.h +ntos\file.h +ntos\fstypes.h +ntos\gditypes.h +ntos\halfuncs.h +ntos\haltypes.h +ntos\heap.h +ntos\kdbgsyms.h +ntos\kdfuncs.h +ntos\kefuncs.h +ntos\keyboard.h +ntos\ldrtypes.h +ntos\minmax.h +ntos\mm.h +ntos\ntdef.h +ntos\obtypes.h +ntos\port.h +ntos\ps.h +ntos\registry.h +ntos\rtl.h +ntos\rtltypes.h +ntos\security.h +ntos\service.h +ntos\synch.h +ntos\time.h +ntos\tss.h +ntos\types.h +ntos\zw.h +ntos\zwtypes.h +ole32\basetyps.h +ole32\guiddef.h +ole32\objbase.h +ole32\obj_base.h +ole32\obj_cache.h +ole32\obj_channel.h +ole32\obj_clientserver.h +ole32\obj_commdlgbrowser.h +ole32\obj_connection.h +ole32\obj_contextmenu.h +ole32\obj_control.h +ole32\obj_dataobject.h +ole32\obj_dockingwindowframe.h +ole32\obj_dragdrop.h +ole32\obj_enumidlist.h +ole32\obj_errorinfo.h +ole32\obj_extracticon.h +ole32\obj_inplace.h +ole32\obj_marshal.h +ole32\obj_misc.h +ole32\obj_moniker.h +ole32\obj_oleaut.h +ole32\obj_olefont.h +ole32\obj_oleobj.h +ole32\obj_oleundo.h +ole32\obj_oleview.h +ole32\obj_picture.h +ole32\obj_property.h +ole32\obj_propertystorage.h +ole32\obj_queryassociations.h +ole32\obj_serviceprovider.h +ole32\obj_shellbrowser.h +ole32\obj_shellextinit.h +ole32\obj_shellfolder.h +ole32\obj_shelllink.h +ole32\obj_shellview.h +ole32\obj_storage.h +ole32\obj_webbrowser.h +ole32\ole32.h +ole32\olectl.h +ole32\rpc.h +ole32\rpcdce.h +ole32\rpcdcep.h +ole32\unknwn.h +ole32\winerror.h +ole32\wtypes.h +reactos\bugcodes.h +reactos\buildno.h +reactos\config.h +reactos\errcodes.h +reactos\resource.h +reactos\version.h +rosrtl\devmode.h +rosrtl\logfont.h +rosrtl\thread.h +services\services.h +user32\accel.h +user32\callback.h +user32\regcontrol.h +user32\wininternal.h +win32k\bitmaps.h +win32k\brush.h +win32k\cliprgn.h +win32k\color.h +win32k\coord.h +win32k\cursoricon.h +win32k\dc.h +win32k\debug.h +win32k\debug1.h +win32k\driver.h +win32k\fillshap.h +win32k\float.h +win32k\gdiobj.h +win32k\icm.h +win32k\kapi.h +win32k\line.h +win32k\math.h +win32k\metafile.h +win32k\misc.h +win32k\ntddraw.h +win32k\ntuser.h +win32k\paint.h +win32k\path.h +win32k\pen.h +win32k\print.h +win32k\region.h +win32k\text.h +win32k\userobj.h +win32k\win32k.h +win32k\wingl.h +wine\commctrl.h +wine\config.h +wine\debug.h +wine\debugtools.h +wine\port.h +wine\prsht.h +wine\test.h +wine\unicode.h +wine\vfw.h +wine\windef16.h +wine\wineros.h +wine\winuser.h diff --git a/rosapps/sysutils/utils/sdkparse/iskeyword.cpp b/rosapps/sysutils/utils/sdkparse/iskeyword.cpp new file mode 100644 index 00000000000..6649d22fb46 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/iskeyword.cpp @@ -0,0 +1,138 @@ +// iskeyword.cpp + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#include + +#include "iskeyword.h" + +using std::string; + +bool iskeyword ( const string& ident ) +{ +#define I(s) if ( ident == #s ) return true; + switch ( ident[0] ) + { + case '_': + I(__cdecl); + I(__declspec); + I(__except); + I(__fastcall); + I(__finally); + I(__inline); + I(__int8); + I(__int16); + I(__int32); + I(__int64); + I(__leave); + I(__stdcall); + I(__try); + break; + case 'b': + I(bool); + I(break); + break; + case 'c': + I(case); + I(catch); + I(char); + I(class); + I(const); + I(const_cast); + I(continue); + break; + case 'd': + I(default); + I(delete); + I(dllexport); + I(dllimport); + I(do); + I(double); + I(dynamic_cast); + break; + case 'e': + I(else); + I(enum); + I(explicit); + I(extern); + break; + case 'f': + I(false); + I(float); + I(for); + I(friend); + break; + case 'g': + I(goto); + break; + case 'i': + I(if); + I(inline); + I(int); + break; + case 'l': + I(long); + break; + case 'm': + I(mutable); + break; + case 'n': + I(naked); + I(namespace); + I(new); + I(noreturn); + break; + case 'o': + I(operator); + break; + case 'p': + I(private); + I(protected); + I(public); + break; + case 'r': + I(register); + I(reinterpret_cast); + I(return); + break; + case 's': + I(short); + I(signed); + I(sizeof); + I(static); + I(static_cast); + I(struct); + I(switch); + break; + case 't': + I(template); + I(this); + I(thread); + I(throw); + I(true); + I(try); + I(typedef); + I(typeid); + I(typename); + break; + case 'u': + I(union); + I(unsigned); + I(using); + I(uuid); + I(__uuidof); + break; + case 'v': + I(virtual); + I(void); + I(volatile); + break; + case 'w': + I(wmain); + I(while); + break; + } + return false; +} diff --git a/rosapps/sysutils/utils/sdkparse/iskeyword.h b/rosapps/sysutils/utils/sdkparse/iskeyword.h new file mode 100644 index 00000000000..5f74fc19aa8 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/iskeyword.h @@ -0,0 +1,8 @@ +// iskeyword.h + +#ifndef ISKEYWORD_H +#define ISKEYWORD_H + +bool iskeyword ( const std::string& ident ); + +#endif//ISKEYWORD_H diff --git a/rosapps/sysutils/utils/sdkparse/safestr.h b/rosapps/sysutils/utils/sdkparse/safestr.h new file mode 100644 index 00000000000..35825409b11 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/safestr.h @@ -0,0 +1,61 @@ +// +// safestr.h +// +// safe versions of some string manipulation routines +// + +#ifndef __SAFESTR_H +#define __SAFESTR_H + +#include + +#ifndef tchar +#define tchar TCHAR +#endif//tchar + +#include +#include "assert.h" + +inline size_t safestrlen ( const tchar *string ) +{ + if ( !string ) + return 0; + return _tcslen(string); +} + +inline tchar* safestrcpy ( tchar* strDest, const tchar* strSource ) +{ + ASSERT(strDest); + if ( !strSource ) + *strDest = 0; + else + _tcscpy ( strDest, strSource ); + return strDest; +} + +inline tchar* safestrncpy ( tchar* strDest, const tchar* strSource, size_t count ) +{ + ASSERT(strDest); + if ( !strSource ) + count = 0; + else + _tcsncpy ( strDest, strSource, count ); + strDest[count] = 0; + return strDest; +} + +inline tchar* safestrlwr ( tchar* str ) +{ + if ( !str ) + return 0; + return _tcslwr(str); +} + +inline tchar* safestrupr ( tchar* str ) +{ + if ( !str ) + return 0; + return _tcsupr(str); +} + +#endif//__SAFESTR_H diff --git a/rosapps/sysutils/utils/sdkparse/sdkparse.cpp b/rosapps/sysutils/utils/sdkparse/sdkparse.cpp new file mode 100644 index 00000000000..c3f0346d32a --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/sdkparse.cpp @@ -0,0 +1,988 @@ +// sdkparse.cpp + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#define WIN32_LEAN_AND_MEAN +#include + +#include +#include +#include + +#include "EnumFilesImpl.h" + +#include "assert.h" +#include "File.h" +#include "binary2cstr.h" +#include "strip_comments.h" +#include "tokenize.h" +#include "skip_ws.h" +#include "iskeyword.h" +#include "Type.h" +#include "Header.h" + +#define TOKASSERT(x) \ +if(!(x))\ +{\ + printf("ASSERT FAILURE: (%s) at %s:%i\n", #x, __FILE__, __LINE__);\ + printf("WHILE PROCESSING: \n");\ + for ( int ajf83pfj = 0; ajf83pfj < tokens.size(); ajf83pfj++ )\ + printf("%s ", tokens[ajf83pfj].c_str() );\ + printf("\n");\ + _CrtDbgBreak();\ +} +using std::string; +using std::vector; + +vector headers; + +bool import_file ( const char* filename ); +char* findend ( char* p, bool& externc ); +Type identify ( const vector& tokens, int off = 0 ); +Type process ( const string& element, vector& names, bool& isTypedef, vector& dependencies ); +void process_preprocessor ( const char* filename, Header& h, const string& element ); +void process_c ( Header& h, const string& element ); +int parse_type ( Type t, const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_ignored_statement ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_tident ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_variable ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_struct ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_function ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_function_ptr ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_ifwhile ( const vector& tokens, int off, vector& names, vector& dependencies ); +int parse_do ( const vector& tokens, int off, vector& names, vector& dependencies ); + +const char* libc_includes[] = +{ + "basestd.h", + "except.h", + "float.h", + "limits.h", + "stdarg.h", + "stddef.h", + "stdlib.h", + "string.h", + "types.h" +}; + +bool is_libc_include ( const string& inc ) +{ + string s ( inc ); + strlwr ( &s[0] ); + for ( int i = 0; i < sizeof(libc_includes)/sizeof(libc_includes[0]); i++ ) + { + if ( s == libc_includes[i] ) + return true; + } + return false; +} + +BOOL FileEnumProc ( PWIN32_FIND_DATA pwfd, const char* filename, long lParam ) +{ + if ( !is_libc_include ( filename ) ) + import_file ( filename ); + return TRUE; +} + +void main() +{ + //import_file ( "coff.h" ); + + File f ( "input.lst", "r" ); + if ( !f.isopened() ) + { + printf ( "Couldn't open \"input.lst\" for input\nPress any key to exit\n" ); + (void)getch(); + return; + } + string filename; + while ( f.next_line ( filename, true ) ) + import_file ( filename.c_str() ); + //printf ( "press any key to start\n" ); + //getch(); +/*#if 1 + import_file ( "../test.h" ); +#else + EnumFilesInDirectory ( "c:/cvs/reactos/apps/utils/sdkparse/include", "*.h", FileEnumProc, 0, TRUE, FALSE ); +#endif*/ + printf ( "Done!\nPress any key to exit!\n" ); + (void)getch(); +} + +bool import_file ( const char* filename ) +{ + int i; + + for ( i = 0; i < headers.size(); i++ ) + { + if ( headers[i]->filename == filename ) + return true; + } + + string s; + if ( !File::LoadIntoString ( s, filename ) ) + { + printf ( "Couldn't load \"%s\" for input.\n", filename ); + ASSERT(0); + } + + printf ( "%s\n", filename ); + + // strip comments from the file... + strip_comments ( s, true ); + + /*{ + string no_comments ( filename ); + no_comments += ".nocom.txt"; + File::SaveFromString ( no_comments.c_str(), s, false ); + }*/ + + Header* h = new Header ( filename ); + headers.push_back ( h ); + + char* p = &s[0]; + while ( p ) + { + // skip whitespace + p = skip_ws ( p ); + if ( !*p ) + break; + // check for pre-processor command + if ( *p == '#' ) + { + char* end = strchr ( p, '\n' ); + while ( end && end[-1] == '\\' ) + end = strchr ( end+1, '\n' ); + if ( !end ) + end = p + strlen(p); + string element ( p, end-p ); + + process_preprocessor ( filename, *h, element ); + + p = end; + } + else if ( *p == '}' && h->externc ) + { + p++; + p = skip_ws ( p ); + + if ( *p == ';' ) p++; + } + else + { + bool externc = false; + char* end = findend ( p, externc ); + ASSERT(end); + if ( externc ) + h->externc = true; + else + { + string element ( p, end-p ); + + process_c ( *h, element ); + } + p = end; + } + } + h->done = true; + return true; +} + +string get_hdrguardtext ( const char* filename ) +{ + string s ( filename ); + char* p = &s[0]; + char* p2; + while ( (p2 = strchr(p, '\\')) ) + *p2 = '/'; + while ( (p2 = strchr(p,'/')) ) + p = p2 + 1; + char* end = strchr ( p, '.' ); + ASSERT(end); + while ( (p2 = strchr(end+1,'.')) ) + end = p2; + string hdrguardtext ( p, end-p ); + strupr ( &hdrguardtext[0] ); + return hdrguardtext; +} + +void process_preprocessor ( const char* filename, Header& h, const string& element ) +{ + string hdrguardtext ( get_hdrguardtext ( filename ) ); + + const char* p = &element[0]; + ASSERT ( *p == '#' ); + p++; + p = skip_ws ( p ); + const char* end = p; + while ( iscsym(*end) ) + end++; + string preproc ( p, end-p ); + p = end+1; + p = skip_ws ( p ); + + const string dbg_filename = "napi/lpc.h DISABLE DISABLE DISABLE"; + + if ( preproc == "include" ) + { + //if ( h.filename == "napi/lpc.h" ) + // _CrtDbgBreak(); + ASSERT ( *p == '<' || *p == '\"' ); + p++; + p = skip_ws ( p ); + const char* end = strpbrk ( p, ">\"" ); + if ( !end ) + end = p + strlen(p); + while ( end > p && isspace(end[-1]) ) + end--; + string include_filename ( p, end-p ); + if ( is_libc_include ( include_filename ) ) + h.libc_includes.push_back ( include_filename ); + else + { + bool loaded = false; + for ( int i = 0; i < headers.size() && !loaded; i++ ) + { + if ( headers[i]->filename == include_filename ) + { + if ( !headers[i]->done ) + { + printf ( "circular dependency between '%s' and '%s'\n", filename, include_filename.c_str() ); + ASSERT ( 0 ); + } + loaded = true; + } + } + if ( !loaded ) + { + printf ( "(diverting to '%s')\n", include_filename.c_str() ); + import_file ( include_filename.c_str() ); + printf ( "(now back to '%s')\n", filename ); + } + h.includes.push_back ( include_filename ); + } + } + else if ( preproc == "define" ) + { + size_t len = element.size(); + if ( strstr ( element.c_str(), hdrguardtext.c_str() ) + && element[len-2] == '_' + && element[len-1] == 'H' ) + { + // header include guard... ignore! + return; + } + Symbol *s = new Symbol; + s->type = T_DEFINE; + + p += 6; + p = skip_ws ( p ); + + const char* end = p; + while ( iscsym(*end) ) + end++; + + s->names.push_back ( string(p,end-p) ); + + s->definition = element; + + h.symbols.push_back ( s ); + } + else if ( preproc == "undef" ) + { + // safely ignoreable for now, I think + } + else if ( preproc == "if" || preproc == "ifdef" || preproc == "ifndef" ) + { + if ( dbg_filename == h.filename ) + printf ( "(%s) PRE-PUSH preproc stack = %lu\n", preproc.c_str(), h.ifs.size() ); + size_t len = element.size(); + // check for header include guard... + if ( strstr ( element.c_str(), hdrguardtext.c_str() ) + && element[len-2] == '_' + && element[len-1] == 'H' ) + h.ifs.push_back ( string("") ); + else + h.ifs.push_back ( element ); + h.ifspreproc.push_back ( preproc ); + if ( dbg_filename == h.filename ) + printf ( "POST-PUSH preproc stack = %lu\n", h.ifs.size() ); + } + else if ( preproc == "endif" ) + { + if ( dbg_filename == h.filename ) + printf ( "(%s) PRE-POP preproc stack = %lu\n", preproc.c_str(), h.ifs.size() ); + ASSERT ( h.ifs.size() > 0 && h.ifs.size() == h.ifspreproc.size() ); + h.ifs.pop_back(); + h.ifspreproc.pop_back(); + if ( dbg_filename == h.filename ) + printf ( "POST-POP preproc stack = %lu\n", h.ifs.size() ); + } + else if ( preproc == "elif" ) + { + if ( dbg_filename == h.filename ) + printf ( "(%s) PRE-PUSHPOP preproc stack = %lu\n", preproc.c_str(), h.ifs.size() ); + string& oldpre = h.ifspreproc.back(); + string old = h.ifs.back(); + string condold; + if ( oldpre == "ifdef" ) + condold = string("!defined(") + old + ")"; + else if ( oldpre == "ifndef" ) + condold = string("defined(") + old + ")"; + else if ( oldpre == "if" ) + condold = string("!(") + old + ")"; + else + { + printf ( "unrecognized preproc '%s'\n", oldpre.c_str() ); + ASSERT(0); + return; + } + h.ifs.back() = string("(") + element + ") && " + condold; + h.ifspreproc.back() = "if"; + if ( dbg_filename == h.filename ) + printf ( "POST-PUSHPOP preproc stack = %lu\n", h.ifs.size() ); + } + else if ( preproc == "else" ) + { + if ( dbg_filename == h.filename ) + printf ( "(%s) PRE-PUSHPOP preproc stack = %lu\n", preproc.c_str(), h.ifs.size() ); + string& oldpre = h.ifspreproc.back(); + ASSERT ( oldpre != "else" ); + if ( oldpre == "ifdef" ) + h.ifs.back() = "ifndef"; + else if ( oldpre == "ifndef" ) + h.ifs.back() = "ifdef"; + else if ( oldpre == "if" ) + h.ifs.back() = string("!(") + h.ifs.back() + ")"; + else + { + printf ( "unrecognized preproc '%s'\n", oldpre.c_str() ); + ASSERT(0); + return; + } + oldpre = "else"; + if ( dbg_filename == h.filename ) + printf ( "POST-PUSHPOP preproc stack = %lu\n", h.ifs.size() ); + } + else if ( preproc == "include_next" ) + { + // we can safely ignore this command... + } + else if ( preproc == "pragma" ) + { + h.pragmas.push_back ( element ); + } + else if ( preproc == "error" ) + { + // FIXME - how to handle these + } + else + { + printf ( "process_preprocessor() choked on '%s'\n", preproc.c_str() ); + } +} + +void process_c ( Header& h, const string& element ) +{ + //printf ( "\"%s\"\n\n", binary2cstr(element).c_str() ); + + bool isTypedef; + + Symbol *s = new Symbol; + s->definition = element; + s->type = process ( element, s->names, isTypedef, s->dependencies ); + + for ( int i = 0; i < h.ifs.size(); i++ ) + { + if ( h.ifs[i].size() ) + s->ifs.push_back ( h.ifs[i] ); + } + + /*printf ( "names: " ); + if ( s->names.size() ) + { + printf ( "%s", s->names[0].c_str() ); + for ( int i = 1; i < s->names.size(); i++ ) + printf ( ", %s", s->names[i].c_str() ); + } + else + printf ( "(none)" ); + printf ( "\n\n" ); + + printf ( "dependencies: " ); + if ( s->dependencies.size() ) + { + printf ( "%s", s->dependencies[0].c_str() ); + for ( int i = 1; i < s->dependencies.size(); i++ ) + printf ( ", %s", s->dependencies[i].c_str() ); + } + else + printf ( "(none)" ); + printf ( "\n\n" );*/ + + h.symbols.push_back ( s ); +} + +char* skipsemi ( char* p ) +{ + if ( *p != '{' ) // } + { + ASSERT(0); + } + p++; + for ( ;; ) + { + char* s = strchr ( p, '{' ); + char* e = strchr ( p, '}' ); + if ( !e ) + e = p + strlen(p); + if ( !s || s > e ) + { + // make sure we don't return pointer past null + if ( *e ) + return e + 1; + else + return e; + } + p = skipsemi ( s ); + } +} + +char* findend ( char* p, bool& externc ) +{ + //if ( !strncmp ( p, "typedef struct _OSVERSIONINFOEXA : ", 35 ) ) + // _CrtDbgBreak(); + // special-case for 'extern "C"' + if ( !strncmp ( p, "extern", 6 ) ) + { + char* p2 = p + 6; + p2 = skip_ws ( p2 ); + if ( !strncmp ( p2, "\"C\"", 3 ) ) + { + p2 += 3; + p2 = skip_ws ( p2 ); + if ( *p2 == '{' ) + { + externc = true; + return p2+1; + } + } + } + // special-case for 'typedef_tident' + if ( !strncmp ( p, "typedef_tident", 14 ) ) + { + char* end = strchr ( p, ')' ); + ASSERT(end); + return end+1; + } + externc = false; + bool isStruct = false; + + char* end = strchr ( p, ';' ); + if ( !end ) + end = p + strlen(p); + else + end++; + char* semi = strchr ( p, '{' ); + if ( !semi || semi > end ) + return end; + end = skipsemi ( semi ); + + const char* structs[] = { "struct", "enum", "class", "union" }; + for ( int i = 0; i < sizeof(structs)/sizeof(structs[0]); i++ ) + { + char* pStruct = strstr ( p, structs[i] ); + if ( pStruct + && pStruct < semi + && !__iscsym(pStruct[-1]) + && !__iscsym(pStruct[strlen(structs[i])]) ) + { + // make sure there's at most one identifier followed + // by a { + pStruct += strlen(structs[i]); + pStruct = skip_ws ( pStruct ); + if ( __iscsymf(*pStruct) ) + { + while ( __iscsym(*pStruct) ) + pStruct++; + pStruct = skip_ws ( pStruct ); + } + // special exception - C++ classes & stuff + if ( *pStruct == ':' ) + { + pStruct = skip_ws ( pStruct + 1 ); + ASSERT ( !strncmp(pStruct,"public",6) || !strncmp(pStruct,"protected",9) || !strncmp(pStruct,"private",7) ); + // skip access: + while ( __iscsym(*pStruct) ) + pStruct++; + pStruct = skip_ws ( pStruct ); + // skip base-class-name: + ASSERT ( __iscsymf(*pStruct) ); + while ( __iscsym(*pStruct) ) + pStruct++; + pStruct = skip_ws ( pStruct ); + } + if ( *pStruct == '{' ) + isStruct = true; + break; + } + } + + if ( isStruct ) + { + end = strchr ( end, ';' ); + if ( !end ) + end = p + strlen(p); + else + end++; + } + else + { + char* p2 = skip_ws ( end ); + if ( *p2 == ';' ) + end = p2 + 1; + } + return end; +} + +int skip_declspec ( const vector& tokens, int off ) +{ + if ( tokens[off] == "__declspec" ) + { + off++; + TOKASSERT ( tokens[off] == "(" ); + off++; + int parens = 1; + while ( parens ) + { + if ( tokens[off] == "(" ) + parens++; + else if ( tokens[off] == ")" ) + parens--; + off++; + } + } + return off; +} + +Type identify ( const vector& tokens, int off ) +{ + off = skip_declspec ( tokens, off ); + /*if ( tokens.size() > off+4 ) + { + if ( tokens[off+4] == "PCONTROLDISPATCHER" ) + _CrtDbgBreak(); + }*/ + /*if ( tokens.size() > off+1 ) + { + if ( tokens[off+1] == "_OSVERSIONINFOEXA" ) + _CrtDbgBreak(); + }*/ + if ( tokens[off] == "__asm__" ) + return T_IGNORED_STATEMENT; + else if ( tokens[off] == "return" ) + return T_IGNORED_STATEMENT; + else if ( tokens[off] == "typedef_tident" ) + return T_TIDENT; + else if ( tokens[off] == "if" ) + return T_IF; + else if ( tokens[off] == "while" ) + return T_WHILE; + else if ( tokens[off] == "do" ) + return T_DO; + int openparens = 0; + int closeparens = 0; + int brackets = 0; + for ( int i = off; i < tokens.size(); i++ ) + { + if ( tokens[i] == "(" && !brackets ) + openparens++; + else if ( tokens[i] == ")" && !brackets && openparens == 1 ) + closeparens++; + else if ( tokens[i] == "{" ) + brackets++; + else if ( (tokens[i] == "struct" || tokens[i] == "union") && !openparens ) + { + for ( int j = i + 1; j < tokens.size(); j++ ) + { + if ( tokens[j] == "{" ) + return T_STRUCT; + else if ( tokens[j] == "(" || tokens[j] == ";" || tokens[j] == "*" ) + break; + } + } + else if ( tokens[i] == ";" ) + break; + else if ( tokens[i] == "__attribute__" ) + break; + } + if ( openparens > 1 && closeparens ) + return T_FUNCTION_PTR; + else if ( openparens >= 1 ) + return T_FUNCTION; + return T_VARIABLE; +} + +Type process ( const string& element, vector& names, bool& isTypedef, vector& dependencies ) +{ + names.resize ( 0 ); + isTypedef = false; + dependencies.resize ( 0 ); + + vector tokens; + + tokenize ( element, tokens ); + + // now let's do the classification... + int i = 0; + if ( tokens[i] == "typedef" ) + { + isTypedef = true; + i++; + } + + Type t = identify ( tokens, i ); + + parse_type ( t, tokens, i, names, dependencies ); + + return t; +} + +int parse_type ( Type t, const vector& tokens, int off, vector& names, vector& dependencies ) +{ + switch ( t ) + { + case T_IGNORED_STATEMENT: + return parse_ignored_statement ( tokens, off, names, dependencies ); + case T_TIDENT: + return parse_tident ( tokens, off, names, dependencies ); + case T_VARIABLE: + return parse_variable ( tokens, off, names, dependencies ); + case T_STRUCT: + return parse_struct ( tokens, off, names, dependencies ); + case T_FUNCTION: + return parse_function ( tokens, off, names, dependencies ); + case T_FUNCTION_PTR: + return parse_function_ptr ( tokens, off, names, dependencies ); + case T_IF: + case T_WHILE: + return parse_ifwhile ( tokens, off, names, dependencies ); + case T_DO: + return parse_do ( tokens, off, names, dependencies ); + default: + TOKASSERT(!"unidentified type in parse_type()"); + return 0; + } +} + +void name ( const string& ident, vector& names ) +{ + if ( !__iscsymf ( ident[0] ) ) + return; + if ( iskeyword ( ident ) ) + return; + for ( int i = 0; i < names.size(); i++ ) + { + if ( names[i] == ident ) + return; + } + names.push_back ( ident ); +} + +void depend ( const string& ident, vector& dependencies ) +{ + if ( !__iscsymf ( ident[0] ) ) + return; + if ( iskeyword ( ident ) ) + return; + for ( int i = 0; i < dependencies.size(); i++ ) + { + if ( dependencies[i] == ident ) + return; + } + dependencies.push_back ( ident ); +} + +int parse_ignored_statement ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + off++; + while ( tokens[off] != ";" ) + off++; + ASSERT ( tokens[off] == ";" ); + return off + 1; +} + +int parse_tident ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + TOKASSERT ( tokens[off] == "typedef_tident" ); + TOKASSERT ( tokens[off+1] == "(" && tokens[off+3] == ")" ); + names.push_back ( tokens[off+2] ); + dependencies.push_back ( "typedef_tident" ); + return off + 4; +} + +int parse_variable ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + // NOTE - Test with bitfields, I think this code will actually handle them properly... + if ( tokens[off] == ";" ) + return off + 1; + depend ( tokens[off++], dependencies ); + int done = tokens.size(); + while ( off < tokens.size() && tokens[off] != ";" ) + name ( tokens[off++], names ); + TOKASSERT ( off < tokens.size() && tokens[off] == ";" ); + return off + 1; +} + +int parse_struct ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + int done = tokens.size(); + + //if ( tokens[off+1] == "_LARGE_INTEGER" ) + // _CrtDbgBreak(); + + while ( off < done && tokens[off] != "struct" && tokens[off] != "union" ) + depend ( tokens[off++], dependencies ); + + TOKASSERT ( tokens[off] == "struct" || tokens[off] == "union" ); + if ( tokens[off] != "struct" && tokens[off] != "union" ) + return off; + off++; + + if ( tokens[off] != "{" ) + name ( tokens[off++], names ); + + if ( tokens[off] == ":" ) + { + off++; + TOKASSERT ( tokens[off] == "public" || tokens[off] == "protected" || tokens[off] == "private" ); + off++; + depend ( tokens[off++], dependencies ); + } + + TOKASSERT ( tokens[off] == "{" ); + off++; + + // skip through body of struct - noting any dependencies + int indent = 1; + //if ( off >= done ) _CrtDbgBreak(); + while ( off < done && tokens[off] != "}" ) + { + vector fauxnames; + Type t = identify ( tokens, off ); + off = parse_type ( t, tokens, off, fauxnames, dependencies ); + //if ( off >= done ) _CrtDbgBreak(); + } + + // process any trailing dependencies/names... + while ( tokens[off] != ";" ) + { + TOKASSERT ( off+1 < done ); + if ( tokens[off+1] == "," || tokens[off+1] == ";" ) + name ( tokens[off], names ); + else + depend ( tokens[off], dependencies ); + off++; + } + + TOKASSERT ( tokens[off] == ";" ); + off++; + + return off; +} + +int parse_param ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + if ( tokens[off] == ")" ) + return off; + // special-case check for function pointer params + int done = off; + int parens = 1; + bool fptr = false; + for ( ;; ) + { + if ( tokens[done] == "," && parens == 1 ) + break; + if ( tokens[done] == ")" ) + { + if ( parens == 1 ) + break; + else + parens--; + } + if ( tokens[done] == "(" ) + parens++; + if ( tokens[done] == "*" && tokens[done-1] == "(" ) + fptr = true; + done++; + } + if ( !fptr ) + done--; + while ( off < done ) + depend ( tokens[off++], dependencies ); + if ( !fptr ) + name ( tokens[off++], names ); + return off; +} + +int parse_function ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + vector fauxnames; + + off = skip_declspec ( tokens, off ); + + while ( tokens[off+1] != "(" ) + depend ( tokens[off++], dependencies ); + name ( tokens[off++], names ); + + TOKASSERT ( tokens[off] == "(" ); + + while ( tokens[off] != ")" ) + { + off++; + off = parse_param ( tokens, off, fauxnames, dependencies ); + TOKASSERT ( tokens[off] == "," || tokens[off] == ")" ); + } + + off++; + + // check for "attributes" + if ( tokens[off] == "__attribute__" ) + { + off++; + TOKASSERT ( tokens[off] == "(" ); + off++; + int parens = 1; + while ( parens ) + { + if ( tokens[off] == "(" ) + parens++; + else if ( tokens[off] == ")" ) + parens--; + off++; + } + } + + // is this just a function *declaration* ? + if ( tokens[off] == ";" ) + return off; + + // we have a function body... + TOKASSERT ( tokens[off] == "{" ); + off++; + + while ( tokens[off] != "}" ) + { + Type t = identify ( tokens, off ); + if ( t == T_VARIABLE ) + off = parse_type ( t, tokens, off, fauxnames, dependencies ); + else + { + while ( tokens[off] != ";" ) + off++; + TOKASSERT ( tokens[off] == ";" ); + off++; + } + } + + TOKASSERT ( tokens[off] == "}" ); + off++; + + return off; +} + +int parse_function_ptr ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + off = skip_declspec ( tokens, off ); + + while ( tokens[off] != "(" ) + depend ( tokens[off++], dependencies ); + + TOKASSERT ( tokens[off] == "(" ); + off++; + + while ( tokens[off+1] != ")" ) + depend ( tokens[off++], dependencies ); + name ( tokens[off++], names ); + + TOKASSERT ( tokens[off] == ")" ); + + off++; + + TOKASSERT ( tokens[off] == "(" ); + + while ( tokens[off] != ")" ) + { + off++; + vector fauxnames; + off = parse_param ( tokens, off, fauxnames, dependencies ); + TOKASSERT ( tokens[off] == "," || tokens[off] == ")" ); + } + + off++; + TOKASSERT ( tokens[off] == ";" ); + off++; + return off; +} + +int parse_ifwhile ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + TOKASSERT ( tokens[off] == "if" || tokens[off] == "while" ); + off++; + + TOKASSERT ( tokens[off] == "(" ); + off++; + + TOKASSERT ( tokens[off] != ")" ); + while ( tokens[off] != ")" ) + off++; + + if ( tokens[off] == "{" ) + { + while ( tokens[off] != "}" ) + { + Type t = identify ( tokens, off ); + off = parse_type ( t, tokens, off, names, dependencies ); + } + off++; + } + return off; +} + +int parse_do ( const vector& tokens, int off, vector& names, vector& dependencies ) +{ + TOKASSERT ( tokens[off] == "do" ); + off++; + + if ( tokens[off] != "{" ) + { + Type t = identify ( tokens, off ); + off = parse_type ( t, tokens, off, names, dependencies ); + } + else + { + while ( tokens[off] != "}" ) + { + Type t = identify ( tokens, off ); + off = parse_type ( t, tokens, off, names, dependencies ); + } + } + + TOKASSERT ( tokens[off] == "while" ); + off++; + + TOKASSERT ( tokens[off] == "(" ); + while ( tokens[off] != ")" ) + off++; + + TOKASSERT ( tokens[off] == ")" ); + off++; + + TOKASSERT ( tokens[off] == ";" ); + off++; + + return off; +} + diff --git a/rosapps/sysutils/utils/sdkparse/sdkparse.dsp b/rosapps/sysutils/utils/sdkparse/sdkparse.dsp new file mode 100644 index 00000000000..8e17e73fa92 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/sdkparse.dsp @@ -0,0 +1,169 @@ +# Microsoft Developer Studio Project File - Name="sdkparse" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=sdkparse - 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 "sdkparse.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 "sdkparse.mak" CFG="sdkparse - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sdkparse - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sdkparse - 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)" == "sdkparse - 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)" == "sdkparse - 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 /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "sdkparse - Win32 Release" +# Name "sdkparse - Win32 Debug" +# Begin Source File + +SOURCE=.\assert.h +# End Source File +# Begin Source File + +SOURCE=.\binary2cstr.cpp +# End Source File +# Begin Source File + +SOURCE=.\EnumDirs.h +# End Source File +# Begin Source File + +SOURCE=.\EnumDirsImpl.h +# End Source File +# Begin Source File + +SOURCE=.\EnumFiles.h +# End Source File +# Begin Source File + +SOURCE=.\EnumFilesImpl.h +# End Source File +# Begin Source File + +SOURCE=.\File.cpp +# End Source File +# Begin Source File + +SOURCE=.\File.h +# End Source File +# Begin Source File + +SOURCE=.\FixLFN.h +# End Source File +# Begin Source File + +SOURCE=.\Header.h +# End Source File +# Begin Source File + +SOURCE=.\iskeyword.cpp +# End Source File +# Begin Source File + +SOURCE=.\iskeyword.h +# End Source File +# Begin Source File + +SOURCE=.\safestr.h +# End Source File +# Begin Source File + +SOURCE=.\sdkparse.cpp +# End Source File +# Begin Source File + +SOURCE=.\skip_ws.cpp +# End Source File +# Begin Source File + +SOURCE=.\skip_ws.h +# End Source File +# Begin Source File + +SOURCE=.\strip_comments.cpp +# End Source File +# Begin Source File + +SOURCE=.\strip_comments.h +# End Source File +# Begin Source File + +SOURCE=.\Symbol.h +# End Source File +# Begin Source File + +SOURCE=.\tokenize.cpp +# End Source File +# Begin Source File + +SOURCE=.\Type.h +# End Source File +# End Target +# End Project diff --git a/rosapps/sysutils/utils/sdkparse/sdkparse.dsw b/rosapps/sysutils/utils/sdkparse/sdkparse.dsw new file mode 100644 index 00000000000..6966888c193 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/sdkparse.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "sdkparse"=.\sdkparse.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/rosapps/sysutils/utils/sdkparse/skip_ws.cpp b/rosapps/sysutils/utils/sdkparse/skip_ws.cpp new file mode 100644 index 00000000000..ab9ad0f10a9 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/skip_ws.cpp @@ -0,0 +1,17 @@ +// skip_ws.cpp + +#include + +#include "skip_ws.h" + +const char* ws = " \t\r\n\v"; + +char* skip_ws ( char* p ) +{ + return p + strspn ( p, ws ); +} + +const char* skip_ws ( const char* p ) +{ + return p + strspn ( p, ws ); +} diff --git a/rosapps/sysutils/utils/sdkparse/skip_ws.h b/rosapps/sysutils/utils/sdkparse/skip_ws.h new file mode 100644 index 00000000000..a0cb47cb175 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/skip_ws.h @@ -0,0 +1,10 @@ +// skip_ws.h + +#ifndef SKIP_WS_H +#define SKIP_WS_H + +char* skip_ws ( char* ); + +const char* skip_ws ( const char* ); + +#endif//SKIP_WS_H diff --git a/rosapps/sysutils/utils/sdkparse/strip_comments.cpp b/rosapps/sysutils/utils/sdkparse/strip_comments.cpp new file mode 100644 index 00000000000..b6c8f726120 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/strip_comments.cpp @@ -0,0 +1,43 @@ +// strip_comments.cpp + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#include "strip_comments.h" + +void strip_comments ( std::string& s, bool strip_lf ) +{ + char* src = &s[0]; + char* dst = src; + while ( *src ) + { + if ( src[0] == '/' && src[1] == '/' ) + { + src += 2; + while ( *src && *src != '\n' ) + src++; + if ( *src ) + src++; // skip newline + } + else if ( src[0] == '/' && src[1] == '*' ) + { + src += 2; + char* newsrc = strstr ( src, "*/" ); + if ( !newsrc ) + break; + src = newsrc; + //while ( *src && ( src[0] != '*' || src[1] != '/' ) ) + // src++; + if ( *src ) src++; + if ( *src ) src++; + } + else if ( src[0] == '\r' && strip_lf ) + src++; + else + *dst++ = *src++; + } + *dst = '\0'; + + s.resize ( dst-&s[0] ); +} diff --git a/rosapps/sysutils/utils/sdkparse/strip_comments.h b/rosapps/sysutils/utils/sdkparse/strip_comments.h new file mode 100644 index 00000000000..d98219ef23a --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/strip_comments.h @@ -0,0 +1,10 @@ +// strip_comments.h + +#ifndef STRIP_COMMENTS_H +#define STRIP_COMMENTS_H + +#include + +void strip_comments ( std::string& s, bool strip_lf = false ); + +#endif//STRIP_COMMENTS_H diff --git a/rosapps/sysutils/utils/sdkparse/test.h b/rosapps/sysutils/utils/sdkparse/test.h new file mode 100644 index 00000000000..189570bd1ef --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/test.h @@ -0,0 +1,263 @@ +/* $Id$ +*/ +/* + * test.h + * + * This file is a combination of a couple different headers + * from ReactOS's include/ folder, and a little bit of custom + * hacking as well for the purpose of testing sdkparse. + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef __INTERNAL_PSAPI_H_INCLUDED__ +#define __INTERNAL_PSAPI_H_INCLUDED__ + +void *_lfind(const void* match, const void* start,unsigned int* array_size, unsigned int elem_size,int (*cf)(const void*,const void*)); + +static inline struct _TEB * NtCurrentTeb(void) +{ + struct _TEB * pTeb; + + /* FIXME: instead of hardcoded offsets, use offsetof() - if possible */ + __asm__ __volatile__ + ( + "movl %%fs:0x18, %0\n" /* fs:18h == Teb->Tib.Self */ + : "=r" (pTeb) /* can't have two memory operands */ + : /* no inputs */ + ); + + return pTeb; +} + +typedef struct tagFOO +{ + INT lonibble : 4; + INT hinibble : 4; +} FOO, *PFOO, FAR *LPFOO; + +/* INCLUDES */ +#define NTOS_MODE_USER +#include + +/* OBJECTS */ +typedef struct +{ + LPSTR LeftVolumeName; + LPSTR RightVolumeName; + ULONG DefaultVolume; + ULONG Type; + ULONG DeviceType; + char Key[4]; + LPSTR PrototypeName; + PVOID DeferredRoutine; + PVOID ExclusionRoutine; + PVOID DispatchRoutine; + PVOID DevCapsRoutine; + PVOID HwSetVolume; + ULONG IoMethod; +}SOUND_DEVICE_INIT; + +/* TYPES */ +typedef NTSTATUS NTAPI (*PPROC_ENUM_ROUTINE) +( + IN PSYSTEM_PROCESSES CurrentProcess, + IN OUT PVOID CallbackContext +); + +typedef NTSTATUS NTAPI (*PTHREAD_ENUM_ROUTINE) +( + IN PSYSTEM_THREADS CurrentThread, + IN OUT PVOID CallbackContext +); + +typedef NTSTATUS NTAPI (*PSYSMOD_ENUM_ROUTINE) +( + IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, + IN OUT PVOID CallbackContext +); + +typedef NTSTATUS NTAPI (*PPROCMOD_ENUM_ROUTINE) +( + IN HANDLE ProcessHandle, + IN PLDR_DATA_TABLE_ENTRY CurrentModule, + IN OUT PVOID CallbackContext +); + +/* CONSTANTS */ +#define FAILED_WITH_STATUS DEFINE_DBG_MSG("%s() failed, status 0x%08X") + +/* PROTOTYPES */ +/* Processes and threads */ +/* enumeration */ +NTSTATUS +NTAPI +PsaEnumerateProcessesAndThreads +( + IN PPROC_ENUM_ROUTINE ProcessCallback, + IN OUT PVOID ProcessCallbackContext, + IN PTHREAD_ENUM_ROUTINE ThreadCallback, + IN OUT PVOID ThreadCallbackContext +); + +NTSTATUS +NTAPI +PsaEnumerateProcesses +( + IN PPROC_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +NTSTATUS +NTAPI +PsaEnumerateThreads +( + IN PTHREAD_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +/* capturing & walking */ +NTSTATUS +NTAPI +PsaCaptureProcessesAndThreads +( + OUT PSYSTEM_PROCESSES * ProcessesAndThreads +); + +NTSTATUS +NTAPI +PsaWalkProcessesAndThreads +( + IN PSYSTEM_PROCESSES ProcessesAndThreads, + IN PPROC_ENUM_ROUTINE ProcessCallback, + IN OUT PVOID ProcessCallbackContext, + IN PTHREAD_ENUM_ROUTINE ThreadCallback, + IN OUT PVOID ThreadCallbackContext +); + +NTSTATUS +NTAPI +PsaWalkProcesses +( + IN PSYSTEM_PROCESSES ProcessesAndThreads, + IN PPROC_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +NTSTATUS +NTAPI +PsaWalkThreads +( + IN PSYSTEM_PROCESSES ProcessesAndThreads, + IN PTHREAD_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +PSYSTEM_PROCESSES +FASTCALL +PsaWalkFirstProcess +( + IN PSYSTEM_PROCESSES ProcessesAndThreads +); + +PSYSTEM_PROCESSES +FASTCALL +PsaWalkNextProcess +( + IN PSYSTEM_PROCESSES CurrentProcess +); + +PSYSTEM_THREADS +FASTCALL +PsaWalkFirstThread +( + IN PSYSTEM_PROCESSES CurrentProcess +); + +PSYSTEM_THREADS +FASTCALL +PsaWalkNextThread +( + IN PSYSTEM_THREADS CurrentThread +); + +/* System modules */ +/* enumeration */ +NTSTATUS +NTAPI +PsaEnumerateSystemModules +( + IN PSYSMOD_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +/* capturing & walking */ +NTSTATUS +NTAPI +PsaCaptureSystemModules +( + OUT PSYSTEM_MODULE_INFORMATION * SystemModules +); + +NTSTATUS +NTAPI +PsaWalkSystemModules +( + IN PSYSTEM_MODULE_INFORMATION SystemModules, + IN PSYSMOD_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +PSYSTEM_MODULE_INFORMATION_ENTRY +FASTCALL +PsaWalkFirstSystemModule +( + IN PSYSTEM_MODULE_INFORMATION SystemModules +); + +PSYSTEM_MODULE_INFORMATION_ENTRY +FASTCALL +PsaWalkNextSystemModule +( + IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule +); + +/* Process modules */ +NTSTATUS +NTAPI +PsaEnumerateProcessModules +( + IN HANDLE ProcessHandle, + IN PPROCMOD_ENUM_ROUTINE Callback, + IN OUT PVOID CallbackContext +); + +/* Miscellaneous */ +VOID +NTAPI +PsaFreeCapture +( + IN PVOID Capture +); + +/* The user must define these functions. They are called by PSAPI to allocate + memory. This allows PSAPI to be called from any environment */ +void *PsaiMalloc(SIZE_T size); +void *PsaiRealloc(void *ptr, SIZE_T size); +void PsaiFree(void *ptr); + +/* MACROS */ +#define DEFINE_DBG_MSG(__str__) "PSAPI: " __str__ "\n" + +#endif /* __INTERNAL_PSAPI_H_INCLUDED__ */ + +/* EOF */ diff --git a/rosapps/sysutils/utils/sdkparse/tokenize.cpp b/rosapps/sysutils/utils/sdkparse/tokenize.cpp new file mode 100644 index 00000000000..94f9c9a2d48 --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/tokenize.cpp @@ -0,0 +1,312 @@ +// tokenize.cpp + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#include +#include +#include + +#include "assert.h" +#include "tokenize.h" +#include "skip_ws.h" + +using std::string; +using std::vector; + +void tokenize ( const string& text, vector& tokens ) +{ + tokens.resize ( 0 ); + string s ( text ); + char* p = &s[0]; + while ( *p ) + { + // skip whitespace + p = skip_ws ( p ); + // check for literal string + if ( *p == '\"' ) + { + // skip initial quote + char* end = p + 1; + for ( ;; ) + { + if ( *end == '\\' ) + { + end++; + switch ( *end ) + { + case 'x': + case 'X': + ASSERT(0); // come back to this.... + break; + case '0': + ASSERT(0); + break; + default: + end++; + break; + } + } + else if ( *end == '\"' ) + { + end++; + break; + } + else + end++; + } + tokens.push_back ( string ( p, end-p ) ); + p = end; + } + else if ( __iscsymf(*p) ) + { + char* end = p + 1; + while ( __iscsym ( *end ) ) + end++; + tokens.push_back ( string ( p, end-p ) ); + p = end; + } + else if ( isdigit(*p) || *p == '.' ) + { + char* end = p; + while ( isdigit(*end) ) + end++; + bool f = false; + if ( *end == '.' ) + { + end++; + while ( isdigit(*end) ) + end++; + f = true; + } + if ( *end == 'f' || *end == 'F' ) + end++; + else if ( !f && ( *end == 'l' || *end == 'L' ) ) + end++; + tokens.push_back ( string ( p, end-p ) ); + p = end; + } + else switch ( *p ) + { + case '.': + tokens.push_back ( "." ); + p++; + break; + case ',': + tokens.push_back ( "," ); + p++; + break; + case '(': + tokens.push_back ( "(" ); + p++; + break; + case ')': + tokens.push_back ( ")" ); + p++; + break; + case '{': + tokens.push_back ( "{" ); + p++; + break; + case '}': + tokens.push_back ( "}" ); + p++; + break; + case '[': + tokens.push_back ( "[" ); + p++; + break; + case ']': + tokens.push_back ( "]" ); + p++; + break; + case ';': + tokens.push_back ( ";" ); + p++; + break; + case '\\': + switch ( p[1] ) + { + case '\n': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + ASSERT(0); // shouldn't hit here, I think + tokens.push_back ( "\\" ); + p++; + break; + } + break; + case '|': + switch ( p[1] ) + { + case '|': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "|" ); + p++; + break; + } + break; + case '&': + switch ( p[1] ) + { + case '&': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "&" ); + p++; + break; + } + break; + case '<': + switch ( p[1] ) + { + case '<': + if ( p[2] == '=' ) + tokens.push_back ( string ( p, 3 ) ), p += 3; + else + tokens.push_back ( string ( p, 2 ) ), p += 2; + break; + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "<" ); + p++; + break; + } + break; + case '>': + switch ( p[1] ) + { + case '>': + if ( p[2] == '=' ) + tokens.push_back ( string ( p, 3 ) ), p += 3; + else + tokens.push_back ( string ( p, 2 ) ), p += 2; + break; + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( ">" ); + p++; + break; + } + break; + case '!': + switch ( p[1] ) + { + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "!" ); + p++; + break; + } + break; + case '=': + switch ( p[1] ) + { + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "=" ); + p++; + break; + } + break; + case ':': + switch ( p[1] ) + { + case ':': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( ":" ); + p++; + break; + } + break; + case '*': + switch ( p[1] ) + { + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "*" ); + p++; + break; + } + break; + case '/': + switch ( p[1] ) + { + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "/" ); + p++; + break; + } + break; + case '+': + switch ( p[1] ) + { + case '+': + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "+" ); + p++; + break; + } + break; + case '-': + switch ( p[1] ) + { + case '-': + case '=': + tokens.push_back ( string ( p, 2 ) ); + p += 2; + break; + default: + tokens.push_back ( "-" ); + p++; + break; + } + break; + case '#': + while ( *p && *p != '\n' ) + p++; + break; + case 0: + break; + default: + printf ( "choked on '%c' in tokenize() - press any key to continue\n", *p ); + getch(); + p++; + break; + } + } +} \ No newline at end of file diff --git a/rosapps/sysutils/utils/sdkparse/tokenize.h b/rosapps/sysutils/utils/sdkparse/tokenize.h new file mode 100644 index 00000000000..14088bee06a --- /dev/null +++ b/rosapps/sysutils/utils/sdkparse/tokenize.h @@ -0,0 +1,8 @@ +// tokenize.h + +#ifndef TOKENIZE_H +#define TOKENIZE_H + +void tokenize ( const std::string& text, std::vector& tokens ); + +#endif//TOKENIZE_H diff --git a/rosapps/sysutils/utils/stats/stats.c b/rosapps/sysutils/utils/stats/stats.c new file mode 100644 index 00000000000..d69b81a1f3f --- /dev/null +++ b/rosapps/sysutils/utils/stats/stats.c @@ -0,0 +1,478 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS project statistics + * FILE: stats.c + * PURPOSE: Main program file + * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) + * REVISIONS: + * CSH 01/01-2002 Created + */ +#include +#include +#include + +typedef struct _EXTENSION_INFO +{ + struct _EXTENSION_INFO * Next; + struct _FILE_INFO * StatInfoList; + TCHAR ExtName[16]; + TCHAR ExpandedExtName[128]; + DWORD nExtensions; + TCHAR Description[256]; + DWORD FileCount; + DWORD LineCount; + DWORD EmptyLines; +} EXTENSION_INFO, *PEXTENSION_INFO; + +typedef struct _FILE_INFO +{ + struct _FILE_INFO * Next; + struct _FILE_INFO * StatInfoListNext; + PEXTENSION_INFO ExtInfo; + TCHAR FileName[MAX_PATH]; + DWORD LineCount; + DWORD EmptyLines; + DWORD FunctionCount; +} FILE_INFO, *PFILE_INFO; + +HANDLE FileHandle; +PEXTENSION_INFO ExtInfoList; +PFILE_INFO StatInfoList; +BOOLEAN SkipEmptyLines, BeSilent; + +#define MAX_OPTIONS 2 +TCHAR *Options[MAX_OPTIONS]; + + +VOID +Initialize(VOID) +{ + ExtInfoList = NULL; + StatInfoList = NULL; +} + + +VOID +Cleanup(VOID) +{ + PEXTENSION_INFO ExtInfo; + PEXTENSION_INFO NextExtInfo; + + ExtInfo = ExtInfoList; + while (ExtInfo != NULL) + { + NextExtInfo = ExtInfo->Next; + HeapFree (GetProcessHeap(), 0, ExtInfo); + ExtInfo = NextExtInfo; + } +} + + +PEXTENSION_INFO +AddExtension(LPTSTR ExtName, + LPTSTR Description) +{ + PEXTENSION_INFO ExtInfo; + PEXTENSION_INFO Info; + TCHAR *t; + DWORD ln; + + ExtInfo = (PEXTENSION_INFO) HeapAlloc (GetProcessHeap(), 0, sizeof (EXTENSION_INFO)); + if (!ExtInfo) + return NULL; + + for(t = ExtName; *t != _T('\0'); t += _tcslen(t) + 1); + ln = (DWORD)t - (DWORD)ExtName; + + ZeroMemory (ExtInfo, sizeof (EXTENSION_INFO)); + memcpy (ExtInfo->ExtName, ExtName, ln); + _tcscpy (ExtInfo->Description, Description); + + for(t = ExtInfo->ExtName; *t != _T('\0'); t += _tcslen(t) + 1) + { + if(ExtInfo->nExtensions++ != 0) + _tcscat (ExtInfo->ExpandedExtName, _T(";")); + _tcscat (ExtInfo->ExpandedExtName, _T("*.")); + _tcscat (ExtInfo->ExpandedExtName, t); + } + + if (ExtInfoList) + { + Info = ExtInfoList; + while (Info->Next != NULL) + { + Info = Info->Next; + } + Info->Next = ExtInfo; + } + else + { + ExtInfoList = ExtInfo; + } + + return ExtInfo; +} + + +PFILE_INFO +AddFile(LPTSTR FileName, + PEXTENSION_INFO ExtInfo) +{ + PFILE_INFO StatInfo; + PFILE_INFO Info; + + StatInfo = (PFILE_INFO) HeapAlloc (GetProcessHeap(), 0, sizeof (FILE_INFO)); + if (!StatInfo) + return NULL; + ZeroMemory (StatInfo, sizeof (FILE_INFO)); + _tcscpy (StatInfo->FileName, FileName); + StatInfo->ExtInfo = ExtInfo; + + if (ExtInfo->StatInfoList) + { + Info = ExtInfo->StatInfoList; + while (Info->StatInfoListNext != NULL) + { + Info = Info->StatInfoListNext; + } + Info->StatInfoListNext = StatInfo; + } + else + { + ExtInfo->StatInfoList = StatInfo; + } + + if (StatInfoList) + { + Info = StatInfoList; + while (Info->Next != NULL) + { + Info = Info->Next; + } + Info->Next = StatInfo; + } + else + { + StatInfoList = StatInfo; + } + + return StatInfo; +} + + +VOID +CleanupAfterFile(VOID) +{ + if(FileHandle != INVALID_HANDLE_VALUE) + CloseHandle (FileHandle); +} + + +BOOL +LoadFile(LPTSTR FileName) +{ + LONG FileSize; + + FileHandle = CreateFile (FileName, // Create this file + GENERIC_READ, // Open for reading + 0, // No sharing + NULL, // No security + OPEN_EXISTING, // Open the file + FILE_ATTRIBUTE_NORMAL, // Normal file + NULL); // No attribute template + if (FileHandle == INVALID_HANDLE_VALUE) + return FALSE; + + FileSize = GetFileSize (FileHandle, NULL); + if (FileSize <= 0) + { + CloseHandle (FileHandle); + return FALSE; + } + + return TRUE; +} + + +VOID +ReadLines(PFILE_INFO StatInfo) +{ + DWORD ReadBytes, LineLen; + static char FileBuffer[1024]; + char LastChar = '\0'; + char *Current; + + LineLen = 0; + while(ReadFile (FileHandle, FileBuffer, sizeof(FileBuffer), &ReadBytes, NULL) && ReadBytes >= sizeof(char)) + { + for(Current = FileBuffer; ReadBytes > 0; ReadBytes -= sizeof(char), Current++) + { + if(*Current == '\n' && LastChar == '\r') + { + LastChar = '\0'; + if(!SkipEmptyLines || (LineLen > 0)) + StatInfo->LineCount++; + if(LineLen == 0) + StatInfo->EmptyLines++; + LineLen = 0; + continue; + } + LastChar = *Current; + if(SkipEmptyLines && (*Current == ' ' || *Current == '\t')) + { + continue; + } + if(*Current != '\r') + LineLen++; + } + } + + StatInfo->LineCount += (LineLen > 0); + StatInfo->EmptyLines += ((LastChar != '\0') && (LineLen == 0)); +} + + +VOID +PrintStatistics(VOID) +{ + PEXTENSION_INFO Info; + DWORD TotalFileCount; + DWORD TotalLineCount; + DWORD TotalAvgLF; + DWORD TotalEmptyLines; + + TotalFileCount = 0; + TotalLineCount = 0; + TotalEmptyLines = 0; + Info = ExtInfoList; + + for (Info = ExtInfoList; Info != NULL; Info = Info->Next) + { + TotalFileCount += Info->FileCount; + TotalLineCount += Info->LineCount; + TotalEmptyLines += Info->EmptyLines; + } + + TotalAvgLF = (TotalFileCount ? TotalLineCount / TotalFileCount : 0); + + for (Info = ExtInfoList; Info != NULL; Info = Info->Next) + { + DWORD AvgLF; + + if (Info->FileCount != 0) + { + AvgLF = (Info->FileCount ? Info->LineCount / Info->FileCount : 0); + } + else + { + AvgLF = 0; + } + + _tprintf (_T("\n")); + _tprintf (_T("File extension%c : %s\n"), ((Info->nExtensions > 1) ? _T('s') : _T(' ')), Info->ExpandedExtName); + _tprintf (_T("File ext. description : %s\n"), Info->Description); + _tprintf (_T("Number of files : %lu\n"), Info->FileCount); + _tprintf (_T("Number of lines : %lu\n"), Info->LineCount); + if(SkipEmptyLines) + _tprintf (_T("Number of empty lines : %lu\n"), Info->EmptyLines); + _tprintf (_T("Proportion of lines : %.2f %%\n"), (float)(TotalLineCount ? (((float)Info->LineCount * 100) / (float)TotalLineCount) : 0)); + _tprintf (_T("Average no. lines/file : %lu\n"), AvgLF); + } + + _tprintf (_T("\n")); + _tprintf (_T("Total number of files : %lu\n"), TotalFileCount); + _tprintf (_T("Total number of lines : %lu\n"), TotalLineCount); + if(SkipEmptyLines) + _tprintf (_T("Total number of empty lines : %lu\n"), TotalEmptyLines); + _tprintf (_T("Average no. lines/file : %lu\n"), TotalAvgLF); +} + + +BOOL +ProcessFiles(LPTSTR Path) +{ + WIN32_FIND_DATA FindFile; + PEXTENSION_INFO Info; + TCHAR SearchPath[256]; + TCHAR FileName[256]; + TCHAR *Ext; + HANDLE SearchHandle; + BOOL More; + + Info = ExtInfoList; + while (Info != NULL) + { + Ext = Info->ExtName; + do + { + ZeroMemory (&FindFile, sizeof (FindFile)); + _tcscpy (SearchPath, Path); + _tcscat (SearchPath, _T("\\*.")); + _tcscat (SearchPath, Ext); + _tcscpy (FindFile.cFileName, SearchPath); + SearchHandle = FindFirstFile (SearchPath, &FindFile); + if (SearchHandle != INVALID_HANDLE_VALUE) + { + More = TRUE; + while (More) + { + if (!(FindFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + _tcscpy (FileName, Path); + _tcscat (FileName, _T("\\")); + _tcscat (FileName, FindFile.cFileName); + + if (LoadFile (FileName)) + { + PFILE_INFO StatInfo; + + StatInfo = AddFile (FindFile.cFileName, Info); + if (!StatInfo) + { + _tprintf (_T("Not enough free memory.\n")); + return FALSE; + } + + ReadLines (StatInfo); + + Info->FileCount++; + Info->LineCount += StatInfo->LineCount; + Info->EmptyLines += StatInfo->EmptyLines; + + CleanupAfterFile(); + } + } + More = FindNextFile (SearchHandle, &FindFile); + } + FindClose (SearchHandle); + } + Ext += _tcslen(Ext) + 1; + } while(*Ext != _T('\0')); + Info = Info->Next; + } + return TRUE; +} + + +BOOL +ProcessDirectories(LPTSTR Path) +{ + WIN32_FIND_DATA FindFile; + TCHAR SearchPath[MAX_PATH]; + HANDLE SearchHandle; + BOOL More; + + if(!BeSilent) + { + _tprintf (_T("Processing %s ...\n"), Path); + } + + _tcscpy (SearchPath, Path); + _tcscat (SearchPath, _T("\\*.*")); + + SearchHandle = FindFirstFileEx (SearchPath, + FindExInfoStandard, + &FindFile, + FindExSearchLimitToDirectories, + NULL, + 0); + if (SearchHandle != INVALID_HANDLE_VALUE) + { + More = TRUE; + while (More) + { + if ((FindFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + && (_tcscmp (FindFile.cFileName, _T(".")) != 0) + && (_tcscmp (FindFile.cFileName, _T("..")) != 0) + && (_tcscmp (FindFile.cFileName, _T("CVS")) != 0) + && (_tcscmp (FindFile.cFileName, _T(".svn")) != 0)) + { + _tcscpy (SearchPath, Path); + _tcscat (SearchPath, _T("\\")); + _tcscat (SearchPath, FindFile.cFileName); + if (!ProcessDirectories (SearchPath)) + return FALSE; + if (!ProcessFiles (SearchPath)) + return FALSE; + } + More = FindNextFile (SearchHandle, &FindFile); + } + FindClose (SearchHandle); + } + return TRUE; +} + + +VOID +Execute(LPTSTR Path) +{ + if (!ExtInfoList) + { + _tprintf (_T("No extensions specified.\n")); + return; + } + + if (!ProcessDirectories (Path)) + { + _tprintf (_T("Failed to process directories.\n")); + return; + } + + if (!ProcessFiles (Path)) + { + _tprintf (_T("Failed to process files.\n")); + return; + } + + PrintStatistics(); +} + +BOOLEAN +IsOptionSet(TCHAR *Option) +{ + int i; + for(i = 0; i < MAX_OPTIONS; i++) + { + if(!Options[i]) + continue; + + if(!_tcscmp(Options[i], Option)) + return TRUE; + } + return FALSE; +} + + +int _tmain(int argc, _TCHAR * argv[]) +{ + int a; + + _tprintf (_T("ReactOS Project Statistics\n")); + _tprintf (_T("==========================\n\n")); + + if (argc < 2 || argc > 2 + MAX_OPTIONS) + { + _tprintf(_T("Usage: stats [-e] [-s] directory\n")); + _tprintf(_T(" -e: don't count empty lines\n")); + _tprintf(_T(" -s: be silent, don't print directories while processing\n")); + return 1; + } + + Initialize(); + AddExtension (_T("c\0\0"), _T("Ansi C Source files")); + AddExtension (_T("cpp\0cxx\0\0"), _T("C++ Source files")); + AddExtension (_T("h\0\0"), _T("Header files")); + + for(a = 1; a < argc - 1; a++) + { + Options[a - 1] = argv[a]; + } + + SkipEmptyLines = IsOptionSet(_T("-e")); + BeSilent = IsOptionSet(_T("-s")); + + Execute (argv[argc - 1]); + Cleanup(); + + return 0; +} diff --git a/rosapps/sysutils/utils/stats/stats.rbuild b/rosapps/sysutils/utils/stats/stats.rbuild new file mode 100644 index 00000000000..374a7c7a339 --- /dev/null +++ b/rosapps/sysutils/utils/stats/stats.rbuild @@ -0,0 +1,9 @@ + + + + + msvcrt + kernel32 + ntdll + stats.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/theme/dump/manifest.rbuild b/rosapps/sysutils/utils/theme/dump/manifest.rbuild new file mode 100644 index 00000000000..c2f394722af --- /dev/null +++ b/rosapps/sysutils/utils/theme/dump/manifest.rbuild @@ -0,0 +1,24 @@ + + + + Dumps properties of Windows/ReactOS Visual Styles. + + + + + + + + diff --git a/rosapps/sysutils/utils/theme/dump/themedump.bpr b/rosapps/sysutils/utils/theme/dump/themedump.bpr new file mode 100644 index 00000000000..5a4195652b9 --- /dev/null +++ b/rosapps/sysutils/utils/theme/dump/themedump.bpr @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1040 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[CORBA] +AddServerUnit=1 +AddClientUnit=1 +PrecompiledHeaders=1 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + \ No newline at end of file diff --git a/rosapps/sysutils/utils/theme/dump/themedump.cpp b/rosapps/sysutils/utils/theme/dump/themedump.cpp new file mode 100644 index 00000000000..8a49ffc0aa6 --- /dev/null +++ b/rosapps/sysutils/utils/theme/dump/themedump.cpp @@ -0,0 +1,642 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define WIN32_LEAN_AND_MEAN +#define UNICODE +#include +#include +#include +#include + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#define SCHEMA_STRINGS +#define TMT_ENUMDEF (0x0D) // undocumented +#define TMT_ENUMVAL (0x0E) // undocumented +#define TMT_ENUM (0x0F) // undocumented +#include + +namespace tmdump +{ + typedef std::map tm_enum_t; + typedef std::map tm_enums_t; + + struct tm_property_t + { + std::wstring name; + int id; + int type; + tm_enums_t::iterator enum_type; + }; + + static tm_enums_t tm_enums; + + typedef std::list tm_properties_t; + + static tm_properties_t tm_properties; + + typedef std::map tm_states_t; + typedef std::map tm_state_enums_t; + + static tm_state_enums_t tm_state_enums; + + struct tm_part_t + { + std::wstring name; + tm_state_enums_t::iterator states; + }; + + typedef std::map tm_parts_t; + + typedef std::map tm_classes_t; + + static tm_classes_t tm_classes; + + class print + { + protected: + std::FILE * m_out; + + public: + print(std::FILE * out_): m_out(out_) { } + }; + + class property_print: + public print, + public std::unary_function + { + private: + wchar_t const * type_name(const tm_property_t& property_) + { + switch(property_.type) + { + case TMT_STRING: return L"LPWSTR"; + case TMT_INT: return L"int"; + case TMT_BOOL: return L"BOOL"; + case TMT_COLOR: return L"COLORREF"; + case TMT_MARGINS: return L"MARGINS"; + case TMT_FILENAME: return L"LPWSTR"; + case TMT_SIZE: return L"SIZE"; + case TMT_POSITION: return L"POINT"; + case TMT_RECT: return L"RECT"; + case TMT_FONT: return L"LOGFONT"; + case TMT_INTLIST: return L"INTLIST"; + case TMT_ENUM: return property_.enum_type->first.c_str(); + default: return L""; + } + } + + public: + property_print(std::FILE * out_): print(out_) { } + + void operator()(const tm_property_t& property_) + { + std::fwprintf + ( + m_out, + L"%s\t%s\t%d\n", + type_name(property_), + property_.name.c_str(), + property_.id + ); + } + }; + + class part_print: + public print, + public std::unary_function + { + public: + part_print(std::FILE * out_): print(out_) { } + + void operator()(const tm_parts_t::value_type& part_) + { + std::fwprintf + ( + m_out, + L"\t%s\t%d\t%s\n", + part_.second.name.c_str(), + part_.first, + part_.second.states == tm_state_enums.end() ? + L"-" : + part_.second.states->first.c_str() + ); + } + }; + + class class_print: + public print, + public std::unary_function + { + public: + class_print(std::FILE * out_): print(out_) { } + + void operator()(const tm_classes_t::value_type& class_) + { + std::fwprintf(m_out, L"%s\n", class_.first.c_str()); + + std::for_each + ( + class_.second.begin(), + class_.second.end(), + part_print(m_out) + ); + } + }; + + class schema_scan: public std::unary_function + { + private: + enum + { + at_none, + at_enum, + at_parts, + at_states + } + m_state; + + union + { + void * p_none; + tm_enum_t * p_enum; + tm_parts_t * p_class; + tm_states_t * p_states; + } + m_cur; + + bool has_suffix(const std::wstring& name_, const std::wstring& suffix_) + { + if(name_.length() <= suffix_.length()) return false; + + return std::equal + ( + name_.end() - suffix_.length(), + name_.end(), + suffix_.begin() + ); + } + + public: + schema_scan(): m_state(at_none) { } + + void operator()(const struct TMPROPINFO& prop_) + { + static const std::wstring parts_suffix(L"PARTS"); + static const std::wstring states_suffix(L"STATES"); + + std::wstring name(prop_.pszName); + + // Compound declaration + if(prop_.sEnumVal == TMT_ENUMDEF && prop_.bPrimVal == TMT_ENUMDEF) + { + // class + if(has_suffix(name, parts_suffix)) + { + m_state = at_parts; + m_cur.p_class = & + ( + tm_classes + [ + std::wstring(name.begin(), name.end() - parts_suffix.length()) + ] = tm_parts_t() + ); + } + // states + else if(has_suffix(name, states_suffix)) + { + m_state = at_states; + m_cur.p_states = & + ( + tm_state_enums + [ + std::wstring(name.begin(), name.end() - states_suffix.length()) + ] = tm_states_t() + ); + } + // enumeration + else + { + m_state = at_enum; + m_cur.p_enum = &(tm_enums[name] = tm_enum_t()); + } + } + // Enumeration member + else if(prop_.bPrimVal == TMT_ENUMVAL) switch(m_state) + { + // enumeration member + case at_enum: + { + (*m_cur.p_enum)[prop_.sEnumVal] = name; + break; + } + + // class part + case at_parts: + { + tm_part_t part; + part.name = name; + part.states = tm_state_enums.end(); + (*m_cur.p_class)[prop_.sEnumVal] = part; + break; + } + + // state + case at_states: + { + (*m_cur.p_states)[prop_.sEnumVal] = name; + break; + } + } + // Primitive type + else if(prop_.sEnumVal == prop_.bPrimVal) + { + m_state = at_none; + m_cur.p_none = NULL; + } + // Property + else + { + m_state = at_none; + m_cur.p_none = NULL; + + tm_property_t property; + + property.name = name; + property.id = prop_.sEnumVal; + property.type = prop_.bPrimVal; + + if(prop_.bPrimVal == TMT_ENUM) + property.enum_type = tm_enums.find(name); + + tm_properties.push_back(property); + } + } + }; + + struct state_mapping_t + { + LPWSTR classname; + int partid; + LPWSTR states; + }; + + static const tmdump::state_mapping_t state_map[] = + { + { L"BUTTON", 0, NULL }, + { NULL, BP_CHECKBOX, L"CHECKBOX" }, + { NULL, BP_GROUPBOX, L"GROUPBOX" }, + { NULL, BP_PUSHBUTTON, L"PUSHBUTTON" }, + { NULL, BP_RADIOBUTTON, L"RADIOBUTTON" }, + { L"CLOCK", CLP_TIME, L"CLOCK" }, + { L"COMBOBOX", CP_DROPDOWNBUTTON, L"COMBOBOX" }, + { L"EDIT", EP_EDITTEXT, L"EDITTEXT" }, + { L"EXPLORERBAR", 0, NULL }, + { NULL, EBP_HEADERCLOSE, L"HEADERCLOSE" }, + { NULL, EBP_HEADERPIN, L"HEADERPIN" }, + { NULL, EBP_IEBARMENU, L"IEBARMENU" }, + { NULL, EBP_NORMALGROUPCOLLAPSE, L"NORMALGROUPCOLLAPSE" }, + { NULL, EBP_NORMALGROUPEXPAND, L"NORMALGROUPEXPAND" }, + { NULL, EBP_SPECIALGROUPCOLLAPSE, L"SPECIALGROUPCOLLAPSE"}, + { NULL, EBP_SPECIALGROUPEXPAND, L"SPECIALGROUPEXPAND" }, + { L"HEADER", 0, NULL }, + { NULL, HP_HEADERITEM, L"HEADERITEM" }, + { NULL, HP_HEADERITEMLEFT, L"HEADERITEMLEFT" }, + { NULL, HP_HEADERITEMRIGHT, L"HEADERITEMRIGHT" }, + { NULL, HP_HEADERSORTARROW, L"HEADERSORTARROW" }, + { L"LISTVIEW", LVP_LISTITEM, L"LISTITEM " }, + { L"MENU", 0, NULL }, + { NULL, MP_MENUBARDROPDOWN, L"MENU" }, + { NULL, MP_MENUBARITEM, L"MENU" }, + { NULL, MP_CHEVRON, L"MENU" }, + { NULL, MP_MENUDROPDOWN, L"MENU" }, + { NULL, MP_MENUITEM, L"MENU" }, + { NULL, MP_SEPARATOR, L"MENU" }, + { L"MENUBAND", MDP_NEWAPPBUTTON, L"MENUBAND" }, + { L"PAGE", 0, NULL }, + { NULL, PGRP_DOWN, L"DOWN" }, + { NULL, PGRP_DOWNHORZ, L"DOWNHORZ" }, + { NULL, PGRP_UP, L"UP" }, + { NULL, PGRP_UPHORZ, L"UPHORZ" }, + { L"REBAR", RP_CHEVRON, L"CHEVRON" }, + { L"SCROLLBAR", 0, NULL }, + { NULL, SBP_ARROWBTN, L"ARROWBTN" }, + { NULL, SBP_LOWERTRACKHORZ, L"SCROLLBAR" }, + { NULL, SBP_LOWERTRACKVERT, L"SCROLLBAR" }, + { NULL, SBP_THUMBBTNHORZ, L"SCROLLBAR" }, + { NULL, SBP_THUMBBTNVERT, L"SCROLLBAR" }, + { NULL, SBP_UPPERTRACKHORZ, L"SCROLLBAR" }, + { NULL, SBP_UPPERTRACKVERT, L"SCROLLBAR" }, + { NULL, SBP_SIZEBOX, L"SIZEBOX" }, + { L"SPIN", 0, NULL }, + { NULL, SPNP_DOWN, L"DOWN" }, + { NULL, SPNP_DOWNHORZ, L"DOWNHORZ" }, + { NULL, SPNP_UP, L"UP" }, + { NULL, SPNP_UPHORZ, L"UPHORZ" }, + { L"STARTPANEL", 0, NULL }, + { NULL, SPP_LOGOFFBUTTONS, L"LOGOFFBUTTONS" }, + { NULL, SPP_MOREPROGRAMSARROW, L"MOREPROGRAMSARROW" }, + { L"TAB", 0, NULL }, + { NULL, TABP_TABITEM, L"TABITEM" }, + { NULL, TABP_TABITEMBOTHEDGE, L"TABITEMBOTHEDGE" }, + { NULL, TABP_TABITEMLEFTEDGE, L"TABITEMLEFTEDGE" }, + { NULL, TABP_TABITEMRIGHTEDGE, L"TABITEMRIGHTEDGE" }, + { NULL, TABP_TOPTABITEM, L"TOPTABITEM" }, + { NULL, TABP_TOPTABITEMBOTHEDGE, L"TOPTABITEMBOTHEDGE" }, + { NULL, TABP_TOPTABITEMLEFTEDGE, L"TOPTABITEMLEFTEDGE" }, + { NULL, TABP_TOPTABITEMRIGHTEDGE, L"TOPTABITEMRIGHTEDGE" }, + { L"TOOLBAR", 0, NULL }, + { NULL, TP_BUTTON, L"TOOLBAR" }, + { NULL, TP_DROPDOWNBUTTON, L"TOOLBAR" }, + { NULL, TP_SPLITBUTTON, L"TOOLBAR" }, + { NULL, TP_SPLITBUTTONDROPDOWN, L"TOOLBAR" }, + { NULL, TP_SEPARATOR, L"TOOLBAR" }, + { NULL, TP_SEPARATORVERT, L"TOOLBAR" }, + { L"TOOLTIP", 0, NULL }, + { NULL, TTP_BALLOON, L"BALLOON" }, + { NULL, TTP_BALLOONTITLE, L"BALLOON" }, + { NULL, TTP_CLOSE, L"CLOSE" }, + { NULL, TTP_STANDARD, L"STANDARD" }, + { NULL, TTP_STANDARDTITLE, L"STANDARD" }, + { L"TRACKBAR", 0, NULL }, + { NULL, TKP_THUMB, L"THUMB" }, + { NULL, TKP_THUMBBOTTOM, L"THUMBBOTTOM" }, + { NULL, TKP_THUMBLEFT, L"THUMBLEFT" }, + { NULL, TKP_THUMBRIGHT, L"THUMBRIGHT" }, + { NULL, TKP_THUMBTOP, L"THUMBTOP" }, + { NULL, TKP_THUMBVERT, L"THUMBVERT" }, + { NULL, TKP_TICS, L"TICS" }, + { NULL, TKP_TICSVERT, L"TICSVERT" }, + { NULL, TKP_TRACK, L"TRACK" }, + { NULL, TKP_TRACKVERT, L"TRACKVERT" }, + { L"TREEVIEW", 0, NULL }, + { NULL, TVP_GLYPH, L"GLYPH" }, + { NULL, TVP_TREEITEM, L"TREEITEM" }, + { L"WINDOW", 0, NULL }, + { NULL, WP_CAPTION, L"CAPTION" }, + { NULL, WP_CLOSEBUTTON, L"CLOSEBUTTON" }, + { NULL, WP_FRAMEBOTTOM, L"FRAME" }, + { NULL, WP_FRAMELEFT, L"FRAME" }, + { NULL, WP_FRAMERIGHT, L"FRAME" }, + { NULL, WP_HELPBUTTON, L"HELPBUTTON" }, + { NULL, WP_HORZSCROLL, L"HORZSCROLL" }, + { NULL, WP_HORZTHUMB, L"HORZTHUMB" }, + { NULL, WP_MAXBUTTON, L"MAXBUTTON" }, + { NULL, WP_MAXCAPTION, L"MAXCAPTION" }, + { NULL, WP_MDICLOSEBUTTON, L"CLOSEBUTTON" }, + { NULL, WP_MDIHELPBUTTON, L"HELPBUTTON" }, + { NULL, WP_MDIMINBUTTON, L"MINBUTTON" }, + { NULL, WP_MDIRESTOREBUTTON, L"RESTOREBUTTON" }, + { NULL, WP_MDISYSBUTTON, L"SYSBUTTON" }, + { NULL, WP_MINBUTTON, L"MINBUTTON" }, + { NULL, WP_MINCAPTION, L"MINCAPTION" }, + { NULL, WP_RESTOREBUTTON, L"RESTOREBUTTON" }, + { NULL, WP_SMALLCAPTION, L"CAPTION" }, + { NULL, WP_SMALLCLOSEBUTTON, L"CLOSEBUTTON" }, + { NULL, WP_SMALLFRAMEBOTTOM, L"FRAME" }, + { NULL, WP_SMALLFRAMELEFT, L"FRAME" }, + { NULL, WP_SMALLFRAMERIGHT, L"FRAME" }, + { NULL, WP_SMALLMAXCAPTION, L"MAXCAPTION" }, + { NULL, WP_SMALLMINCAPTION, L"MINCAPTION" }, + { NULL, WP_SYSBUTTON, L"SYSBUTTON" }, + { NULL, WP_VERTSCROLL, L"HORZSCROLL" }, + { NULL, WP_VERTTHUMB, L"HORZTHUMB" }, + }; + + class state_link: public std::unary_function + { + private: + tm_classes_t::iterator m_class; + + public: + void operator()(const struct state_mapping_t& mapping_) + { + // switch to a new class + if(mapping_.classname) + m_class = tm_classes.find(std::wstring(mapping_.classname)); + + // no mapping, or class not found + if(mapping_.states == NULL || m_class == tm_classes.end()) return; + + tm_state_enums_t::iterator states = + tm_state_enums.find(std::wstring(mapping_.states)); + + // unknown set of states + if(states == tm_state_enums.end()) return; + + tm_parts_t::iterator part = m_class->second.find(mapping_.partid); + + // unknown part + if(part == m_class->second.end()) return; + + // success + part->second.states = states; + } + }; +} + +int main(int argc, char * argv[]) +{ + try + { + struct TMSCHEMAINFO const & schema = *GetSchemaInfo(); + + // build the tables of properties, classes, parts and states + std::for_each + ( + schema.pPropTable, + schema.pPropTable + schema.iPropCount, + tmdump::schema_scan() + ); + + // link parts to states + std::for_each + ( + tmdump::state_map, + tmdump::state_map + sizeof(tmdump::state_map) / sizeof(tmdump::state_map[0]), + tmdump::state_link() + ); + + ::InitCommonControls(); + ::SetThemeAppProperties(STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS); + + // dump the current values of all properties + for + ( + tmdump::tm_classes_t::iterator p = tmdump::tm_classes.begin(); + p != tmdump::tm_classes.end(); + ++ p + ) + { + const std::wstring& class_name = p->first; + + // open the theme data for the current class + class htheme_t + { + public: + HTHEME m_handle; + + htheme_t(HTHEME handle_): m_handle(handle_) { } + ~htheme_t() { ::CloseThemeData(m_handle); } + + operator HTHEME() { return m_handle; } + } + data = ::OpenThemeData(NULL, class_name.c_str()); + + // failure + if(data == NULL) + { + std::fwprintf + ( + stderr, + L"OpenThemeData(\"%s\") failed, error %d\n", + class_name.c_str(), + GetLastError() + ); + + continue; + } + + // class name + std::fwprintf(stdout, L"%s\n", p->first.c_str()); + + // dump system properties + for + ( + tmdump::tm_properties_t::iterator p = tmdump::tm_properties.begin(); + p != tmdump::tm_properties.end(); + ++ p + ) + { + switch(p->type) + { + case TMT_POSITION: + case TMT_MARGINS: + case TMT_RECT: + case TMT_INTLIST: + continue; + } + + // property name + std::fwprintf(stdout, L"\t%s = ", p->name.c_str()); + + HRESULT hres; + + switch(p->type) + { + // string + case TMT_STRING: + case TMT_FILENAME: // FIXME + { + WCHAR buffer[256]; + if(FAILED(hres = GetThemeSysString(data, p->id, buffer, 256))) break; + std::fwprintf(stdout, L"string: \"%s\"", buffer); + break; + } + + // integer + case TMT_INT: + { + int val; + if(FAILED(hres = GetThemeSysInt(data, p->id, &val))) break; + std::fwprintf(stdout, L"int: %d", val); + break; + } + + // boolean + case TMT_BOOL: + { + SetLastError(0); + BOOL val = GetThemeSysBool(data, p->id); + if(FAILED(hres = GetLastError())) break; + std::fwprintf(stdout, L"bool: %s", val ? L"true" : L"false"); + break; + } + + // color + case TMT_COLOR: + { + SetLastError(0); + + COLORREF val = GetThemeSysColor(data, p->id); + + if(FAILED(hres = GetLastError())) break; + + std::fwprintf + ( + stdout, + L"rgb: %d, %d, %d", + GetRValue(val), + GetGValue(val), + GetBValue(val) + ); + + break; + } + + // size + case TMT_SIZE: + { + SetLastError(0); + int val = GetThemeSysSize(data, p->id); + if(FAILED(hres = GetLastError())) break; + std::fwprintf(stdout, L"size: %d", val); + break; + } + + // font + case TMT_FONT: + { + LOGFONTW val; + if(FAILED(hres = GetThemeSysFont(data, p->id, &val))) break; + std::fwprintf(stdout, L"font: %s", val.lfFaceName); + break; + } + + // enumerated integer + case TMT_ENUM: + { + int val; + if(FAILED(hres = GetThemeSysInt(data, p->id, &val))) break; + + std::fwprintf(stdout, L"enum(%s): ", p->enum_type->first.c_str()); + + tmdump::tm_enum_t::iterator enumval = p->enum_type->second.find(val); + + if(enumval == p->enum_type->second.end()) + std::fwprintf(stdout, L"<%d>", val); + else + std::fwprintf(stdout, L"%s", enumval->second.c_str()); + + break; + } + } + + if(FAILED(hres)) std::fwprintf(stdout, L"", hres); + + std::fputwc(L'\n', stdout); + } + + } + } + catch(std::exception e) + { + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +// EOF + diff --git a/rosapps/sysutils/utils/theme/dump/themedump.rc b/rosapps/sysutils/utils/theme/dump/themedump.rc new file mode 100644 index 00000000000..8877498af39 --- /dev/null +++ b/rosapps/sysutils/utils/theme/dump/themedump.rc @@ -0,0 +1,6 @@ +#define WIN32_LEAN_AND_MEAN +#include + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "manifest.xml" + +// EOF diff --git a/rosapps/sysutils/utils/tickcount/tickcount.c b/rosapps/sysutils/utils/tickcount/tickcount.c new file mode 100644 index 00000000000..24177ff3107 --- /dev/null +++ b/rosapps/sysutils/utils/tickcount/tickcount.c @@ -0,0 +1,191 @@ +/* $Id$ +*/ +/* + tickcount -- Display the kernel tick count (or any tick count passed as an + argument or as input) in human-readable format + + This is public domain software +*/ + +#include +#include +#include +#include +#include + +typedef __int64 int64_; +typedef unsigned __int64 uint64_; + +#define TICKS_YEAR (TICKS_DAY * ((uint64_)365)) +#define TICKS_MONTH (TICKS_DAY * ((uint64_)30)) +#define TICKS_WEEK (TICKS_DAY * ((uint64_)7)) +#define TICKS_DAY (TICKS_HOUR * ((uint64_)24)) +#define TICKS_HOUR (TICKS_MINUTE * ((uint64_)60)) +#define TICKS_MINUTE (TICKS_SECOND * ((uint64_)60)) +#define TICKS_SECOND ((uint64_)1000) + +#define SLICES_COUNT (sizeof(ticks_per_slice) / sizeof(ticks_per_slice[0])) + +uint64_ ticks_per_slice[] = +{ + TICKS_YEAR, + TICKS_MONTH, + TICKS_WEEK, + TICKS_DAY, + TICKS_HOUR, + TICKS_MINUTE, + TICKS_SECOND, + 1 +}; + +_TCHAR * slice_names_singular[SLICES_COUNT] = +{ + _T("year"), + _T("month"), + _T("week"), + _T("day"), + _T("hour"), + _T("minute"), + _T("second"), + _T("millisecond") +}; + +_TCHAR * slice_names_plural[SLICES_COUNT] = +{ + _T("years"), + _T("months"), + _T("weeks"), + _T("days"), + _T("hours"), + _T("minutes"), + _T("seconds"), + _T("milliseconds") +}; + +void print_uptime +( + uint64_ tickcount, + uint64_ prevsliceval, + _TCHAR * prevsliceunit, + int curslice +) +{ + uint64_ tick_cur = tickcount / ticks_per_slice[curslice]; + uint64_ tick_residual = tickcount % ticks_per_slice[curslice]; + + assert(tick_cur <= (~((uint64_)0))); + + if(tick_residual == 0) + { + /* the current slice is the last */ + + if(prevsliceval == 0) + { + /* the current slice is the only */ + _tprintf + ( + _T("%u %s"), + (unsigned)tick_cur, + (tick_cur == 1 ? slice_names_singular : slice_names_plural)[curslice] + ); + } + else + { + /* the current slice is the last, and there's a previous slice */ + assert(prevsliceunit); + + /* print the previous and the current slice, and terminate */ + _tprintf + ( + _T("%u %s %s %u %s"), + (unsigned)prevsliceval, + prevsliceunit, + _T("and"), + (unsigned)tick_cur, + (tick_cur == 1 ? slice_names_singular : slice_names_plural)[curslice] + ); + } + } + else if(tick_cur != 0) + { + /* the current slice is not the last, and non-zero */ + + if(prevsliceval != 0) + { + /* there's a previous slice: print it */ + assert(prevsliceunit); + _tprintf(_T("%u %s, "), (unsigned)prevsliceval, prevsliceunit); + } + + /* recursion on the next slice size, storing the current slice */ + print_uptime + ( + tick_residual, + tick_cur, + (tick_cur == 1 ? slice_names_singular : slice_names_plural)[curslice], + curslice + 1 + ); + } + else + { + /* + the current slice is not the last, and zero: recursion, remembering the + previous non-zero slice + */ + print_uptime(tick_residual, prevsliceval, prevsliceunit, curslice + 1); + } +} + +int parse_print(const _TCHAR * str) +{ + int64_ tickcount; + + tickcount = _ttoi64(str); + + if(tickcount < 0) + tickcount = - tickcount; + else if(tickcount == 0) + return 1; + + print_uptime(tickcount, 0, NULL, 0); + _puttc(_T('\n'), stdout); + + return 0; +} + +int _tmain(int argc, _TCHAR * argv[]) +{ + int r; + + if(argc <= 1) + { + print_uptime((uint64_)GetTickCount(), 0, NULL, 0); + _puttc(_T('\n'), stdout); + } + else if(argc == 2 && argv[1][0] == _T('-') && argv[1][1] == 0) + { + while(!feof(stdin)) + { + _TCHAR buf[23]; + _TCHAR * str; + + str = _fgetts(buf, 22, stdin); + + if(str == NULL) + return 0; + + if((r = parse_print(str)) != 0) + return r; + } + } + else + { + int i; + + for(i = 1; i < argc; ++ i) + if((r = parse_print(argv[i])) != 0) + return r; + } + + return 0; +} diff --git a/rosapps/sysutils/utils/tickcount/tickcount.rbuild b/rosapps/sysutils/utils/tickcount/tickcount.rbuild new file mode 100644 index 00000000000..e47a0f9de95 --- /dev/null +++ b/rosapps/sysutils/utils/tickcount/tickcount.rbuild @@ -0,0 +1,9 @@ + + + + + msvcrt + kernel32 + ntdll + tickcount.c + \ No newline at end of file diff --git a/rosapps/sysutils/utils/utils.rbuild b/rosapps/sysutils/utils/utils.rbuild new file mode 100644 index 00000000000..f54ec14e532 --- /dev/null +++ b/rosapps/sysutils/utils/utils.rbuild @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rosapps/templates/template/template.c b/rosapps/templates/template/template.c new file mode 100644 index 00000000000..cbcf074bd41 --- /dev/null +++ b/rosapps/templates/template/template.c @@ -0,0 +1,284 @@ +/* + * ReactOS kernel + * Copyright (C) 2002 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: services/fs/template/template.c + * PURPOSE: Bare filesystem template + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include + +#define NDEBUG +#include + +typedef struct +{ + PDEVICE_OBJECT StorageDevice; +} DEVICE_EXTENSION, *PDEVICE_EXTENSION; + +/* GLOBALS ******************************************************************/ + +static PDRIVER_OBJECT DriverObject; + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +FsdCloseFile(PDEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject) +/* + * FUNCTION: Closes a file + */ +{ + return(STATUS_SUCCESS); +} + + +NTSTATUS STDCALL +FsdOpenFile(PDEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject, + PWSTR FileName) +/* + * FUNCTION: Opens a file + */ +{ + return(STATUS_SUCCESS); +} + + +BOOLEAN STDCALL +FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount) +/* + * FUNCTION: Tests if the device contains a filesystem that can be mounted + * by this fsd + */ +{ + return(TRUE); +} + + +NTSTATUS STDCALL +FsdMountDevice(PDEVICE_EXTENSION DeviceExt, + PDEVICE_OBJECT DeviceToMount) +/* + * FUNCTION: Mounts the device + */ +{ + return(STATUS_SUCCESS); +} + + +NTSTATUS STDCALL +FsdReadFile(PDEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject, + PVOID Buffer, + ULONG Length, + ULONG Offset) +/* + * FUNCTION: Reads data from a file + */ +{ + return(STATUS_SUCCESS); +} + + +NTSTATUS STDCALL +FsdClose(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + NTSTATUS Status; + + Status = FsdCloseFile(DeviceExtension,FileObject); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + + +NTSTATUS STDCALL +FsdCreate(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + NTSTATUS Status; + PDEVICE_EXTENSION DeviceExt; + + DeviceExt = DeviceObject->DeviceExtension; + Status = FsdOpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + + +NTSTATUS STDCALL +FsdWrite(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + DPRINT("FsdWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp); + + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + Irp->IoStatus.Information = 0; + return(STATUS_UNSUCCESSFUL); +} + +NTSTATUS STDCALL +FsdRead(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + ULONG Length; + PVOID Buffer; + ULONG Offset; + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PFILE_OBJECT FileObject = Stack->FileObject; + PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; + NTSTATUS Status; + + DPRINT("FsdRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp); + + Length = Stack->Parameters.Read.Length; + Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); + Offset = Stack->Parameters.Read.ByteOffset.LowPart; + + Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = Length; + IoCompleteRequest(Irp,IO_NO_INCREMENT); + return(Status); +} + + +NTSTATUS +FsdMount(PDEVICE_OBJECT DeviceToMount) +{ + PDEVICE_OBJECT DeviceObject; + PDEVICE_EXTENSION DeviceExt; + + IoCreateDevice(DriverObject, + sizeof(DEVICE_EXTENSION), + NULL, + FILE_DEVICE_FILE_SYSTEM, + 0, + FALSE, + &DeviceObject); + DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO; + DeviceExt = (PVOID)DeviceObject->DeviceExtension; + + FsdMountDevice(DeviceExt, + DeviceToMount); + + DeviceExt->StorageDevice = DeviceToMount; + DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject; + DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice; + DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED; + DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1; + DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; + + return(STATUS_SUCCESS); +} + + +NTSTATUS STDCALL +FsdFileSystemControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); + PVPB vpb = Stack->Parameters.Mount.Vpb; + PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject; + NTSTATUS Status; + + if (FsdHasFileSystem(DeviceToMount)) + { + Status = FsdMount(DeviceToMount); + } + else + { + Status = STATUS_UNRECOGNIZED_VOLUME; + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return(Status); +} + + +NTSTATUS STDCALL +DriverEntry(PDRIVER_OBJECT _DriverObject, + PUNICODE_STRING RegistryPath) +/* + * FUNCTION: Called by the system to initalize the driver + * ARGUMENTS: + * DriverObject = object describing this driver + * RegistryPath = path to our configuration entries + * RETURNS: Success or failure + */ +{ + PDEVICE_OBJECT DeviceObject; + NTSTATUS Status; + UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BareFsd"); + + DbgPrint("Bare FSD Template 0.0.1\n"); + + DriverObject = _DriverObject; + + Status = IoCreateDevice(DriverObject, + 0, + &DeviceName, + FILE_DEVICE_FILE_SYSTEM, + 0, + FALSE, + &DeviceObject); + if (!NT_SUCCESS(Status)) + { + return(Status); + } + + DeviceObject->Flags=0; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = FsdClose; + DriverObject->MajorFunction[IRP_MJ_CREATE] = FsdCreate; + DriverObject->MajorFunction[IRP_MJ_READ] = FsdRead; + DriverObject->MajorFunction[IRP_MJ_WRITE] = FsdWrite; + DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = + FsdFileSystemControl; + DriverObject->DriverUnload = NULL; + + IoRegisterFileSystem(DeviceObject); + + return(STATUS_SUCCESS); +} + +/* EOF */ diff --git a/rosapps/winefile/Doxyfile b/rosapps/winefile/Doxyfile new file mode 100644 index 00000000000..41ba87a3ce4 --- /dev/null +++ b/rosapps/winefile/Doxyfile @@ -0,0 +1,1213 @@ +# Doxyfile 1.4.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Winefile + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doxy-doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = YES + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the progam writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = NO + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm + +FILE_PATTERNS = *.c \ + *.h + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = doxy-footer.html + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 240 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = YES + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = YES + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = NO + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = YES diff --git a/rosapps/winefile/Makefile-MinGW b/rosapps/winefile/Makefile-MinGW new file mode 100644 index 00000000000..b0ac8fdc320 --- /dev/null +++ b/rosapps/winefile/Makefile-MinGW @@ -0,0 +1,56 @@ +# +# Winefile Makefile for MinGW +# + +CC = gcc +LD = gcc + +CFLAGS = -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 +RCFLAGS = -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifndef UNICODE +UNICODE = 1 +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +#LFLAGS += -Wl,--entry,_wWinMain@16 +RCFLAGS += -DUNICODE +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +PROGRAM = winefile + +OBJECTS = winefile.o + +LIBS = uuid user32 gdi32 advapi32 comctl32 shell32 comdlg32 ole32 version mpr + +DELAYIMPORTS = + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +all: $(TARGET) + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) + $(LD) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) $(addprefix -l,$(DELAYIMPORTS)) + +$(PROGRAM)$(RES_SUFFIX): $(PROGRAM).rc *.bmp *.ico + windres $(RCFLAGS) -o $@ $(PROGRAM).rc + +clean: + rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) diff --git a/rosapps/winefile/doxy-footer.html b/rosapps/winefile/doxy-footer.html new file mode 100644 index 00000000000..e0ea3bbe01a --- /dev/null +++ b/rosapps/winefile/doxy-footer.html @@ -0,0 +1,16 @@ +
+ + + + + +
+Winefile Source Code Documentation +
generated on 02.10.2005 by +doxygen +
+
+

Winefile Homepage +

+ + diff --git a/rosapps/winefile/doxy-footer.htmt b/rosapps/winefile/doxy-footer.htmt new file mode 100644 index 00000000000..0cb373766ad --- /dev/null +++ b/rosapps/winefile/doxy-footer.htmt @@ -0,0 +1,16 @@ +
+ + + + + +
+Winefile Source Code Documentation +
@GEN@ by +doxygen +
+
+

Winefile Homepage +

+ + diff --git a/rosapps/winefile/drivebar.bmp b/rosapps/winefile/drivebar.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6feabbde6949a4e45390b18dc597c6fc4ef4fc4a GIT binary patch literal 742 zcmcJMu?+$-3`IW(DKzNTU=DhAU<6kLD%`;ataH;a1KshQLx9A^eb48t|$N8J)@ql+J=-aD zEAblpa_8iFe$M05`r2r{Vt&BrF>W!gOj@|l>yWB)#^5r}CBTeZGmayW3sEleJS|=y1RWES(rORj=- zKCiY7--l0de%P7C0G<&(du{)@-^F|%nqz}}J7bU+{3e9Ww&?U@EL6Q;?PHyo2D81RIV9BoZtzexm^>4`iXaBU&zl1oB)pNE|K)$Jc z=eaD2$MfYzqn3|#hN1?^-KMm5KsLW^GB=U g_exp17!%e!>mrtq&BZ_@8FM~tJjws!Y?N+(0Tt}MX#fBK literal 0 HcmV?d00001 diff --git a/rosapps/winefile/lang/cs-CZ.rc b/rosapps/winefile/lang/cs-CZ.rc new file mode 100644 index 00000000000..0996ad2b924 --- /dev/null +++ b/rosapps/winefile/lang/cs-CZ.rc @@ -0,0 +1,212 @@ +/* + * WineFile + * Czech Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * Copyright 2004 David Kredba + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT +#pragma code_page(1250) + + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Soubor" { + MENUITEM "&Otevt\tEnter", ID_ACTIVATE + MENUITEM "&Pesunout...\tF7", ID_FILE_MOVE + MENUITEM "&Koprovat...\tF8", ID_FILE_COPY + MENUITEM "&Ve schrnce...\tF9", 118 + MENUITEM "&Smazat\tDel", ID_FILE_DELETE + MENUITEM "P&ejmenovat...", 109 + MENUITEM "V&lastnosti...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Komprese...", 119 + MENUITEM "&Dekomprese...", 120 + MENUITEM SEPARATOR + MENUITEM "&Spustit...", ID_EXECUTE + MENUITEM "&Tisknout...", 102 + MENUITEM "Asociovat...", 103 + MENUITEM SEPARATOR + MENUITEM "V&ytvoit adres...", 111 + MENUITEM "&Hledat...", 104 + MENUITEM "&Zvolit voubory...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "K&onec\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "K&onec", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Koprovat disk...", 201 + MENUITEM "&Jmenovka disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formtovat disk...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Vytvoit systemov disk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Pipojit &sov zazen", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Odpojit &sov zazen", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Sdlet jako...", 254 + MENUITEM "&Odstranit sdlen...", 255 + MENUITEM SEPARATOR + MENUITEM "&Zvolit zazen...", 251 + } + + POPUP "&Adrese" { + MENUITEM "&Dal rove\t+", 301 + MENUITEM "Rozbalit &strom\t*", 302 + MENUITEM "Rozbalit &ve\tStrg+*", 303 + MENUITEM "Sbalit &strom\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Oznait potomky", 505 + } + + POPUP "&Zobrazen" { + MENUITEM "&Strom a adrese", 413 + MENUITEM "&Jen strom", 411 + MENUITEM "Jen &adrese", 412 + MENUITEM SEPARATOR + MENUITEM "&Rozdlit", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Jmno", ID_VIEW_NAME + MENUITEM "&Detaily vech soubor", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&sten detaily...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Tdit podle jmna", ID_VIEW_SORT_NAME + MENUITEM "Tdit &podle typu", ID_VIEW_SORT_TYPE + MENUITEM "Tdit podle &velikosti", ID_VIEW_SORT_SIZE + MENUITEM "Tdit podle &data", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Tdit podle &...", ID_VIEW_FILTER + } + + POPUP "&Nastaven" { + MENUITEM "&Potvrzovn...", 501 + MENUITEM "&Psmo...", ID_SELECT_FONT + MENUITEM "Upravit panel &nstroj...", 512 + MENUITEM SEPARATOR + MENUITEM "&Panel nstroj", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Panel zaen", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Stavov dek", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "&Cela obrazovka\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimalizovat pi sputn", 504 + MENUITEM "&Uloit nastaven pi vypnut",511 + } + + + POPUP "&Zabezpeen" { + MENUITEM "&Pstup...", 605 + MENUITEM "&Logovn...", 606 + MENUITEM "&Vlastnk...", 607 + } + + POPUP "&Okno" { + MENUITEM "Nov &okno", ID_WINDOW_NEW + MENUITEM "Kaskdovn\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Uspodat &horizontln", ID_WINDOW_TILE_HORZ + MENUITEM "Uspodat &vertikln\tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Zarovnat automaticky", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Zarovnat &symboly", ID_WINDOW_ARRANGE + MENUITEM "&Aktualizovat\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Tmata npovdy\tF1", ID_HELP + MENUITEM "Hledn v &npovd...\tF1", ID_HELP + MENUITEM "&Jak pouvat npovdu\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Informace o Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Informace o &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Spustit" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Pkaz:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Jako &Symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Zruit", 2, 158, 23, 47, 14 + PUSHBUTTON "&Pomoc", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Zvolte cl" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Cesta:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Zruit", 2, 158, 23, 47, 14 + PUSHBUTTON "&Prochzet", 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Aplikovn nastaven psma" + IDS_FONT_SEL_ERROR "Chyba pi volb novho psma." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Chyba" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Plocha" + IDS_SHELL "Pkazov dek" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Zatm neimplementovno" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Jmno" + IDS_COL_SIZE "Velikost" + IDS_COL_CDATE "Datum vytvoen" + IDS_COL_ADATE "Datum poslednho pstupu" + IDS_COL_MDATE "Datum posledn modifikace" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Linky" + IDS_COL_ATTR "Atributy" + IDS_COL_SEC "Zabezpeen" +} diff --git a/rosapps/winefile/lang/de-DE.rc b/rosapps/winefile/lang/de-DE.rc new file mode 100644 index 00000000000..2afaf2b7d76 --- /dev/null +++ b/rosapps/winefile/lang/de-DE.rc @@ -0,0 +1,262 @@ +/* + * Winefile + * German Language Support + * + * Copyright 2000, 2005 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) + + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Datei" { + MENUITEM "&ffnen\tEingabetaste", ID_ACTIVATE + MENUITEM "&Verschieben...\tF7", ID_FILE_MOVE + MENUITEM "&Kopieren...\tF8", ID_FILE_COPY + MENUITEM "&In Zwischenablage...\tF9", 118 + MENUITEM "&Lschen\tEntf", ID_FILE_DELETE + MENUITEM "&Umbenennen...", 109 + MENUITEM "&Eigenschaften...\tAlt+Eingabetaste", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "K&omprimieren...", 119 + MENUITEM "Deko&mprimieren...", 120 + MENUITEM SEPARATOR + MENUITEM "&Ausfhren...", ID_EXECUTE + MENUITEM "&Drucken...", 102 + MENUITEM "Zuord&nen...", 103 + MENUITEM SEPARATOR + MENUITEM "Ver&zeichnis erstellen...", 111 + MENUITEM "&Suchen...", 104 + MENUITEM "Dateien aus&whlen...", 116 + MENUITEM SEPARATOR + MENUITEM "&Beenden\tAlt+X", ID_FILE_EXIT + } + + POPUP "Da&tentrger" { + MENUITEM "Datentrger &kopieren...", 201 + MENUITEM "Datentrger &benennen...", 202 + MENUITEM SEPARATOR + MENUITEM "Datentrger &formatieren...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Netzwerklaufwerk &verbinden...",ID_CONNECT_NETWORK_DRIVE + MENUITEM "Netzwerklaufwerk &trennen...",ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "F&reigeben als...", 254 + MENUITEM "Freigabe been&den...", 255 + MENUITEM SEPARATOR + MENUITEM "Laufwerk aus&whlen...", 251 + } + + + POPUP "&Verzeichnisse" { + MENUITEM "&Nchste Ebene einblenden\t+",301 + MENUITEM "&Zweig einblenden\t*", 302 + MENUITEM "Alle &Ebenen einblenden\tStrg+*",303 + MENUITEM "Zweig &ausblenden\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Verzweigungen kennzeichnen", 505 + } + + POPUP "&Ansicht" { + MENUITEM "Struktur &und Verzeichnis", 413 + MENUITEM "Nur St&ruktur", 411 + MENUITEM "Nur &Verzeichnis", 412 + MENUITEM SEPARATOR + MENUITEM "&Teilen", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Name", ID_VIEW_NAME + MENUITEM "A&lle Dateiangaben", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Bestimmte Dateiangaben...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "Nach N&ame", ID_VIEW_SORT_NAME + MENUITEM "Nach T&yp", ID_VIEW_SORT_TYPE + MENUITEM "Nach &Gre", ID_VIEW_SORT_SIZE + MENUITEM "Nach &Datum", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Angaben ausw&hlen...", ID_VIEW_FILTER + } + + POPUP "&Optionen" { + MENUITEM "&Besttigen...", 501 + MENUITEM "Schrift&art...", ID_SELECT_FONT + MENUITEM "Symbolleiste &definieren...", 512 + MENUITEM SEPARATOR + MENUITEM "Sy&mbolleiste", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "Lauf&werkleiste", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Statusleiste", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "Vollb&ild\tStrg+Umschalt+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Symbol nach Programmstart", 504 + MENUITEM "&Einstellungen beim Beenden speichern", 511 + } + + POPUP "&Sicherheit" { + MENUITEM "&Berechtigungen...", 605 + MENUITEM "ber&wachen...", 606 + MENUITEM "Besi&tzer...", 607 + } + + POPUP "&Fenster" { + MENUITEM "Neues &Fenster", ID_WINDOW_NEW + MENUITEM "ber&lappend\tUmschalt+F5", ID_WINDOW_CASCADE + MENUITEM "&Untereinander", ID_WINDOW_TILE_HORZ + MENUITEM "&Nebeneinander\tUmschalt+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "au&tomatisch anordnen", ID_WINDOW_AUTOSORT +#endif + MENUITEM "&Symbole anordnen", ID_WINDOW_ARRANGE + MENUITEM "&Aktualisieren\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Hilfethemen\tF1", ID_HELP + MENUITEM "&Suchen...\tF1", ID_HELP + MENUITEM "Hilfe &verwenden\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Info ber Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Info ber &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ausfhren" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "Befehls&zeile:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Als &Symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Abbrechen", 2, 158, 23, 47, 14 + PUSHBUTTON "&Hilfe", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ziel auswhlen" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Verzeichnis:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Abbrechen", 2, 158, 23, 47, 14 + PUSHBUTTON "&Durchsuchen", 254, 158, 43, 47, 14 +} + +IDD_DIALOG_VIEW_TYPE DIALOG DISCARDABLE 15, 13, 161, 97 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Angaben auswhlen" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Name:",-1,7,8,22,10 + EDITTEXT IDC_VIEW_PATTERN,31,7,63,12,ES_AUTOHSCROLL + GROUPBOX "Dateityp",-1,7,23,87,56 + CONTROL "&Verzeichnisse",IDC_VIEW_TYPE_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10 + CONTROL "&Programme",IDC_VIEW_TYPE_PROGRAMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,43,70,10 + CONTROL "&Dokumente",IDC_VIEW_TYPE_DOCUMENTS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,54,70,10 + CONTROL "&Andere Dateien",IDC_VIEW_TYPE_OTHERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,65,70,10 + CONTROL "Vers&teckte/Systemdateien anzeigen",IDC_VIEW_TYPE_HIDDEN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,81,106,9 + DEFPUSHBUTTON "OK",IDOK,104,7,50,14 + PUSHBUTTON "Abbrechen",IDCANCEL,104,24,50,14 +END + +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Eigenschaften fr %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,191,7,50,14 + PUSHBUTTON "Abbrechen",IDCANCEL,191,29,50,14 + LTEXT "&Dateiname:",-1,7,7,59,9 + EDITTEXT IDC_STATIC_PROP_FILENAME,71,7,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "&Pfad:",-1,7,18,59,9 + EDITTEXT IDC_STATIC_PROP_PATH,71,18,120,9, ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Letzte &nderung:",-1,7,29,59,9 + EDITTEXT IDC_STATIC_PROP_LASTCHANGE,71,29,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "&Version:",-1,7,40,59,9 + EDITTEXT IDC_STATIC_PROP_VERSION,71,40,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "&Copyright:",-1,7,51,59,9 + EDITTEXT IDC_STATIC_PROP_COPYRIGHT,71,51,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "&Gre:",-1,7,62,59,9 + EDITTEXT IDC_STATIC_PROP_SIZE,71,62,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + GROUPBOX "Attribute",-1,7,79,158,46 + CONTROL "&Schreibgeschtzt",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,91,68,9 + CONTROL "&Versteckt",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,91,68,9 + CONTROL "&Archiv",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,68,9 + CONTROL "Sys&tem",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,101,68,9 + CONTROL "&Komprimiert",IDC_CHECK_COMPRESSED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + GROUPBOX "&Versionsinformationen",-1,7,129,234,79 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL +END + + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Anwenden der Schriftarteinstellung" + IDS_FONT_SEL_ERROR "Fehler whrend der Schriftart-Auswahl." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Fehler" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Desktop" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Noch nicht implementiert" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Name" + IDS_COL_SIZE "Gre" + IDS_COL_CDATE "CDatum" + IDS_COL_ADATE "ZDatum" + IDS_COL_MDATE "Datum" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Links" + IDS_COL_ATTR "Attribute" + IDS_COL_SEC "Sicherheit" + + IDS_FREE_SPACE_FMT "%s von %s frei" +} diff --git a/rosapps/winefile/lang/en-US.rc b/rosapps/winefile/lang/en-US.rc new file mode 100644 index 00000000000..fc93b8dd7a3 --- /dev/null +++ b/rosapps/winefile/lang/en-US.rc @@ -0,0 +1,290 @@ +/* + * WineFile + * English Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(850) + + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&File" { + MENUITEM "&Open\tEnter", ID_ACTIVATE + MENUITEM "&Move...\tF7", ID_FILE_MOVE + MENUITEM "&Copy...\tF8", ID_FILE_COPY + MENUITEM "&In Clipboard...\tF9", 118 + MENUITEM "&Delete\tDel", ID_FILE_DELETE + MENUITEM "Re&name...", 109 + MENUITEM "Propert&ies...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "C&ompress...", 119 + MENUITEM "Dec&ompress...", 120 + MENUITEM SEPARATOR + MENUITEM "&Run...", ID_EXECUTE + MENUITEM "&Print...", 102 + MENUITEM "Associate...", 103 + MENUITEM SEPARATOR + MENUITEM "Cr&eate Directory...", 111 + MENUITEM "Searc&h...", 104 + MENUITEM "&Select Files...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "E&xit\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "E&xit", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Copy Disk...", 201 + MENUITEM "&Label Disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Format Disk...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Make System Disk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Connect &Network Drive", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Disconnect Network Drive", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Share as...", 254 + MENUITEM "&Remove Share...", 255 + MENUITEM SEPARATOR + MENUITEM "&Select Drive...", 251 + } + + POPUP "Di&rectories" { + MENUITEM "&Next Level\t+", 301 + MENUITEM "Expand &Tree\t*", 302 + MENUITEM "Expand &all\tStrg+*", 303 + MENUITEM "Collapse &Tree\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Mark Children", 505 + } + + POPUP "&View" { + MENUITEM "T&ree and Directory", 413 + MENUITEM "Tr&ee Only", 411 + MENUITEM "Directory &Only", 412 + MENUITEM SEPARATOR + MENUITEM "Sp&lit", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Name", ID_VIEW_NAME + MENUITEM "&All File Details", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Partial Details...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Sort by Name", ID_VIEW_SORT_NAME + MENUITEM "Sort &by Type", ID_VIEW_SORT_TYPE + MENUITEM "Sort by Si&ze", ID_VIEW_SORT_SIZE + MENUITEM "Sort by &Date", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Filter by &...", ID_VIEW_FILTER + } + + POPUP "&Options" { + MENUITEM "&Confirmation...", 501 + MENUITEM "&Font...", ID_SELECT_FONT + MENUITEM "Customize Tool&bar...", 512 + MENUITEM SEPARATOR + MENUITEM "&Toolbar", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Status Bar", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimize on run", 504 + MENUITEM "&Save settings on exit", 511 + } + + + POPUP "&Security" { + MENUITEM "&Access...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Owner...", 607 + } + + POPUP "&Window" { + MENUITEM "New &Window", ID_WINDOW_NEW + MENUITEM "Cascading\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ + MENUITEM "Tile &Vertically\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Arrange Automatically", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Arrange &Symbols", ID_WINDOW_ARRANGE + MENUITEM "&Refresh\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Help Topics\tF1", ID_HELP + MENUITEM "Help &Search...\tF1", ID_HELP + MENUITEM "&Using Help\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Info about Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Info about &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Execute" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Command:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "As &Symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancel", 2, 158, 23, 47, 14 + PUSHBUTTON "&Help", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select destination" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Path:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancel", 2, 158, 23, 47, 14 + PUSHBUTTON "&Browse", 254, 158, 43, 47, 14 +} + +IDD_DIALOG_VIEW_TYPE DIALOG DISCARDABLE 15, 13, 161, 97 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "By File Type" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Name:",-1,7,8,22,10 + EDITTEXT IDC_VIEW_PATTERN,31,7,63,12,ES_AUTOHSCROLL + GROUPBOX "File Type",-1,7,23,87,56 + CONTROL "&Directories",IDC_VIEW_TYPE_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10 + CONTROL "&Programs",IDC_VIEW_TYPE_PROGRAMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,43,70,10 + CONTROL "Docu&ments",IDC_VIEW_TYPE_DOCUMENTS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,54,70,10 + CONTROL "&Other files",IDC_VIEW_TYPE_OTHERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,65,70,10 + CONTROL "Show Hidden/&System Files",IDC_VIEW_TYPE_HIDDEN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,81,106,9 + DEFPUSHBUTTON "OK",IDOK,104,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,104,24,50,14 +END + +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Properties for %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,191,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,191,29,50,14 + LTEXT "&File Name:",-1,7,7,59,9 + EDITTEXT IDC_STATIC_PROP_FILENAME,71,7,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Full &Path:",-1,7,18,59,9 + EDITTEXT IDC_STATIC_PROP_PATH,71,18,120,9, ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Last Change:",-1,7,29,59,9 + EDITTEXT IDC_STATIC_PROP_LASTCHANGE,71,29,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Version:",-1,7,40,59,9 + EDITTEXT IDC_STATIC_PROP_VERSION,71,40,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Cop&yright:",-1,7,51,59,9 + EDITTEXT IDC_STATIC_PROP_COPYRIGHT,71,51,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Size:",-1,7,62,59,9 + EDITTEXT IDC_STATIC_PROP_SIZE,71,62,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + GROUPBOX "Attributes",-1,7,79,158,46 + CONTROL "&Read Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,91,68,9 + CONTROL "H&idden",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,91,68,9 + CONTROL "&Archive",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,68,9 + CONTROL "&System",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,101,68,9 + CONTROL "&Compressed",IDC_CHECK_COMPRESSED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + GROUPBOX "&Version Information",-1,7,129,234,79 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL +END + + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Applying font settings" + IDS_FONT_SEL_ERROR "Error while selecting new font." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Error" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Desktop" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Not yet implemented" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Name" + IDS_COL_SIZE "Size" + IDS_COL_CDATE "CDate" + IDS_COL_ADATE "ADate" + IDS_COL_MDATE "MDate" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Links" + IDS_COL_ATTR "Attributes" + IDS_COL_SEC "Security" + + IDS_FREE_SPACE_FMT "%s of %s free" +} + +STRINGTABLE +{ +IDS_LICENSE_CAPTION, "LICENSE" +IDS_LICENSE, +"This library is free software; you can redistribute it and/or \ +modify it under the terms of the GNU Lesser General Public \ +License as published by the Free Software Foundation; either \ +version 2.1 of the License, or (at your option) any later version.\n\ +This library is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details.\n\ +You should have received a copy of the GNU Lesser General Public \ +License along with this library; if not, write to the Free Software \ +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" + +IDS_WARRANTY_CAPTION, "NO WARRANTY" +IDS_WARRANTY, +"This library is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details." +} diff --git a/rosapps/winefile/lang/es-ES.rc b/rosapps/winefile/lang/es-ES.rc new file mode 100644 index 00000000000..434331e3023 --- /dev/null +++ b/rosapps/winefile/lang/es-ES.rc @@ -0,0 +1,258 @@ +/* + * WineFile + * Spanish Language Support + * + * Copyright 2004 Jos Manuel Ferrer Ortiz + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Archivo" { + MENUITEM "&Abrir\tEnter", ID_ACTIVATE + MENUITEM "Mo&ver...\tF7", ID_FILE_MOVE + MENUITEM "&Copiar...\tF8", ID_FILE_COPY + MENUITEM "E&n portapapeles...\tF9", 118 + MENUITEM "&Eliminar\tDel", ID_FILE_DELETE + MENUITEM "&Renombrar...", 109 + MENUITEM "&Propiedades...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "C&omprimir...", 119 + MENUITEM "&Descomprimir...", 120 + MENUITEM SEPARATOR + MENUITEM "E&jecutar...", ID_EXECUTE + MENUITEM "I&mprimir...", 102 + MENUITEM "Asoc&iar...", 103 + MENUITEM SEPARATOR + MENUITEM "Crear direc&torio...", 111 + MENUITEM "&Buscar...", 104 + MENUITEM "Se&leccionar archivos...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "&Salir\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "&Salir", ID_FILE_EXIT +#endif + } + + POPUP "&Disco" { + MENUITEM "&Copiar disco...", 201 + MENUITEM "E&tiquetar disco...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatear disco...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Hacer disco de sistema...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "C&onectar unidad de red", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Desconectar unidad de red", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Co&mpartir como...", 254 + MENUITEM "&Eliminar compartido...", 255 + MENUITEM SEPARATOR + MENUITEM "&Seleccionar unidad...", 251 + } + + POPUP "Di&rectorios" { + MENUITEM "&Siguiente nivel\t+", 301 + MENUITEM "&Expandir rbol\t*", 302 + MENUITEM "Expandir &todo\tStrg+*", 303 + MENUITEM "&Colapsar rbol\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Marcar hijos", 505 + } + + POPUP "&Ver" { + MENUITEM "&rbol y directorio", 413 + MENUITEM "rbol &slo", 411 + MENUITEM "&Directorio slo", 412 + MENUITEM SEPARATOR + MENUITEM "Di&vidir", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "No&mbre", ID_VIEW_NAME + MENUITEM "T&odos los detalles", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "Detalles &parciales...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "Ordenar por &nombre", ID_VIEW_SORT_NAME + MENUITEM "Ordenar por &tipo", ID_VIEW_SORT_TYPE + MENUITEM "Ordenar por t&amao", ID_VIEW_SORT_SIZE + MENUITEM "Ordenar por &fecha", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Ordenar por &...", ID_VIEW_FILTER + } + + POPUP "&Opciones" { + MENUITEM "&Confirmacin...", 501 + MENUITEM "&Fuente...", ID_SELECT_FONT + MENUITEM "Personalizar barra &herramientas...", 512 + MENUITEM SEPARATOR + MENUITEM "&Barra de herramientas", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "Barra de &unidades", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "Barra de &estado", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "&Pantalla completa\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimizar al ejecutarse", 504 + MENUITEM "&Guardar opciones al salir", 511 + } + + + POPUP "&Seguridad" { + MENUITEM "&Acceso...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Propietario...", 607 + } + + POPUP "&Ventana" { + MENUITEM "&Nueva ventana", ID_WINDOW_NEW + MENUITEM "&Cascada\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Mosaico &horizontal", ID_WINDOW_TILE_HORZ + MENUITEM "Mosaico &vertical\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "A&linear automticamente", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Alinear &smbolos", ID_WINDOW_ARRANGE + MENUITEM "&Actualizar\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Temas de ayuda\tF1", ID_HELP + MENUITEM "&Buscar en la ayuda...\tF1", ID_HELP + MENUITEM "&Usando la ayuda\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Acerca de Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Acerca de &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ejecutar" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Comando:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Como &smbolo", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "Aceptar", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancelar", 2, 158, 23, 47, 14 + PUSHBUTTON "&Ayuda", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Seleccione destino" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Ruta:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "Aceptar", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancelar", 2, 158, 23, 47, 14 + PUSHBUTTON "&Examinar", 254, 158, 43, 47, 14 +} +IDD_DIALOG_VIEW_TYPE DIALOG DISCARDABLE 15, 13, 161, 97 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "By File Type" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Nombre:",-1,7,8,22,10 + EDITTEXT IDC_VIEW_PATTERN,31,7,63,12,ES_AUTOHSCROLL + GROUPBOX "Typo de Fichero",-1,7,23,87,56 + CONTROL "&Directorios",IDC_VIEW_TYPE_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10 + CONTROL "&Programas",IDC_VIEW_TYPE_PROGRAMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,43,70,10 + CONTROL "Docu&mentos",IDC_VIEW_TYPE_DOCUMENTS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,54,70,10 + CONTROL "&Otros Ficheros",IDC_VIEW_TYPE_OTHERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,65,70,10 + CONTROL "Mostrar ficheros Escondidos/Systema (Hidden/&System) ",IDC_VIEW_TYPE_HIDDEN, + "Buton",BS_AUTOCHECKBOX | WS_TABSTOP,7,81,106,9 + DEFPUSHBUTTON "Aceptar",IDOK,104,7,50,14 + PUSHBUTTON "Cancelar",IDCANCEL,104,24,50,14 +END + +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Properties for %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Aceptar",IDOK,191,7,50,14 + PUSHBUTTON "Cancelar",IDCANCEL,191,29,50,14 + LTEXT "&File Name:",-1,7,7,59,9 + EDITTEXT IDC_STATIC_PROP_FILENAME,71,7,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Full &Path:",-1,7,18,59,9 + EDITTEXT IDC_STATIC_PROP_PATH,71,18,120,9, ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "ltimo Cambio:",-1,7,29,59,9 + EDITTEXT IDC_STATIC_PROP_LASTCHANGE,71,29,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Vercin:",-1,7,40,59,9 + EDITTEXT IDC_STATIC_PROP_VERSION,71,40,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Cop&yright:",-1,7,51,59,9 + EDITTEXT IDC_STATIC_PROP_COPYRIGHT,71,51,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "tamao:",-1,7,62,59,9 + EDITTEXT IDC_STATIC_PROP_SIZE,71,62,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + GROUPBOX "Atributos",-1,7,79,158,46 + CONTROL "&Lectura Solamente",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,91,68,9 + CONTROL "&Escondido",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,91,68,9 + CONTROL "&Archivado",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,68,9 + CONTROL "&Sistema",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,101,68,9 + CONTROL "&Comprimido",IDC_CHECK_COMPRESSED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + GROUPBOX "Informacin de &Vercin",-1,7,129,234,79 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL +END + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Aplicando configuracin de fuente" + IDS_FONT_SEL_ERROR "Error al seleccionar la nueva fuente." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Error" + IDS_ROOT_FS "sf raz" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Escritorio" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "An no implementado" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Nombre" + IDS_COL_SIZE "Tamao" + IDS_COL_CDATE "FechaC" + IDS_COL_ADATE "FechaA" + IDS_COL_MDATE "FechaM" + IDS_COL_IDX "ndice/Nodo-i" + IDS_COL_LINKS "Enlaces" + IDS_COL_ATTR "Atributos" + IDS_COL_SEC "Seguridad" +} diff --git a/rosapps/winefile/lang/fr-FR.rc b/rosapps/winefile/lang/fr-FR.rc new file mode 100644 index 00000000000..7678146399e --- /dev/null +++ b/rosapps/winefile/lang/fr-FR.rc @@ -0,0 +1,266 @@ +/* + * WineFile + * French Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * Copyright 2003 Sylvain Petreolle + * Copyright 2005 Jonathan Ernst + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Fichier" { + MENUITEM "&Ouvrir\tEntre", ID_ACTIVATE + MENUITEM "&Dplacer...\tF7", ID_FILE_MOVE + MENUITEM "&Copier...\tF8", ID_FILE_COPY + MENUITEM "P&resse-Papiers...\tF9", 118 + MENUITEM "&Effacer\tDel", ID_FILE_DELETE + MENUITEM "Re&nommer...", 109 + MENUITEM "&Proprits...\tAlt+Entree", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "Co&mpresser...", 119 + MENUITEM "Dcompre&sser...", 120 + MENUITEM SEPARATOR + MENUITEM "E&xcuter...", ID_EXECUTE + MENUITEM "&Imprimer...", 102 + MENUITEM "&Associer...", 103 + MENUITEM SEPARATOR + MENUITEM "Crer Rper&toire...", 111 + MENUITEM "Rec&hercher...", 104 + MENUITEM "Slectionner &Fichiers...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "&Quitter\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "&Quitter", ID_FILE_EXIT +#endif + } + + POPUP "&Disque" { + MENUITEM "&Copier Disque...", 201 + MENUITEM "&Nommer Disque...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formater Disque...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "Crer un disque *systme...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Connecter un lecteur &rseau",ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Dconnecter un lecteur rseau",ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "&Partager...", 254 + MENUITEM "Cesser de parta&ger", 255 + MENUITEM SEPARATOR + MENUITEM "Choisir le &lecteur", 251 + } + + POPUP "&Rpertoires" { + MENUITEM "&Dvelopper un niveau\t+", 301 + MENUITEM "Dvelopper une &branche\t*", 302 + MENUITEM "&Tout dvelopper\tCtrl+*", 303 + MENUITEM "&Rduire une branche\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Indiquer l'arborescence", 505 + } + + POPUP "&Vue" { + MENUITEM "Arbre et r&pertoire", 413 + MENUITEM "&Arbre seulement", 411 + MENUITEM "&Rpertoire seulement", 412 + MENUITEM SEPARATOR + MENUITEM "&Sparer", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Nom", ID_VIEW_NAME + MENUITEM "Tous &les Dtails", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Dtails...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "Trier par N&om", ID_VIEW_SORT_NAME + MENUITEM "Trier par &Type", ID_VIEW_SORT_TYPE + MENUITEM "Trier par Ta&ille", ID_VIEW_SORT_SIZE + MENUITEM "Trier par Dat&e", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Trier par &...", ID_VIEW_FILTER + } + + POPUP "&Options" { + MENUITEM "&Confirmation...", 501 + MENUITEM "&Police...", ID_SELECT_FONT + MENUITEM "Personnaliser la &barre d'Outils...", 512 + MENUITEM SEPARATOR + MENUITEM "Barre d'&Outils", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "Barre de &Lecteur", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "Barre d'&tat", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "P&lein cran\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Rduire a l'utilisation", 504 + MENUITEM "&Enregistrer la configuration en quittant",511 + } + + + POPUP "&Scurit" { + MENUITEM "&Accs...", 605 + MENUITEM "&Surveillance...", 606 + MENUITEM "&Propritaire...", 607 + } + + POPUP "&Fentre" { + MENUITEM "Nouvelle &fentre", ID_WINDOW_NEW + MENUITEM "&En cascade\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Mosaque &horizontale", ID_WINDOW_TILE_HORZ + MENUITEM "Mosaque &verticale\tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Rorganisation &Automatique", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Rorganiser les &icnes", ID_WINDOW_ARRANGE + MENUITEM "&Actualiser\tF5", ID_REFRESH + } + + POPUP "&Aide" { + MENUITEM "&Sommaire de l'aide\tF1", ID_HELP + MENUITEM "&Rechercher dans l'aide\tF1", ID_HELP + MENUITEM "&Utiliser l'aide\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&A propos de Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "A propos de &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Excuter" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Commande :", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Sous forme d'icne", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Annuler", 2, 158, 23, 47, 14 + PUSHBUTTON "&Aide", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Slectionner la destination" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Dossier:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Annuler", 2, 158, 23, 47, 14 + PUSHBUTTON "Pa&rcourir...", 254, 158, 43, 47, 14 +} + +IDD_DIALOG_VIEW_TYPE DIALOG DISCARDABLE 15, 13, 161, 97 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Par type de fichier" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Name:",-1,7,8,22,10 + EDITTEXT IDC_VIEW_PATTERN,31,7,63,12,ES_AUTOHSCROLL + GROUPBOX "Type de fichier",-1,7,23,87,56 + CONTROL "&Rpertoires",IDC_VIEW_TYPE_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10 + CONTROL "&Programmes",IDC_VIEW_TYPE_PROGRAMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,43,70,10 + CONTROL "Docu&ments",IDC_VIEW_TYPE_DOCUMENTS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,54,70,10 + CONTROL "&Autres fichiers",IDC_VIEW_TYPE_OTHERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,65,70,10 + CONTROL "Montrer les fichiers cachs/&systme",IDC_VIEW_TYPE_HIDDEN, + "Bouton",BS_AUTOCHECKBOX | WS_TABSTOP,7,81,106,9 + DEFPUSHBUTTON "OK",IDOK,104,7,50,14 + PUSHBUTTON "Annuler",IDCANCEL,104,24,50,14 +END + +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Proprits de %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,191,7,50,14 + PUSHBUTTON "Annuler",IDCANCEL,191,29,50,14 + LTEXT "Nom du &fichier:",-1,7,7,59,9 + EDITTEXT IDC_STATIC_PROP_FILENAME,71,7,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Chemin com&plet:",-1,7,18,59,9 + EDITTEXT IDC_STATIC_PROP_PATH,71,18,120,9, ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Modification:",-1,7,29,59,9 + EDITTEXT IDC_STATIC_PROP_LASTCHANGE,71,29,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Version:",-1,7,40,59,9 + EDITTEXT IDC_STATIC_PROP_VERSION,71,40,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Cop&yright:",-1,7,51,59,9 + EDITTEXT IDC_STATIC_PROP_COPYRIGHT,71,51,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Taille:",-1,7,62,59,9 + EDITTEXT IDC_STATIC_PROP_SIZE,71,62,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + GROUPBOX "Attributs",-1,7,79,158,46 + CONTROL "Lectu&re seule",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,91,68,9 + CONTROL "Cac&h",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,91,68,9 + CONTROL "&Archive",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,68,9 + CONTROL "&Systme",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,101,68,9 + CONTROL "&Compress",IDC_CHECK_COMPRESSED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + GROUPBOX "&Version Information",-1,7,129,234,79 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL +END + + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Appliquer les rglages des fontes" + IDS_FONT_SEL_ERROR "Erreur dans la slection de la nouvelle fonte." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Erreur" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Desktop" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Pas encore implment" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Nom" + IDS_COL_SIZE "Taille" + IDS_COL_CDATE "CDate" + IDS_COL_ADATE "ADate" + IDS_COL_MDATE "MDate" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Liens" + IDS_COL_ATTR "Attributs" + IDS_COL_SEC "Scurit" + + IDS_FREE_SPACE_FMT "%s sur %s libre" +} diff --git a/rosapps/winefile/lang/hu-HU.rc b/rosapps/winefile/lang/hu-HU.rc new file mode 100644 index 00000000000..5221f947197 --- /dev/null +++ b/rosapps/winefile/lang/hu-HU.rc @@ -0,0 +1,163 @@ +/* + * WineFile + * Hungarian Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * Copyright 2002 Zoly Nagy + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Fjl" { + MENUITEM "&Megynits\tEnter", ID_ACTIVATE + MENUITEM "t&helyezs...\tF7", ID_FILE_MOVE + MENUITEM "&Msols...\tF8", ID_FILE_COPY + MENUITEM "&Vglapon...\tF9", 118 + MENUITEM "&Trls\tDel", ID_FILE_DELETE + MENUITEM "t&nevezs...", 109 + MENUITEM "T&ulajdonsgok...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Becsomagols...", 119 + MENUITEM "K&icsomagols...", 120 + MENUITEM SEPARATOR + MENUITEM "&Futtats...", ID_EXECUTE + MENUITEM "&Nyomtats...", 102 + MENUITEM "Trsts...", 103 + MENUITEM SEPARATOR + MENUITEM "j &mappa...", 111 + MENUITEM "Kere&ss...", 104 + MENUITEM "Fjlok ki&vlasztsa...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "&Kilps\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "&Kilps", ID_FILE_EXIT +#endif + } + + POPUP "&Lemez" { + MENUITEM "Lemez &msolsa...", 201 + MENUITEM "&Lemezcimke...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatls...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Rendszerlemez ksztse...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "&Hlzati meghajt csatlakoztatsa",ID_CONNECT_NETWORK_DRIVE + MENUITEM "Hlzati meghajt levlasztsa",ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Megoszts...", 254 + MENUITEM "Megoszts &megszntetse...", 255 + MENUITEM SEPARATOR + MENUITEM "Meghajt ki&vlasztsa...", 251 + } + + POPUP "&Mappk" { + MENUITEM "&Kvetkez szint\t+", 301 + MENUITEM "&Fa kinyitsa\t*", 302 + MENUITEM "&Minden kinyitsa\tStrg+*", 303 + MENUITEM "Fa &becsuksa\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Gyermekek kijellse", 505 + } + + POPUP "&Nzet" { + MENUITEM "&Teljes", 413 + MENUITEM "&Knyvtrfa", 411 + MENUITEM "&Csak mappk", 412 + MENUITEM SEPARATOR + MENUITEM "&Feloszts", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Nv", ID_VIEW_NAME + MENUITEM "&Minden rszlet", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Egyedi...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Rendezs nv szerint", ID_VIEW_SORT_NAME + MENUITEM "Rendezs k&iterjeszts szerint",ID_VIEW_SORT_TYPE + MENUITEM "Rendezs &mret szerint", ID_VIEW_SORT_SIZE + MENUITEM "Rendezs &dtum szerint", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Egyedi rendezs &...", ID_VIEW_FILTER + } + + POPUP "&Belltsok" { + MENUITEM "&Megersts...", 501 + MENUITEM "&Betkszlet...", ID_SELECT_FONT + MENUITEM "E&gyedi eszkztr...", 512 + MENUITEM SEPARATOR + MENUITEM "&Eszkztr", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Lemeztr", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&llapotsor", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "&Teljes kpernys\tCtrl+Shift+S",ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "Programfuttats utni &szimblum",504 + MENUITEM "Megszntets a trols vgn",511 + } + + + POPUP "&Biztonsg" { + MENUITEM "&Hozzfrs...", 605 + MENUITEM "&Naplzs...", 606 + MENUITEM "&Tulajdonos...", 607 + } + + POPUP "&Ablakok" { + MENUITEM "j a&blak", ID_WINDOW_NEW + MENUITEM "Lpcszetes elrendezs\tCtrl+F5",ID_WINDOW_CASCADE + MENUITEM "Mozaikszer elrendezs &vzszintesen",ID_WINDOW_TILE_HORZ + MENUITEM "Mozaikszer elrendezs f&gglegesen\tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Automatikus elrendezs", ID_WINDOW_AUTOSORT +#endif + MENUITEM "&Szimblum elrendezs", ID_WINDOW_ARRANGE + MENUITEM "&Frissts\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Sg tmakrk\tF1", ID_HELP + MENUITEM "Sg &keress...\tF1", ID_HELP + MENUITEM "&Hasznlat\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Winefile-rl...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "W&ine-rl...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Futtats" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Parancs:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "&Szimblumknt", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Mgse", 2, 158, 23, 47, 14 + PUSHBUTTON "&Sg", 254, 158, 43, 47, 14 +} diff --git a/rosapps/winefile/lang/it-IT.rc b/rosapps/winefile/lang/it-IT.rc new file mode 100644 index 00000000000..b389ae81cd8 --- /dev/null +++ b/rosapps/winefile/lang/it-IT.rc @@ -0,0 +1,183 @@ +/* + * WineFile + * Italian Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * Copyright 2004 Ivan Leo Puoti + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&File" { + MENUITEM "&Apri\tInvio", ID_ACTIVATE + MENUITEM "&Sposta...\tF7", ID_FILE_MOVE + MENUITEM "&Copia...\tF8", ID_FILE_COPY + MENUITEM "&Negli Appunti...\tF9", 118 + MENUITEM "&Cancella\tDel", ID_FILE_DELETE + MENUITEM "Ri&nomina...", 109 + MENUITEM "Propri&et...\tAlt+Invio", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "C&omprimi...", 119 + MENUITEM "Dec&omprimi...", 120 + MENUITEM SEPARATOR + MENUITEM "&Esegui...", ID_EXECUTE + MENUITEM "&Stampa...", 102 + MENUITEM "Associa...", 103 + MENUITEM SEPARATOR + MENUITEM "Cr&ea Directory...", 111 + MENUITEM "Cerc&a...", 104 + MENUITEM "&Seleziona i file...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "E&sci\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "E&sci", ID_FILE_EXIT +#endif + } + + POPUP "&Disco" { + MENUITEM "&Copia Disco...", 201 + MENUITEM "&Etichetta Disco...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatta Disco...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Crea Disco di Sistema...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Connetti & Drive di Rete", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Disconnetti Drive di Rete", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Condividi come...", 254 + MENUITEM "&Rimuovi condivisione...", 255 + MENUITEM SEPARATOR + MENUITEM "&Seleziona Drive...", 251 + } + + POPUP "&Directory" { + MENUITEM "&Livello Sucessivo\t+", 301 + MENUITEM "Espandi &Albero\t*", 302 + MENUITEM "Espandi &tutto\tStrg+*", 303 + MENUITEM "Riduci &Albero\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Seleziona unit", 505 + } + + POPUP "&Visualizza" { + MENUITEM "A&lbero e Directory", 413 + MENUITEM "So&lo Albero", 411 + MENUITEM "&Solo Directory", 412 + MENUITEM SEPARATOR + MENUITEM "Di&vidi", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Nome", ID_VIEW_NAME + MENUITEM "&Mostra tutti i dettagli sui file",ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Mostra dettagli parziali...",ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Ordina per Nome", ID_VIEW_SORT_NAME + MENUITEM "&Ordina per Tipo", ID_VIEW_SORT_TYPE + MENUITEM "&Ordina per Dimensione", ID_VIEW_SORT_SIZE + MENUITEM "&Ordina per Data", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Ordina per &...", ID_VIEW_FILTER + } + + POPUP "&Opzioni" { + MENUITEM "&Confermazione...", 501 + MENUITEM "&Font...", ID_SELECT_FONT + MENUITEM "&Personalizza barra degli strumenti...", 512 + MENUITEM SEPARATOR + MENUITEM "&Barra degli strumenti", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Barra dei Drive", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Barra di stato", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "A& tutto schermo\tCtrl+Shift+S",ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Esegui minimizzato", 504 + MENUITEM "&Salva impostazioni all'uscita",511 + } + + + POPUP "&Sicurezza" { + MENUITEM "&Accessi...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Proprietario...", 607 + } + + POPUP "&Finestra" { + MENUITEM "Nuova &Finestra", ID_WINDOW_NEW + MENUITEM "Finestre a cascata\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Ordina &Orizontalmente", ID_WINDOW_TILE_HORZ + MENUITEM "Ordina &Verticlmente\tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Disponi automaticamente", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Disponi &Simboli", ID_WINDOW_ARRANGE + MENUITEM "&Aggiorna\tF5", ID_REFRESH + } + + POPUP "&Guida" { + MENUITEM "&Sommario della Guida\tF1", ID_HELP + MENUITEM "&Cerca nella Guida...\tF1", ID_HELP + MENUITEM "&Uso dell Guida\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Informazioni su Winefile...",ID_ABOUT +#ifdef __WINE__ + MENUITEM "Informazioni su &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Esegui" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Comando:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Come &Simbolo", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Annulla", 2, 158, 23, 47, 14 + PUSHBUTTON "&Aiuto", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select destination" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Statico", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Percorso:", -1, "Statico", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Annulla", 2, 158, 23, 47, 14 + PUSHBUTTON "&Naviga", 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Applica le impostazioni dei font" + IDS_FONT_SEL_ERROR "Si verificato un errore durante la selezione del nuovo font." +} diff --git a/rosapps/winefile/lang/nb-NO.rc b/rosapps/winefile/lang/nb-NO.rc new file mode 100644 index 00000000000..83836888881 --- /dev/null +++ b/rosapps/winefile/lang/nb-NO.rc @@ -0,0 +1,290 @@ +/* + * WineFile + * English Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL +#pragma code_page(850) + + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Fil" { + MENUITEM "&pne\tEnter", ID_ACTIVATE + MENUITEM "&Flytt...\tF7", ID_FILE_MOVE + MENUITEM "&Kopiere...\tF8", ID_FILE_COPY + MENUITEM "&I utklippstavle...\tF9", 118 + MENUITEM "&Slett\tDel", ID_FILE_DELETE + MENUITEM "Endre &navn...", 109 + MENUITEM "E&genskaper...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "k&omprimere...", 119 + MENUITEM "&dekomprimere ...", 120 + MENUITEM SEPARATOR + MENUITEM "&Kjr...", ID_EXECUTE + MENUITEM "&Skriv ut...", 102 + MENUITEM "Tilknyttet...", 103 + MENUITEM SEPARATOR + MENUITEM "Opp&rett mappe...", 111 + MENUITEM "S&k...", 104 + MENUITEM "&Velg Filer...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "A&vslutt\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "A&vslutt", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Kopiere disk...", 201 + MENUITEM "&Merke disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatere Disk...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Lag system Disk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Koble &til nettverk stasjon", ID_CONNECT_NETWORK_DRIVE + MENUITEM "Koble &fra nettverks stasjon", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Del som...", 254 + MENUITEM "&Fjern deling...", 255 + MENUITEM SEPARATOR + MENUITEM "&Velg stasjon...", 251 + } + + POPUP "&Mappe" { + MENUITEM "&Neste niv\t+", 301 + MENUITEM "Utvide &Tre\t*", 302 + MENUITEM "Utvide &alt\tStrg+*", 303 + MENUITEM "Kollaps &Tre\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Merker barn", 505 + } + + POPUP "&Vis" { + MENUITEM "T&re og kataloger", 413 + MENUITEM "Bare Tr&e ", 411 + MENUITEM "&Bare kataloger", 412 + MENUITEM SEPARATOR + MENUITEM "Sp&litt", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Navn", ID_VIEW_NAME + MENUITEM "&Alle fil detaljer", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&begrenset detaljer...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "Sorter etter &navn", ID_VIEW_SORT_NAME + MENUITEM "Sorter etter &type", ID_VIEW_SORT_TYPE + MENUITEM "Sorter etter &strrelse", ID_VIEW_SORT_SIZE + MENUITEM "Sorter etter &dato", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Filter etter &...", ID_VIEW_FILTER + } + + POPUP "&Innstillinger" { + MENUITEM "&bekreftelse...", 501 + MENUITEM "&Skrifttype ...", ID_SELECT_FONT + MENUITEM "Spesial verkty&linje...", 512 + MENUITEM SEPARATOR + MENUITEM "&Verktylinje", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Stasjonlinje", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "Status &linje", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "F&ull Skjerm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimalisere ved kjr", 504 + MENUITEM "&Lagre innstillinger ved avslutt", 511 + } + + + POPUP "&Sikkerhet" { + MENUITEM "&Adgang...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Eier...", 607 + } + + POPUP "&Vindu" { + MENUITEM "Ny &vindu", ID_WINDOW_NEW + MENUITEM "Som liste\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Sorter &Horisontalt", ID_WINDOW_TILE_HORZ + MENUITEM "Sorter &Vertikalt\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Ordne automatisk", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Ordne &Symboler", ID_WINDOW_ARRANGE + MENUITEM "&Oppdater\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Emner i hjelp\tF1", ID_HELP + MENUITEM "Hjelp &Sk...\tF1", ID_HELP + MENUITEM "&Bruke Hjelp\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Info om Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Info om &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Utfre" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Kommando:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Som &symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Avbryt", 2, 158, 23, 47, 14 + PUSHBUTTON "&Hjelp", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Velg destinasjon" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "statisk", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Mappe:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Avbryt", 2, 158, 23, 47, 14 + PUSHBUTTON "&Utforsk", 254, 158, 43, 47, 14 +} + +IDD_DIALOG_VIEW_TYPE DIALOG DISCARDABLE 15, 13, 161, 97 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Etter fil type" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Navn:",-1,7,8,22,10 + EDITTEXT IDC_VIEW_PATTERN,31,7,63,12,ES_AUTOHSCROLL + GROUPBOX "Fil type",-1,7,23,87,56 + CONTROL "&Mapper",IDC_VIEW_TYPE_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10 + CONTROL "&Programmer",IDC_VIEW_TYPE_PROGRAMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,43,70,10 + CONTROL "Doku&menter",IDC_VIEW_TYPE_DOCUMENTS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,54,70,10 + CONTROL "&Andre filer",IDC_VIEW_TYPE_OTHERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,65,70,10 + CONTROL "Vise skjulte/&System Filer",IDC_VIEW_TYPE_HIDDEN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,81,106,9 + DEFPUSHBUTTON "OK",IDOK,104,7,50,14 + PUSHBUTTON "Avbryt",IDCANCEL,104,24,50,14 +END + +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Egenskaper for %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,191,7,50,14 + PUSHBUTTON "Avbryt",IDCANCEL,191,29,50,14 + LTEXT "&Fil navn:",-1,7,7,59,9 + EDITTEXT IDC_STATIC_PROP_FILENAME,71,7,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Full &mappe:",-1,7,18,59,9 + EDITTEXT IDC_STATIC_PROP_PATH,71,18,120,9, ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Sist endret:",-1,7,29,59,9 + EDITTEXT IDC_STATIC_PROP_LASTCHANGE,71,29,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Versjon:",-1,7,40,59,9 + EDITTEXT IDC_STATIC_PROP_VERSION,71,40,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Ene&rett:",-1,7,51,59,9 + EDITTEXT IDC_STATIC_PROP_COPYRIGHT,71,51,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Strrelse:",-1,7,62,59,9 + EDITTEXT IDC_STATIC_PROP_SIZE,71,62,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + GROUPBOX "Attributter",-1,7,79,158,46 + CONTROL "&Bare lese",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,91,68,9 + CONTROL "S&kjult",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,91,68,9 + CONTROL "&Arkiv",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,68,9 + CONTROL "&System",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,101,68,9 + CONTROL "&komprimert",IDC_CHECK_COMPRESSED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + GROUPBOX "&Versjon Informasjon",-1,7,129,234,79 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL +END + + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "kjre skrift innstillinger" + IDS_FONT_SEL_ERROR "Feil mens valgt ny skrift." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Feil" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Skrivebord" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "ikke enda implementert" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine Fil" +} + +STRINGTABLE +{ + IDS_COL_NAME "Navn" + IDS_COL_SIZE "Strrelse" + IDS_COL_CDATE "CDate" + IDS_COL_ADATE "ADate" + IDS_COL_MDATE "MDate" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Lenker" + IDS_COL_ATTR "Attributter" + IDS_COL_SEC "Sikkerhet" + + IDS_FREE_SPACE_FMT "%s av %s fri" +} + +STRINGTABLE +{ +IDS_LICENSE_CAPTION, "LISENS" +IDS_LICENSE, +"This library is free software; you can redistribute it and/or \ +modify it under the terms of the GNU Lesser General Public \ +License as published by the Free Software Foundation; either \ +version 2.1 of the License, or (at your option) any later version.\n\ +This library is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details.\n\ +You should have received a copy of the GNU Lesser General Public \ +License along with this library; if not, write to the Free Software \ +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" + +IDS_WARRANTY_CAPTION, "INGEN GARANTI" +IDS_WARRANTY, +"This library is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details." +} diff --git a/rosapps/winefile/lang/nl-NL.rc b/rosapps/winefile/lang/nl-NL.rc new file mode 100644 index 00000000000..8bd6988156b --- /dev/null +++ b/rosapps/winefile/lang/nl-NL.rc @@ -0,0 +1,160 @@ +/* + * WineFile (Dutch resources) + * + * Copyright 2003 Hans Leidekker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_DUTCH, SUBLANG_DUTCH + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Bestand" { + MENUITEM "&Openen\tEnter", ID_ACTIVATE + MENUITEM "&Verplaatsen...\tF7", ID_FILE_MOVE + MENUITEM "&Kopiren...\tF8", ID_FILE_COPY + MENUITEM "Naar &klembord...\tF9", 118 + MENUITEM "Ver&wijderen\tDel", ID_FILE_DELETE + MENUITEM "&Naam wijzigen...", 109 + MENUITEM "&Eigenschappen...\tAlt+Enter",ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Comprimeren...", 119 + MENUITEM "&Dec&omprimeren...", 120 + MENUITEM SEPARATOR + MENUITEM "&Starten...", ID_EXECUTE + MENUITEM "Af&drukken...", 102 + MENUITEM "Koppelen...", 103 + MENUITEM SEPARATOR + MENUITEM "Nieuwe &map...", 111 + MENUITEM "&Zoeken...", 104 + MENUITEM "Bestanden &selecteren...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "A&fsluiten\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "A&fsluiten", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "Disk &kopiren...", 201 + MENUITEM "Disklabel maken...", 202 + MENUITEM SEPARATOR + MENUITEM "Disk &formatteren...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "Systeemdisk maken...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Verbinding &maken met netwerkchijf",ID_CONNECT_NETWORK_DRIVE + MENUITEM "Verbinding &verbreken met netwerkschijf",ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Schijf &delen...", 254 + MENUITEM "Delen &ongedaan maken...", 255 + MENUITEM SEPARATOR + MENUITEM "Schijf &selecteren...", 251 + } + + POPUP "&Mappen" { + MENUITEM "&Volgende niveau\t+", 301 + MENUITEM "&Uitklappen\t*", 302 + MENUITEM "&Alles uitklappen\tCtrl+*", 303 + MENUITEM "&Inklappen\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Markeer mappen", 505 + } + + POPUP "&Beeld" { + MENUITEM "&Hierarchie en mapinhoud", 413 + MENUITEM "&Alleen hierarchie", 411 + MENUITEM "Alleen &mapinhoud", 412 + MENUITEM SEPARATOR + MENUITEM "Sp&litsen", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Naam", ID_VIEW_NAME + MENUITEM "&Alle details", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Gedeeltelijke details...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "Sorteer op &naam", ID_VIEW_SORT_NAME + MENUITEM "Sorteer op &type", ID_VIEW_SORT_TYPE + MENUITEM "Sorteer op &grootte", ID_VIEW_SORT_SIZE + MENUITEM "Sorteer op &datum", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Sorteer op &...", ID_VIEW_FILTER + } + + POPUP "&Opties" { + MENUITEM "&Bevestiging...", 501 + MENUITEM "&Lettertype...", ID_SELECT_FONT + MENUITEM "Gereedschappenbalk &aanpassen...", 512 + MENUITEM SEPARATOR + MENUITEM "&Gereedschappenbalk", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Schijvenbalk", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "S&tatusbalk", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "&Volledig scherm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "Ge&minimaliseerd starten", 504 + MENUITEM "&Instellingen opslaan bij afsluiten", 511 + } + + + POPUP "&Beveiliging" { + MENUITEM "&Toegang...", 605 + MENUITEM "&Loggen...", 606 + MENUITEM "&Eigenaar...", 607 + } + + POPUP "&Venster" { + MENUITEM "Nieuw &venster", ID_WINDOW_NEW + MENUITEM "Trapsgewijs\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "&Boven elkaar", ID_WINDOW_TILE_HORZ + MENUITEM "&Naast elkaar\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Automatisch schikken", ID_WINDOW_AUTOSORT +#endif + MENUITEM "&Pictogrammen schikken", ID_WINDOW_ARRANGE + MENUITEM "&Vernieuwen\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Help-onderwerpen\tF1", ID_HELP + MENUITEM "&Zoeken...\tF1", ID_HELP + MENUITEM "&Instructie\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Over Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Over &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Uitvoeren" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Opdracht:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Als &pictogram", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Annuleren", 2, 158, 23, 47, 14 + PUSHBUTTON "&Help", 254, 158, 43, 47, 14 +} diff --git a/rosapps/winefile/lang/pl-PL.rc b/rosapps/winefile/lang/pl-PL.rc new file mode 100644 index 00000000000..34fe0165b3e --- /dev/null +++ b/rosapps/winefile/lang/pl-PL.rc @@ -0,0 +1,183 @@ +/* + * WineFile + * Polish Language Support + * + * Copyright 2000 Martin Fuchs + * Copyright 2002 Steven Edwards + * Copyright 2002 Alexandre Julliard + * Copyright 2004 Piotr Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Plik" { + MENUITEM "&Otwrz\tEnter", ID_ACTIVATE + MENUITEM "&Przenie...\tF7", ID_FILE_MOVE + MENUITEM "&Kopiuj...\tF8", ID_FILE_COPY + MENUITEM "W s&chowku...\tF9", 118 + MENUITEM "&Usu\tDel", ID_FILE_DELETE + MENUITEM "&Zmie nazw...", 109 + MENUITEM "Ustawie&nia...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Kompresja...", 119 + MENUITEM "&Dekompresja...", 120 + MENUITEM SEPARATOR + MENUITEM "&Uruchom...", ID_EXECUTE + MENUITEM "&Drukuj...", 102 + MENUITEM "Skojarz...", 103 + MENUITEM SEPARATOR + MENUITEM "U&twrz folder...", 111 + MENUITEM "&Szukaj...", 104 + MENUITEM "&Zaznacz pliki...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "&Wyjcie\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "&Wyjcie", ID_FILE_EXIT +#endif + } + + POPUP "&Dysk" { + MENUITEM "&Kopiuj dusk...", 201 + MENUITEM "&Etykieta dysku...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatuj dysk...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Stwrz dysk systemowy...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "&Podcz Dysk Sieciowy", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Odcz Dysk Sieciowy", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Udostpnij jako...", 254 + MENUITEM "&Nie udostpniaj...", 255 + MENUITEM SEPARATOR + MENUITEM "Wybr &dysku...", 251 + } + + POPUP "&Katalogi" { + MENUITEM "&Nastpny poziom\t+", 301 + MENUITEM "&Rozwi drzewo\t*", 302 + MENUITEM "Rozwi &wszystko\tStrg+*", 303 + MENUITEM "&Zwi drzewo\t-", 304 + MENUITEM SEPARATOR + MENUITEM "Zaznacz &podkatalogi", 505 + } + + POPUP "&Widok" { + MENUITEM "&Drzewo i katalogi", 413 + MENUITEM "D&rzewo", 411 + MENUITEM "&Katalogi", 412 + MENUITEM SEPARATOR + MENUITEM "&Pocz", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Nazwa", ID_VIEW_NAME + MENUITEM "&Wszystkie atrybuty pliku", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "Wybrane &atrybuty pliku...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "P&osortuj alfabetycznie", 404 + MENUITEM "Posortuj po &typie", 405 + MENUITEM "Rozmie &po wielkoci", 406 + MENUITEM "&Sortuj po dacie", 407 + MENUITEM SEPARATOR + MENUITEM "Sortuj po &...", ID_VIEW_FILTER + } + + POPUP "&Opcje" { + MENUITEM "&Potwierdzenie...", 501 + MENUITEM "&Czcionka...", ID_SELECT_FONT + MENUITEM "&Ustawienia paska narzdzi...", 512 + MENUITEM SEPARATOR + MENUITEM "Pasek &narzdzi", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "Pasek &dyskw", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "Pasek &statusu", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "Peny &ekran\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Zminimalizuj przy starcie", 504 + MENUITEM "Z&apisz ustawienia przed zakoczeniem",511 + } + + + POPUP "&Bezpieczestwo" { + MENUITEM "&Dostp...", 605 + MENUITEM "&Logowanie...", 606 + MENUITEM "&Waciciel...", 607 + } + + POPUP "&Okno" { + MENUITEM "&Nowe okno", ID_WINDOW_NEW + MENUITEM "&Kaskadujco\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "&Tytu pionowo", ID_WINDOW_TILE_HORZ + MENUITEM "Tytu &poziomo\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Rozmie automatycznie", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Rozmie &symbole", ID_WINDOW_ARRANGE + MENUITEM "&Odwierz\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Tematu pomocy\tF1", ID_HELP + MENUITEM "&Szukaj...", ID_HELP + MENUITEM "&Uywanie pomocy", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "W&ine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Uruchom" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Polecenie:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Jako &symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Anuluj", 2, 158, 23, 47, 14 + PUSHBUTTON "&Pomoc", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Wybr celu" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&cieka:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Anuluj", 2, 158, 23, 47, 14 + PUSHBUTTON "&Przegldaj", 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Wprowadzanie ustawie czcionki" + IDS_FONT_SEL_ERROR "Bd przy wybieraniu czcionki" +} diff --git a/rosapps/winefile/lang/pt-PT.rc b/rosapps/winefile/lang/pt-PT.rc new file mode 100644 index 00000000000..f4f0f55c733 --- /dev/null +++ b/rosapps/winefile/lang/pt-PT.rc @@ -0,0 +1,335 @@ +/* + * WineFile + * Portuguese Language Support + * + * Copyright 2003 Marcelo Duarte + * Copyright 2004 Amrico Jos Melo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +/* Menu */ + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Arquivo" { + MENUITEM "A&brir\tEnter", ID_ACTIVATE + MENUITEM "&Mover...\tF7", ID_FILE_MOVE + MENUITEM "&Copiar...\tF8", ID_FILE_COPY + MENUITEM "&In Clipboard...\tF9", 118 + MENUITEM "E&xcluir\tDel", ID_FILE_DELETE + MENUITEM "Re&nomear...", 109 + MENUITEM "&Propriedades...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "C&omprimir...", 119 + MENUITEM "Descomprimir...", 120 + MENUITEM SEPARATOR + MENUITEM "Execu&tar...", ID_EXECUTE + MENUITEM "&Imprimir...", 102 + MENUITEM "A&ssociar...", 103 + MENUITEM SEPARATOR + MENUITEM "Cri&ar pasta...", 111 + MENUITEM "P&esquisar...", 104 + MENUITEM "Selecionar arqui&vos...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "Sai&r\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "Sai&r", ID_FILE_EXIT +#endif + } + + POPUP "&Disco" { + MENUITEM "&Copiar disco...", 201 + MENUITEM "&Nomear disco...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatar disco...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Gerar disco de sistema...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Conecta&r unidade de rede", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Desconectar unidade de rede",ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "C&ompartilhar como...", 254 + MENUITEM "&Remover compartilhamento...",255 + MENUITEM SEPARATOR + MENUITEM "Selecionar &unidade...", 251 + } + + POPUP "&rvore" { + MENUITEM "&Prximo nvel\t+", 301 + MENUITEM "Expandi&r pasta\t*", 302 + MENUITEM "Expandir &tudo\tStrg+*", 303 + MENUITEM "Recolher p&asta\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Indicar subnveis", 505 + } + + POPUP "&Exibir" { + MENUITEM "&rvore e pasta", 413 + MENUITEM "S&omente rvore", 411 + MENUITEM "So&mente pasta", 412 + MENUITEM SEPARATOR + MENUITEM "&Dividir", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Nome", ID_VIEW_NAME + MENUITEM "&Todos os delalhes", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "D&etalhes parciais...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Classificar por nome", ID_VIEW_SORT_NAME + MENUITEM "C&lassificar por tipo", ID_VIEW_SORT_TYPE + MENUITEM "Cl&assificar por tamanho", ID_VIEW_SORT_SIZE + MENUITEM "Cla&ssificar por &data", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Classificar &por...", ID_VIEW_FILTER + } + + POPUP "&Opes" { + MENUITEM "&Confirmao...", 501 + MENUITEM "&Fonte...", ID_SELECT_FONT + MENUITEM "&Personalizar barra de ferramentas...", 512 + MENUITEM SEPARATOR + MENUITEM "Barra d&e ferramentas", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Barra de unidades", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "B&arra de &status", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "Tela Cheia\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimizar durante o uso", 504 + MENUITEM "&Salvar configuraes ao sair",511 + } + + + POPUP "&Segurana" { + MENUITEM "&Acesso...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Owner...", 607 + } + + POPUP "&Janela" { + MENUITEM "&Nova janela", ID_WINDOW_NEW + MENUITEM "&Em cascata\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Lado a lado &horizontalmente",ID_WINDOW_TILE_HORZ + MENUITEM "Lado a lado &verticalmente\tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Organizar automaticamente", ID_WINDOW_AUTOSORT +#endif + MENUITEM "&Organizar cones", ID_WINDOW_ARRANGE + MENUITEM "&Atualizar\tF5", ID_REFRESH + } + + POPUP "Aj&uda" { + MENUITEM "&Tpicos da ajuda\tF1", ID_HELP + MENUITEM "Pesquisar...", ID_HELP + MENUITEM "&Usando a ajuda", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Sobre o Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Sobre o &Wine...", ID_ABOUT_WINE +#endif + } +} + + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Ficheiro" { + MENUITEM "A&brir\tEnter", ID_ACTIVATE + MENUITEM "&Mover...\tF7", ID_FILE_MOVE + MENUITEM "&Copiar...\tF8", ID_FILE_COPY + MENUITEM "&Na Area de Transferencia...\tF9", 118 + MENUITEM "E&xcluir\tDel", ID_FILE_DELETE + MENUITEM "Re&nomear...", 109 + MENUITEM "&Propriedades...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "C&omprimir...", 119 + MENUITEM "&Descomprimir...", 120 + MENUITEM SEPARATOR + MENUITEM "Execu&tar...", ID_EXECUTE + MENUITEM "&Imprimir...", 102 + MENUITEM "A&ssociar...", 103 + MENUITEM SEPARATOR + MENUITEM "Cri&ar pasta...", 111 + MENUITEM "P&esquisar...", 104 + MENUITEM "Selecionar fichei&ros...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "Sai&r\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "Sai&r", ID_FILE_EXIT +#endif + } + + POPUP "&Disco" { + MENUITEM "&Copiar disco...", 201 + MENUITEM "&Nomear disco...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatar disco...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Gerar disco de sistema...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Conecta&r unidade de rede", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Desconectar unidade de rede",ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "&Partilhar como...", 254 + MENUITEM "&Remover partilha...", 255 + MENUITEM SEPARATOR + MENUITEM "Seleccionar &unidade...", 251 + } + + POPUP "&rvore" { + MENUITEM "&Prximo nvel\t+", 301 + MENUITEM "Expandi&r pasta\t*", 302 + MENUITEM "Expandir &tudo\tStrg+*", 303 + MENUITEM "Recolher p&asta\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Indicar subnveis", 505 + } + + POPUP "&Exibir" { + MENUITEM "&rvore e pasta", 413 + MENUITEM "S&omente rvore", 411 + MENUITEM "So&mente pasta", 412 + MENUITEM SEPARATOR + MENUITEM "&Dividir", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Nome", ID_VIEW_NAME + MENUITEM "&Todos os delalhes", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "D&etalhes parciais...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Classificar por nome", ID_VIEW_SORT_NAME + MENUITEM "C&lassificar por tipo", ID_VIEW_SORT_TYPE + MENUITEM "Cl&assificar por tamanho", ID_VIEW_SORT_SIZE + MENUITEM "Cla&ssificar por &data", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Classificar &por...", ID_VIEW_FILTER + } + + POPUP "&Opes" { + MENUITEM "&Confirmao...", 501 + MENUITEM "&Fonte...", ID_SELECT_FONT + MENUITEM "&Personalizar barra de ferramentas...", 512 + MENUITEM SEPARATOR + MENUITEM "Barra d&e ferramentas", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Barra de unidades", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "B&arra de e&stado", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "Ecr Complecto\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimizar durante o uso", 504 + MENUITEM "&Gravar configuraes ao sair",511 + } + + + POPUP "&Segurana" { + MENUITEM "&Acesso...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Dono...", 607 + } + + POPUP "&Janela" { + MENUITEM "&Nova janela", ID_WINDOW_NEW + MENUITEM "&Em cascata\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Lado a lado &horizontalmente",ID_WINDOW_TILE_HORZ + MENUITEM "Lado a lado &verticalmente\tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Organizar automaticamente", ID_WINDOW_AUTOSORT +#endif + MENUITEM "&Organizar cones", ID_WINDOW_ARRANGE + MENUITEM "&Actualizar\tF5", ID_REFRESH + } + + POPUP "Aj&uda" { + MENUITEM "&Tpicos da ajuda\tF1", ID_HELP + MENUITEM "Pesquisar...", ID_HELP + MENUITEM "&Usando a ajuda", ID_HELP_USING + MENUITEM SEPARATOR +#ifdef __WINE__ + MENUITEM "Acerca do &Wine...", ID_ABOUT_WINE +#endif + } +} + + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Executar" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Comando:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "&Minimizado", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancelar", 2, 158, 23, 47, 14 + PUSHBUTTON "&Ajuda", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Selecionar destino" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Caminho:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancelar", 2, 158, 23, 47, 14 + PUSHBUTTON "&Procurar", 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Aplicando configuraes de fonte" + IDS_FONT_SEL_ERROR "Erro enquanto seleciona nova fonte." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Erro" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "rea de trabalho" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Ainda no implementado" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Nome" + IDS_COL_SIZE "Tamanho" + IDS_COL_CDATE "CData" + IDS_COL_ADATE "AData" + IDS_COL_MDATE "MData" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Ligaes" + IDS_COL_ATTR "Atributos" + IDS_COL_SEC "Segurana" +} diff --git a/rosapps/winefile/lang/ru-RU.rc b/rosapps/winefile/lang/ru-RU.rc new file mode 100644 index 00000000000..ee458b12439 --- /dev/null +++ b/rosapps/winefile/lang/ru-RU.rc @@ -0,0 +1,288 @@ +/* + * WineFile (Russian resources) + * + * Copyright 2003 Igor Stepin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +#pragma code_page(1251) + + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&" { + MENUITEM "&\tEnter", ID_ACTIVATE + MENUITEM "&...\tF7", ID_FILE_MOVE + MENUITEM "&...\tF8", ID_FILE_COPY + MENUITEM "& ...\tF9", 118 + MENUITEM "&\tDel", ID_FILE_DELETE + MENUITEM "...", 109 + MENUITEM "...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "...", 119 + MENUITEM "...", 120 + MENUITEM SEPARATOR + MENUITEM "&...", ID_EXECUTE + MENUITEM "&...", 102 + MENUITEM "...", 103 + MENUITEM SEPARATOR + MENUITEM " ...", 111 + MENUITEM "...", 104 + MENUITEM "& ...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "", ID_FILE_EXIT +#endif + } + + POPUP "&" { + MENUITEM "& ...", 201 + MENUITEM "& ...", 202 + MENUITEM SEPARATOR + MENUITEM "&...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "& ...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "& ", ID_CONNECT_NETWORK_DRIVE + MENUITEM "& ", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM " & ...", 254 + MENUITEM "& ...", 255 + MENUITEM SEPARATOR + MENUITEM "& ...", 251 + } + + POPUP "&" { + MENUITEM "& \t+", 301 + MENUITEM "& \t*", 302 + MENUITEM " &\tStrg+*", 303 + MENUITEM "& \t-", 304 + MENUITEM SEPARATOR + MENUITEM "& ", 505 + } + + POPUP "&" { + MENUITEM " & ", 413 + MENUITEM " &", 411 + MENUITEM " &", 412 + MENUITEM SEPARATOR + MENUITEM "&", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&", ID_VIEW_NAME + MENUITEM "& ", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "& ...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "& ", ID_VIEW_SORT_NAME + MENUITEM " &", ID_VIEW_SORT_TYPE + MENUITEM " &", ID_VIEW_SORT_SIZE + MENUITEM " &", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM " &...", ID_VIEW_FILTER + } + + POPUP "&" { + MENUITEM "&...", 501 + MENUITEM "&...", ID_SELECT_FONT + MENUITEM "& ...", 512 + MENUITEM SEPARATOR + MENUITEM "& ", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM " &", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "& ", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "& \tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "& ", 504 + MENUITEM "& ",511 + } + + + POPUP "&" { + MENUITEM "&...", 605 + MENUITEM "&...", 606 + MENUITEM "&...", 607 + } + + POPUP "&" { + MENUITEM " &", ID_WINDOW_NEW + MENUITEM " &\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM " & ", ID_WINDOW_TILE_HORZ + MENUITEM " & \tCtrl+F4",ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM " &", ID_WINDOW_AUTOSORT +#endif + MENUITEM "&", ID_WINDOW_ARRANGE + MENUITEM "&\tF5", ID_REFRESH + } + + POPUP "&" { + MENUITEM "&\tF1", ID_HELP + MENUITEM "&...\tF1", ID_HELP + MENUITEM "& \tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "& Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM " &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL " &", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "", 2, 158, 23, 47, 14 + PUSHBUTTON "&", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select destination" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Path:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancel", 2, 158, 23, 47, 14 + PUSHBUTTON "&Browse", 254, 158, 43, 47, 14 +} + +IDD_DIALOG_VIEW_TYPE DIALOG DISCARDABLE 15, 13, 161, 97 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "By File Type" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Name:",-1,7,8,22,10 + EDITTEXT IDC_VIEW_PATTERN,31,7,63,12,ES_AUTOHSCROLL + GROUPBOX "File Type",-1,7,23,87,56 + CONTROL "&Directories",IDC_VIEW_TYPE_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,32,70,10 + CONTROL "&Programs",IDC_VIEW_TYPE_PROGRAMS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,43,70,10 + CONTROL "Docu&ments",IDC_VIEW_TYPE_DOCUMENTS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,54,70,10 + CONTROL "&Other files",IDC_VIEW_TYPE_OTHERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,65,70,10 + CONTROL "Show Hidden/&System Files",IDC_VIEW_TYPE_HIDDEN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,81,106,9 + DEFPUSHBUTTON "OK",IDOK,104,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,104,24,50,14 +END + +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Properties for %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,191,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,191,29,50,14 + LTEXT "&File Name:",-1,7,7,59,9 + EDITTEXT IDC_STATIC_PROP_FILENAME,71,7,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Full &Path:",-1,7,18,59,9 + EDITTEXT IDC_STATIC_PROP_PATH,71,18,120,9, ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Last Change:",-1,7,29,59,9 + EDITTEXT IDC_STATIC_PROP_LASTCHANGE,71,29,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Version:",-1,7,40,59,9 + EDITTEXT IDC_STATIC_PROP_VERSION,71,40,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Cop&yright:",-1,7,51,59,9 + EDITTEXT IDC_STATIC_PROP_COPYRIGHT,71,51,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + LTEXT "Size:",-1,7,62,59,9 + EDITTEXT IDC_STATIC_PROP_SIZE,71,62,120,9,ES_READONLY | NOT WS_BORDER | WS_TABSTOP + GROUPBOX "Attributes",-1,7,79,158,46 + CONTROL "&Read Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,91,68,9 + CONTROL "H&idden",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,91,68,9 + CONTROL "&Archive",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,68,9 + CONTROL "&System",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,101,68,9 + CONTROL "&Compressed",IDC_CHECK_COMPRESSED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + GROUPBOX "&Version Information",-1,7,129,234,79 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL +END + + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Applying font settings" + IDS_FONT_SEL_ERROR "Error while selecting new font." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Error" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Desktop" + IDS_SHELL "Shell" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Not yet implemented" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Name" + IDS_COL_SIZE "Size" + IDS_COL_CDATE "CDate" + IDS_COL_ADATE "ADate" + IDS_COL_MDATE "MDate" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Links" + IDS_COL_ATTR "Attributes" + IDS_COL_SEC "Security" + + IDS_FREE_SPACE_FMT "%s of %s free" +} + +STRINGTABLE +{ +IDS_LICENSE_CAPTION, "LICENSE" +IDS_LICENSE, +"This library is free software; you can redistribute it and/or \ +modify it under the terms of the GNU Lesser General Public \ +License as published by the Free Software Foundation; either \ +version 2.1 of the License, or (at your option) any later version.\n\ +This library is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details.\n\ +You should have received a copy of the GNU Lesser General Public \ +License along with this library; if not, write to the Free Software \ +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" + +IDS_WARRANTY_CAPTION, "NO WARRANTY" +IDS_WARRANTY, +"This library is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details." +} diff --git a/rosapps/winefile/lang/sl-SI.rc b/rosapps/winefile/lang/sl-SI.rc new file mode 100644 index 00000000000..3f68186ad7c --- /dev/null +++ b/rosapps/winefile/lang/sl-SI.rc @@ -0,0 +1,161 @@ +/* + * WineFile + * Slovenian Language Support + * + * Copyright 2003 Rok Mandeljc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&File" { + MENUITEM "&Open\tEnter", ID_ACTIVATE + MENUITEM "&Move...\tF7", ID_FILE_MOVE + MENUITEM "&Copy...\tF8", ID_FILE_COPY + MENUITEM "&In Clipboard...\tF9", 118 + MENUITEM "&Delete\tDel", ID_FILE_DELETE + MENUITEM "Re&name...", 109 + MENUITEM "Propert&ies...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "C&ompress...", 119 + MENUITEM "Dec&ompress...", 120 + MENUITEM SEPARATOR + MENUITEM "&Run...", ID_EXECUTE + MENUITEM "&Print...", 102 + MENUITEM "Associate...", 103 + MENUITEM SEPARATOR + MENUITEM "Cr&eate Directory...", 111 + MENUITEM "Searc&h...", 104 + MENUITEM "&Select Files...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "E&xit\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "E&xit", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Copy Disk...", 201 + MENUITEM "&Label Disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Format Disk...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Make System Disk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Connect &Network Drive", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Disconnect Network Drive", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Share as...", 254 + MENUITEM "&Remove Share...", 255 + MENUITEM SEPARATOR + MENUITEM "&Select Drive...", 251 + } + + POPUP "&Directories" { + MENUITEM "&Next Level\t+", 301 + MENUITEM "Expand &Tree\t*", 302 + MENUITEM "Expand &all\tStrg+*", 303 + MENUITEM "Collapse &Tree\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Mark Childs", 505 + } + + POPUP "&View" { + MENUITEM "T&ree and Directory", 413 + MENUITEM "Tr&ee Only", 411 + MENUITEM "Directory &Only", 412 + MENUITEM SEPARATOR + MENUITEM "Sp&lit", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Name", ID_VIEW_NAME + MENUITEM "&All File Details", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Partial Details...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Sort by Name", ID_VIEW_SORT_NAME + MENUITEM "Sort &by Type", ID_VIEW_SORT_TYPE + MENUITEM "Sort by Si&ze", ID_VIEW_SORT_SIZE + MENUITEM "Sort by &Date", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Filter by &...", ID_VIEW_FILTER + } + + POPUP "&Options" { + MENUITEM "&Confirmation...", 501 + MENUITEM "&Font...", ID_SELECT_FONT + MENUITEM "Customize Tool&bar...", 512 + MENUITEM SEPARATOR + MENUITEM "&Toolbar", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Status Bar", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minize on run", 504 + MENUITEM "&Save settings on exit", 511 + } + + + POPUP "&Security" { + MENUITEM "&Access...", 605 + MENUITEM "&Logging...", 606 + MENUITEM "&Owner...", 607 + } + + POPUP "&Window" { + MENUITEM "New &Window", ID_WINDOW_NEW + MENUITEM "Cascading\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ + MENUITEM "Tile &Vertically\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Arrange Automatically", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Arrange &Symbols", ID_WINDOW_ARRANGE + MENUITEM "&Refresh\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Help Topics\tF1", ID_HELP + MENUITEM "Help &Search...\tF1", ID_HELP + MENUITEM "&Using Help\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "&Info about Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Info about &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Execute" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Command:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "As &Symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Cancel", 2, 158, 23, 47, 14 + PUSHBUTTON "&Help", 254, 158, 43, 47, 14 +} diff --git a/rosapps/winefile/lang/sv-SE.rc b/rosapps/winefile/lang/sv-SE.rc new file mode 100644 index 00000000000..183f5edf1a0 --- /dev/null +++ b/rosapps/winefile/lang/sv-SE.rc @@ -0,0 +1,209 @@ +/* + * WineFile + * Swedish Language Support + * + * Copyright 2005 David Nordenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH +#pragma code_page(1252) + + +/* Menu */ + + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "&Arkiv" { + MENUITEM "&ppna\tEnter", ID_ACTIVATE + MENUITEM "&Flytta...\tF7", ID_FILE_MOVE + MENUITEM "&Kopiera...\tF8", ID_FILE_COPY + MENUITEM "&I urklipp...\tF9", 118 + MENUITEM "&Ta bort\tDel", ID_FILE_DELETE + MENUITEM "&Byt namn...", 109 + MENUITEM "&Egenskaper...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "&Komprimera...", 119 + MENUITEM "Packa &upp...", 120 + MENUITEM SEPARATOR + MENUITEM "&Kr...", ID_EXECUTE + MENUITEM "&Skriv ut...", 102 + MENUITEM "Associera...", 103 + MENUITEM SEPARATOR + MENUITEM "Skapa mapp...", 111 + MENUITEM "&Sk...", 104 + MENUITEM "&Vlj filer...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "&Avsluta\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "&Avsluta", ID_FILE_EXIT +#endif + } + + POPUP "&Disk" { + MENUITEM "&Kopiera disk...", 201 + MENUITEM "&Namnge disk...", 202 + MENUITEM SEPARATOR + MENUITEM "&Formatera disk...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "&Skapa systemdisk...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "Anslut &Ntverksenhet", ID_CONNECT_NETWORK_DRIVE + MENUITEM "&Koppla ifrn Ntverksenhet", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Dela ut...", 254 + MENUITEM "&Ta bort utdelning...", 255 + MENUITEM SEPARATOR + MENUITEM "&Vlj enhet...", 251 + } + + POPUP "&Trd" { + MENUITEM "&Nsta niv\t+", 301 + MENUITEM "Utka &trd\t*", 302 + MENUITEM "Utka &alla\tCtrl+*", 303 + MENUITEM "Kollapsa &trd\t-", 304 + MENUITEM SEPARATOR + MENUITEM "&Markera undermappar", 505 + } + + POPUP "&Visa" { + MENUITEM "&Trd och mapp", 413 + MENUITEM "Bara tr&d", 411 + MENUITEM "Bara &mapp", 412 + MENUITEM SEPARATOR + MENUITEM "De&la", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Namn", ID_VIEW_NAME + MENUITEM "&Alla Fildetaljer", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "&Vissa detaljer...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "&Sortera efter namn", ID_VIEW_SORT_NAME + MENUITEM "Sortera efter t&yp", ID_VIEW_SORT_TYPE + MENUITEM "Sortera efter st&orlek", ID_VIEW_SORT_SIZE + MENUITEM "Sortera efter &datum", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "Sortera efter &...", ID_VIEW_FILTER + } + + POPUP "&Instllningar" { + MENUITEM "&Bekrftelse...", 501 + MENUITEM "&Teckensnitt...", ID_SELECT_FONT + MENUITEM "&Konfigurera verktygsflt...", 512 + MENUITEM SEPARATOR + MENUITEM "&Verktygsflt", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "&Enhetsflt", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "St&atusflt", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "F&ullskrm\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimera vid krning", 504 + MENUITEM "&Spara ndringar vid stngning", 511 + } + + POPUP "&Skerhet" { + MENUITEM "&tkomst...", 605 + MENUITEM "&Loggning...", 606 + MENUITEM "&gare...", 607 + } + + POPUP "&Fnster" { + MENUITEM "Nytt &fnster", ID_WINDOW_NEW + MENUITEM "verlappande\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "Ordna &horizontellt", ID_WINDOW_TILE_HORZ + MENUITEM "Ordna &vertikalt\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Ordna automatiskt", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Ordna &symboler", ID_WINDOW_ARRANGE + MENUITEM "&Uppdatera\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "&Hjlpavsnitt\tF1", ID_HELP + MENUITEM "Hjlp &sk...\tF1", ID_HELP + MENUITEM "&Anvnda hjlpen\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "Information om &Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM "Info about &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Kr" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Kommando:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Som &symbol", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Avbryt", 2, 158, 23, 47, 14 + PUSHBUTTON "&Hjlp", 254, 158, 43, 47, 14 +} + +IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Vlj ml" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&Skvg:", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", 1, 158, 6, 47, 14 + PUSHBUTTON "Avbryt", 2, 158, 23, 47, 14 + PUSHBUTTON "&Blddra", 254, 158, 43, 47, 14 +} + +STRINGTABLE +{ + IDS_FONT_SEL_DLG_NAME "Verkstll teckensnittsinstllningar" + IDS_FONT_SEL_ERROR "Ett fel uppstog nr ett nytt teckensnitt valdes." +} + +STRINGTABLE +{ + IDS_WINEFILE "Winefile" + IDS_ERROR "Fel" + IDS_ROOT_FS "root fs" + IDS_UNIXFS "unixfs" + IDS_DESKTOP "Skrivbord" + IDS_SHELL "Skal" + IDS_TITLEFMT "%s - %s" + IDS_NO_IMPL "Ej implementerat nnu" + IDS_WINE "WINE" + IDS_WINE_FILE "Wine File" +} + +STRINGTABLE +{ + IDS_COL_NAME "Namn" + IDS_COL_SIZE "Storlek" + IDS_COL_CDATE "CDatum" + IDS_COL_ADATE "ADatum" + IDS_COL_MDATE "MDatum" + IDS_COL_IDX "Index/Inode" + IDS_COL_LINKS "Lnkar" + IDS_COL_ATTR "Attribut" + IDS_COL_SEC "Skerhet" +} diff --git a/rosapps/winefile/lang/zh-CN.rc b/rosapps/winefile/lang/zh-CN.rc new file mode 100644 index 00000000000..d68cd5e101b --- /dev/null +++ b/rosapps/winefile/lang/zh-CN.rc @@ -0,0 +1,161 @@ +/* + * WineFile + * Simplified Chinese Language Support + * + * Copyright 2002 liuspider + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +/* Menu */ + +IDM_WINEFILE MENU FIXED IMPURE +{ + POPUP "ļ&F" { + MENUITEM "򿪣&O\tEnter", ID_ACTIVATE + MENUITEM "ƶ&M...\tF7", ID_FILE_MOVE + MENUITEM "ƣ&C...\tF8", ID_FILE_COPY + MENUITEM "λڼ壨&I...\tF9", 118 + MENUITEM "ɾ&D\tDel", ID_FILE_DELETE + MENUITEM "&N...", 109 + MENUITEM "ԣ&I...\tAlt+Enter", ID_EDIT_PROPERTIES + MENUITEM SEPARATOR + MENUITEM "ѹ&O...", 119 + MENUITEM "ѹ&O...", 120 + MENUITEM SEPARATOR + MENUITEM "У&R...", ID_EXECUTE + MENUITEM "ӡ&P...", 102 + MENUITEM "ļ...", 103 + MENUITEM SEPARATOR + MENUITEM "Ŀ¼&E...", 111 + MENUITEM "ң&H...", 104 + MENUITEM "ѡļ&S...", 116 + MENUITEM SEPARATOR +#ifndef _NO_EXTENSIONS + MENUITEM "˳&X\tAlt+X", ID_FILE_EXIT +#else + MENUITEM "˳&X", ID_FILE_EXIT +#endif + } + + POPUP "̣&D" { + MENUITEM "ƣ&C...", 201 + MENUITEM "&L...", 202 + MENUITEM SEPARATOR + MENUITEM "ʽ&...", ID_FORMAT_DISK +#ifdef _WIN95 + MENUITEM "ϵͳ̣&M...", -1 /*TODO*/ +#endif + MENUITEM SEPARATOR + MENUITEM "&N", ID_CONNECT_NETWORK_DRIVE + MENUITEM "Ͽӣ&D", ID_DISCONNECT_NETWORK_DRIVE + MENUITEM SEPARATOR + MENUITEM "Ϊ...", 254 + MENUITEM "ɾ&R...", 255 + MENUITEM SEPARATOR + MENUITEM "ѡ&S...", 251 + } + + POPUP "Ŀ¼&D" { + MENUITEM "һ㣨&N\t+", 301 + MENUITEM "չ&T\t*", 302 + MENUITEM "ȫչ&A\tStrg+*", 303 + MENUITEM "۵&R\t-", 304 + MENUITEM SEPARATOR + MENUITEM "Ŀ¼&M", 505 + } + + POPUP "ͼ&V" { + MENUITEM "Ŀ¼ݣ&R", 413 + MENUITEM "ʾĿ¼&E", 411 + MENUITEM "ʾĿ¼ݣ&O", 412 + MENUITEM SEPARATOR + MENUITEM "ָ&L", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "ļ&N", ID_VIEW_NAME + MENUITEM "ļϤб&A", ID_VIEW_ALL_ATTRIBUTES, CHECKED + MENUITEM "ԣ&P...", ID_VIEW_SELECTED_ATTRIBUTES + MENUITEM SEPARATOR + MENUITEM "ļ&S", ID_VIEW_SORT_NAME + MENUITEM "&B", ID_VIEW_SORT_TYPE + MENUITEM "С&Z", ID_VIEW_SORT_SIZE + MENUITEM "&D", ID_VIEW_SORT_DATE + MENUITEM SEPARATOR + MENUITEM "...", ID_VIEW_FILTER + } + + POPUP "ѡ&O" { + MENUITEM "ȷʽ&C...", 501 + MENUITEM "壨&F...", ID_SELECT_FONT + MENUITEM "ƹ&B...", 512 + MENUITEM SEPARATOR + MENUITEM "&T", ID_VIEW_TOOL_BAR, CHECKED + MENUITEM "б&D", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "״̬&S", ID_VIEW_STATUSBAR, CHECKED +#ifndef _NO_EXTENSIONS + MENUITEM "ȫ&U\tCtrl+Shift+S", ID_VIEW_FULLSCREEN +#endif + MENUITEM SEPARATOR + MENUITEM "&Minimize on run", 504 + MENUITEM "&Save settings on exit", 511 + } + + + POPUP "ȫ&S" { + MENUITEM "ʣ&A...", 605 + MENUITEM "¼&L...", 606 + MENUITEM "ߣ&O...", 607 + } + + POPUP "ڣ&W" { + MENUITEM "½&W)", ID_WINDOW_NEW + MENUITEM "\tCtrl+F5", ID_WINDOW_CASCADE + MENUITEM "ˮƽƽ̣&H", ID_WINDOW_TILE_HORZ + MENUITEM "ֱƽ̣&\tCtrl+F4", ID_WINDOW_TILE_VERT +#ifndef _NO_EXTENSIONS + MENUITEM "Զ", ID_WINDOW_AUTOSORT +#endif + MENUITEM "Զͼ꣨&S", ID_WINDOW_ARRANGE + MENUITEM "ˢ£&R\tF5", ID_REFRESH + } + + POPUP "&?" { + MENUITEM "⣨&H\tF1", ID_HELP + MENUITEM "&S...\tF1", ID_HELP + MENUITEM "ʹð&U\tF1", ID_HELP_USING + MENUITEM SEPARATOR + MENUITEM "& Winefile...", ID_ABOUT +#ifdef __WINE__ + MENUITEM " &Wine...", ID_ABOUT_WINE +#endif + } +} + + +IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10 + CONTROL "&C", -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10 + EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL + CONTROL "Ϊӣ&S", 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12 + DEFPUSHBUTTON "ȷ", 1, 158, 6, 47, 14 + PUSHBUTTON "ȡ", 2, 158, 23, 47, 14 + PUSHBUTTON "&H", 254, 158, 43, 47, 14 +} diff --git a/rosapps/winefile/make-docu.sh b/rosapps/winefile/make-docu.sh new file mode 100755 index 00000000000..7894b44d521 --- /dev/null +++ b/rosapps/winefile/make-docu.sh @@ -0,0 +1,2 @@ +sed 's/@GEN@/generated on '`date +%d.%m.%Y`/ doxy-footer.html +doxygen Doxyfile diff --git a/rosapps/winefile/make_winefile.dsp b/rosapps/winefile/make_winefile.dsp new file mode 100644 index 00000000000..5e02d59c966 --- /dev/null +++ b/rosapps/winefile/make_winefile.dsp @@ -0,0 +1,93 @@ +# Microsoft Developer Studio Project File - Name="make_winefile" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=make_winefile - 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 "make_winefile.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 "make_winefile.mak" CFG="make_winefile - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "make_winefile - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "make_winefile - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "make_winefile - 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 Cmd_Line "NMAKE /f make_winefile.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "make_winefile.exe" +# PROP BASE Bsc_Name "make_winefile.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile-MinGW" +# PROP Rebuild_Opt "clean all" +# PROP Target_File "winefile.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "make_winefile - 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 Cmd_Line "NMAKE /f make_winefile.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "make_winefile.exe" +# PROP BASE Bsc_Name "make_winefile.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Cmd_Line "msdevfilt -gcc -pipe "perl d:\tools\gSTLFilt.pl" make -f Makefile-MinGW DEBUG=1" +# PROP Rebuild_Opt "clean all" +# PROP Target_File "winefile.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "make_winefile - Win32 Release" +# Name "make_winefile - Win32 Debug" + +!IF "$(CFG)" == "make_winefile - Win32 Release" + +!ELSEIF "$(CFG)" == "make_winefile - Win32 Debug" + +!ENDIF + +# Begin Source File + +SOURCE=".\Makefile-MinGW" +# End Source File +# Begin Source File + +SOURCE=.\winefile.rbuild +# End Source File +# End Target +# End Project diff --git a/rosapps/winefile/make_winefile.vcproj b/rosapps/winefile/make_winefile.vcproj new file mode 100644 index 00000000000..aff966965c8 --- /dev/null +++ b/rosapps/winefile/make_winefile.vcproj @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rosapps/winefile/makel-docu.bat b/rosapps/winefile/makel-docu.bat new file mode 100755 index 00000000000..c10c03f1c40 --- /dev/null +++ b/rosapps/winefile/makel-docu.bat @@ -0,0 +1,3 @@ +doxygen Doxyfile +cmd /c start /b /low /wait hhc doxy-doc\html\index.hhp +move /y doxy-doc\html\index.chm winefile.chm diff --git a/rosapps/winefile/resource.h b/rosapps/winefile/resource.h new file mode 100644 index 00000000000..9b3659387ac --- /dev/null +++ b/rosapps/winefile/resource.h @@ -0,0 +1,151 @@ +/* + * Copyright 2000, 2003, 2005 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +/* images */ + +#define IDB_TOOLBAR 100 +#define IDB_DRIVEBAR 101 +#define IDB_IMAGES 102 +#define IDI_WINEFILE 100 + + +/* accellerators and menus */ + +#define IDA_WINEFILE 101 +#define IDM_WINEFILE 102 + + +/* dialogs */ + +#define IDD_EXECUTE 103 +#define IDD_SELECT_DESTINATION 104 +#define IDD_DIALOG_VIEW_TYPE 105 +#define IDD_DIALOG_PROPERTIES 106 + + +/* control ids */ + +#define ID_ACTIVATE 101 +#define ID_EXECUTE 105 +#define ID_FILE_MOVE 106 +#define ID_FILE_COPY 107 +#define ID_FILE_DELETE 108 +#define ID_FILE_EXIT 115 +#define ID_FORMAT_DISK 203 +#define ID_CONNECT_NETWORK_DRIVE 252 +#define ID_DISCONNECT_NETWORK_DRIVE 253 +#define ID_VIEW_NAME 401 +#define ID_VIEW_ALL_ATTRIBUTES 402 +#define ID_VIEW_SELECTED_ATTRIBUTES 403 +#define ID_VIEW_SORT_NAME 404 +#define ID_VIEW_SORT_TYPE 405 +#define ID_VIEW_SORT_SIZE 406 +#define ID_VIEW_SORT_DATE 407 +#define ID_VIEW_FILTER 409 +#define ID_VIEW_SPLIT 414 +#define ID_SELECT_FONT 510 +#define ID_VIEW_TOOL_BAR 508 +#define ID_VIEW_DRIVE_BAR 507 +#define ID_VIEW_STATUSBAR 503 + +#define ID_ABOUT 1803 +#define ID_REFRESH 1704 +#define ID_EDIT_PROPERTIES 57656 +#define ID_WINDOW_NEW 0xE130 +#define ID_WINDOW_ARRANGE 0xE131 +#define ID_WINDOW_CASCADE 0xE132 +#define ID_WINDOW_TILE_HORZ 0xE133 +#define ID_WINDOW_TILE_VERT 0xE134 +#define ID_WINDOW_SPLIT 0xE135 +#define ID_HELP_USING 0xE144 +#define ID_HELP 0xE146 + +#define IDC_VIEW_PATTERN 1000 +#define IDC_VIEW_TYPE_DIRECTORIES 1001 +#define IDC_VIEW_TYPE_PROGRAMS 1002 +#define IDC_VIEW_TYPE_DOCUMENTS 1003 +#define IDC_VIEW_TYPE_OTHERS 1004 +#define IDC_VIEW_TYPE_HIDDEN 1005 + +#define IDC_STATIC_PROP_FILENAME 1006 +#define IDC_STATIC_PROP_PATH 1007 +#define IDC_STATIC_PROP_LASTCHANGE 1008 +#define IDC_STATIC_PROP_VERSION 1009 +#define IDC_STATIC_PROP_COPYRIGHT 1010 +#define IDC_STATIC_PROP_SIZE 1011 +#define IDC_CHECK_READONLY 1012 +#define IDC_CHECK_ARCHIVE 1013 +#define IDC_CHECK_COMPRESSED 1014 +#define IDC_CHECK_HIDDEN 1015 +#define IDC_CHECK_SYSTEM 1016 +#define IDC_LIST_PROP_VERSION_TYPES 1017 +#define IDC_LIST_PROP_VERSION_VALUES 1018 + + +/* winefile extensions */ + +#define ID_ABOUT_WINE 0x8000 +#define ID_LICENSE 0x8001 +#define ID_NO_WARRANTY 0x8002 +#define ID_WINDOW_AUTOSORT 0x8003 +#define ID_VIEW_FULLSCREEN 0x8004 +#define ID_PREFERRED_SIZES 0x8005 + + +/* string table */ + +#define IDS_FONT_SEL_DLG_NAME 1101 +#define IDS_FONT_SEL_ERROR 1103 + +#define IDS_WINEFILE 1200 +#define IDS_ERROR 1201 +#define IDS_ROOT_FS 1202 +#define IDS_UNIXFS 1203 +#define IDS_DESKTOP 1204 +#define IDS_SHELL 1205 +#define IDS_TITLEFMT 1206 +#define IDS_NO_IMPL 1207 +#define IDS_WINE 1208 +#define IDS_WINE_FILE 1209 + +#define IDS_COL_NAME 1210 +#define IDS_COL_SIZE 1211 +#define IDS_COL_CDATE 1212 +#define IDS_COL_ADATE 1213 +#define IDS_COL_MDATE 1214 +#define IDS_COL_IDX 1215 +#define IDS_COL_LINKS 1216 +#define IDS_COL_ATTR 1217 +#define IDS_COL_SEC 1218 +#define IDS_FREE_SPACE_FMT 1219 + +#define IDS_LICENSE_CAPTION 1300 +#define IDS_LICENSE 1301 +#define IDS_WARRANTY_CAPTION 1302 +#define IDS_WARRANTY 1303 + + +/* range for drive bar command ids: 0x9000..0x90FF */ + +#ifdef __WINE__ +#define ID_DRIVE_UNIX_FS 0x9000 +#endif +#define ID_DRIVE_SHELL_NS 0x9001 + +#define ID_DRIVE_FIRST 0x9002 diff --git a/rosapps/winefile/resource.rc b/rosapps/winefile/resource.rc new file mode 100644 index 00000000000..ee735635c94 --- /dev/null +++ b/rosapps/winefile/resource.rc @@ -0,0 +1,293 @@ +/* + * Copyright 2000 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +IDA_WINEFILE ACCELERATORS DISCARDABLE +{ + VK_F1, ID_HELP, VIRTKEY, NOINVERT + VK_F5, ID_REFRESH, VIRTKEY, NOINVERT + VK_F7, ID_FILE_MOVE, VIRTKEY, NOINVERT + VK_F8, ID_FILE_COPY, VIRTKEY, NOINVERT + VK_DELETE, ID_FILE_DELETE, VIRTKEY, NOINVERT + VK_RETURN, ID_ACTIVATE, VIRTKEY, NOINVERT + VK_RETURN, ID_EDIT_PROPERTIES, VIRTKEY, ALT, NOINVERT +#ifndef _NO_EXTENSIONS + "X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT + "S", ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL, NOINVERT + VK_ADD, ID_PREFERRED_SIZES, VIRTKEY, CONTROL, NOINVERT +#endif +} + +IDI_WINEFILE ICON DISCARDABLE +#ifdef _WIN32 + "winefile.ico" +#else +{ + '00 00 01 00 01 00 20 20 10 00 00 00 00 00 E8 02' + '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00' + '00 00 01 00 04 00 00 00 00 00 80 02 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00' + '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80' + '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00' + '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 B7' + 'B7 B7 B7 B7 B7 B7 B7 70 00 00 00 00 00 00 00 70' + '00 00 00 00 00 00 0B 73 00 00 00 00 00 00 00 B3' + 'F7 B7 B7 B7 B7 B7 07 73 30 00 00 00 00 00 00 73' + 'FB 7B 7B 7B 7B 7B 0B 73 33 00 00 00 00 00 00 B3' + 'F7 BF FF FF F7 B7 07 73 33 00 00 00 00 00 00 73' + 'FB 70 33 33 0B 7B 0B 73 33 00 0F FF FF 00 00 B3' + 'F7 B0 33 33 07 B7 07 73 33 00 F0 00 00 F0 00 73' + 'FB 70 00 00 0B 7B 0B 73 33 00 00 00 00 00 00 B3' + 'F7 B7 B7 B7 B7 B7 07 73 33 00 00 00 00 00 00 73' + 'FF FF FF FF FF FF 0B 73 33 00 00 02 00 00 00 B3' + '33 33 33 33 33 33 07 73 33 00 00 09 00 00 00 7B' + '7B 7B 7B 7B 7B 7B 7B 73 33 00 00 99 90 00 00 B0' + '00 00 00 00 00 00 07 73 33 00 0B BB BB 00 00 73' + 'FB 7B 7B 7B 7B 7B 0B 73 33 00 BB BB BB B0 00 B3' + 'F7 B7 B7 B7 B7 B7 07 73 33 00 00 00 E0 00 00 73' + 'FB 7F FF FF FB 7B 0B 73 33 00 00 00 0E 00 00 B3' + 'F7 B0 33 33 07 B7 07 73 33 00 00 00 00 00 00 73' + 'FB 70 33 33 0B 7B 0B 73 33 00 00 00 00 00 00 B3' + 'F7 B0 00 00 07 B7 07 73 33 00 00 00 00 00 00 73' + 'FB 7B 7B 7B 7B 7B 0B 73 33 00 00 00 00 00 00 B3' + 'FF FF FF FF FF FF 07 73 33 00 00 00 00 00 00 73' + '33 33 33 33 33 33 0B 73 33 00 00 00 00 00 00 B7' + 'B7 B7 B7 B7 B7 B7 B7 73 33 00 00 00 00 00 00 FF' + 'FF FF FF FF FF FF FF F3 33 00 00 00 00 00 00 07' + 'B7 B7 B7 B7 B7 B7 B7 BF 33 00 00 00 00 00 00 00' + '7B 7B 7B 7B 7B 7B 7B 7B F3 00 00 00 00 00 00 00' + '07 B7 B7 B7 B7 B7 B7 B7 BF 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF' + 'FF FF 80 00 1F FF 80 00 0F FF 80 00 07 FF 80 00' + '03 FF 80 00 01 FF 80 00 01 FF 80 00 01 83 80 00' + '01 39 80 00 01 C7 80 00 01 EF 80 00 01 EF 80 00' + '01 EF 80 00 01 C7 80 00 01 83 80 00 01 01 80 00' + '01 F7 80 00 01 FB 80 00 01 FF 80 00 01 FF 80 00' + '01 FF 80 00 01 FF 80 00 01 FF 80 00 01 FF 80 00' + '01 FF 80 00 01 FF C0 00 01 FF E0 00 01 FF F0 00' + '01 FF F8 00 01 FF FF FF FF FF FF FF FF FF' +} +#endif + +IDB_TOOLBAR BITMAP DISCARDABLE +#ifdef _WIN32 + "toolbar.bmp" +#else +{ + '42 4D BE 03 00 00 00 00 00 00 76 00 00 00 28 00' + '00 00 70 00 00 00 0F 00 00 00 01 00 04 00 00 00' + '00 00 48 03 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80' + '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80' + '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF' + '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF' + '00 00 FF FF FF 00 77 77 77 88 88 88 88 88 77 77' + '77 77 77 77 77 77 77 88 88 88 88 88 88 87 77 88' + '88 88 88 88 88 87 77 88 88 88 88 88 88 88 78 88' + '88 88 88 88 88 87 77 77 77 07 07 07 07 07 77 77' + '74 44 44 44 44 48 77 77 77 88 88 88 88 88 74 44' + '44 44 44 44 44 87 74 44 44 44 44 44 44 87 74 44' + '44 44 44 44 44 48 44 44 44 44 44 44 44 87 77 77' + '77 77 77 77 77 70 77 77 74 FF FF FF FF 48 77 77' + '74 44 44 44 44 48 74 FF FF FF FF FF F4 87 74 FF' + 'FF F4 FF FF F4 87 74 FF FF F4 FF FF FF 48 4F FF' + 'FF 4F FF FF F4 87 07 07 07 07 77 77 77 77 77 77' + '74 FF FF FF FF 48 77 77 74 FF FF FF FF 48 74 FF' + 'FF FF FF FF F4 87 74 FF FF F4 FF FF F4 87 74 FF' + 'FF F4 FF FF FF 48 4F FF FF 44 44 44 44 87 77 77' + '77 77 77 77 77 70 77 88 88 88 88 88 FF 48 77 77' + '84 FF FF FF FF 48 74 FF FF FF FF FF F4 87 74 FF' + 'FF F4 FF FF F4 87 74 FF FF F4 44 44 44 48 4F FF' + 'FF 44 44 44 44 87 07 77 77 07 77 77 77 77 74 44' + '8B 44 44 48 44 48 77 74 44 FF FF FF FF 48 74 44' + '44 44 44 44 44 87 74 FF FF F4 FF FF F4 87 74 FF' + 'FF F4 44 44 44 48 4F FF FF 4F FF 4F F4 87 77 77' + '77 70 70 70 70 70 7B FF 8B FF FF 48 44 47 77 74' + 'F4 44 44 44 44 48 74 44 44 44 44 44 44 87 74 FF' + 'FF F4 FF FF F4 87 74 FF FF F4 FF F4 FF 48 44 44' + '44 44 44 44 44 87 07 77 77 07 07 07 07 07 78 B8' + '8B F8 BF 48 77 77 77 84 F4 44 44 44 44 47 74 44' + '44 44 44 44 44 87 74 FF FF F4 FF FF F4 87 74 44' + '44 44 FF F4 FF 48 44 44 44 44 44 44 44 77 70 70' + '70 70 70 77 77 77 74 8B 8B 8B FF 48 88 87 74 44' + 'FF FF FF FF 48 77 74 FF FF FF FF FF F4 87 74 FF' + 'FF F4 FF FF F4 87 74 44 44 44 FF F4 FF 48 77 77' + '77 77 77 77 77 77 00 F7 07 07 07 70 70 77 7B B8' + 'BB B4 44 48 44 87 74 F4 44 44 44 44 48 77 74 FF' + 'FF FF FF FF F4 87 74 FF FF F4 FF FF F4 87 74 FF' + 'FF F4 FF F4 FF 48 7C CC 77 CC 77 C7 7C 77 00 F7' + '78 87 77 77 77 07 74 88 BB B4 44 44 F4 87 74 F4' + '44 44 44 44 47 77 74 FF FF FF FF FF F4 87 74 FF' + 'FF F4 FF FF F4 87 74 FF FF F4 FF F4 FF 48 C7 7C' + '7C 7C 7C 77 C7 C7 70 0F 00 F7 77 77 77 77 77 8B' + '8B 8B FF FF F4 87 74 FF FF FF FF 48 77 77 74 44' + '44 44 44 44 44 87 74 44 44 44 44 44 44 87 74 FF' + 'FF F4 FF F4 FF 48 7C CC 7C 7C 7C 77 C7 C7 77 08' + '07 77 77 77 77 07 78 B7 8B FF FF FF F4 87 74 44' + '44 44 44 48 77 77 74 44 44 44 44 44 44 87 74 44' + '44 44 44 44 44 87 74 44 44 44 44 44 44 48 77 7C' + '7C 7C 7C 77 C7 C7 77 80 0F 77 77 77 77 77 7B 77' + '8B 44 8B 44 44 87 74 44 44 44 44 47 77 77 74 44' + '44 44 44 44 44 77 74 44 44 44 44 44 44 77 74 44' + '44 44 44 44 44 47 7C C7 7C 7C 7C C7 7C 77 80 07' + '70 F7 07 07 07 07 77 77 8B 44 54 44 44 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 7C 77 77 77 08 77 70 00 70 70 70 77' +} +#endif + +IDB_DRIVEBAR BITMAP DISCARDABLE +#ifdef _WIN32 + "drivebar.bmp" +#else +{ + '42 4D E6 02 00 00 00 00 00 00 76 00 00 00 28 00' + '00 00 60 00 00 00 0D 00 00 00 01 00 04 00 00 00' + '00 00 70 02 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80' + '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80' + '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF' + '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF' + '00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 08 88 88 88 88 88 88 80 08 88' + '88 88 88 88 88 80 08 88 88 88 88 88 88 80 08 88' + '88 88 88 88 88 80 08 88 88 88 88 88 88 80 08 88' + '88 88 88 88 88 80 07 70 07 77 77 70 00 80 0F 77' + '77 77 77 77 77 80 0F 00 77 77 77 77 77 80 0F 77' + '77 77 77 79 97 80 0F 77 70 00 77 77 77 80 0F 77' + '07 07 07 07 77 80 07 77 70 07 00 00 77 80 0F 77' + '70 00 00 07 77 80 0F 00 00 00 00 00 00 80 0F 77' + '70 00 07 77 77 80 0F 77 77 07 77 77 77 80 0F 70' + '00 00 00 00 77 80 07 77 77 00 00 77 77 80 0F 00' + '00 00 00 00 00 80 0F 77 77 77 77 77 77 80 0F 77' + '07 7F 70 77 77 80 0F 77 70 00 77 77 77 80 0F 70' + '70 70 70 70 77 80 07 70 00 77 70 00 77 80 0F 77' + '70 00 00 07 77 80 0F 00 00 00 00 00 00 80 0F 00' + '87 F8 78 00 77 80 0F 00 00 70 00 00 07 80 0F 70' + '00 00 00 00 77 80 07 07 77 77 77 70 00 80 0F 77' + '77 77 77 77 70 80 0F 77 77 77 77 77 77 80 0F 00' + '00 00 00 00 77 80 0F 77 77 77 77 77 77 80 0F 77' + '07 07 07 07 77 80 07 77 77 77 77 77 77 80 0F FF' + 'FF FF FF FF FF 80 0F FF FF FF FF FF FF 80 0F FF' + 'FF FF FF FF FF 80 0F FF FF FF FF FF FF 80 0F FF' + 'FF FF FF FF FF 80 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77' + '77 77 77 77 77 77' +} +#endif + +IDB_IMAGES BITMAP DISCARDABLE +#ifdef _WIN32 + "images.bmp" +#else +{ + '42 4D 86 04 00 00 00 00 00 00 76 00 00 00 28 00' + '00 00 A0 00 00 00 0D 00 00 00 01 00 04 00 00 00' + '00 00 10 04 00 00 00 00 00 00 00 00 00 00 00 00' + '00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80' + '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80' + '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF' + '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF' + '00 00 FF FF FF 00 AA AA 00 00 00 00 00 AA AA AA' + '00 00 00 00 00 AA AA 00 00 00 00 00 00 00 AA 00' + '00 00 00 00 00 00 AA A0 00 00 00 00 00 0A AA 00' + '00 00 00 00 00 00 AA A0 00 00 00 00 00 0A AA A0' + '00 00 00 00 00 0A AA AA AA AA AA AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 77 77 77 77 70 AA AA A7' + '77 77 77 77 70 AA A7 77 77 77 77 77 77 70 A7 77' + '77 77 77 77 77 80 AA 77 77 77 77 77 77 0A A7 77' + '77 77 77 77 77 80 AA 77 77 77 77 77 77 0A AA 77' + '77 77 77 77 77 0A AA AA AA AA AA AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF FF FF FF 70 AA A7 7F 7F 7F 7F 7F 7F 70 A7 FB' + 'FB FB FB FB FB 80 AA 7F BF BF BF BF B7 0A A7 FB' + 'FB FB FB FB FB 80 AA 7F BF BF BF BF B7 0A AA 7F' + 'BF BF BF BF B7 0A AA AA AA 00 00 00 0A AA AA AA' + 'AA 00 AA AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF 44 44 FF 70 AA A7 F7 F7 F7 F7 F7 F7 70 A7 FF' + 'BF BF BF BF BF 80 A7 FB FB FB FB FB F0 8A A7 FF' + 'BF B0 BF BF BF 80 A7 FB FB F0 FB FB F0 8A A7 FB' + 'FB FB FB FB F0 8A AA AA A0 E6 68 86 0A AA AA AA' + 'A0 E8 0A AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF FF FF FF 70 AA A7 7F 7F 7F 7F 7F 7F 70 A7 FB' + 'FB FB FB FB FB 80 A7 BF BF BF BF BF 70 8A A7 FB' + 'FB F0 FB FB FB 80 A7 BF B0 00 0F BF 70 8A A7 BF' + 'B0 00 0F BF 70 8A AA AA A0 E0 00 00 AA AA AA AA' + 'A0 E8 0A AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF 44 44 FF 70 AA A7 F7 F7 F7 F7 F7 F7 70 A7 FF' + 'BF BF BF BF BF 80 7B FB FB FB FB FB 88 8A A7 FF' + 'B0 00 00 BF BF 80 7B FB FB 0B FB FB 88 8A 7B FB' + 'FB FB FB FB 88 8A AA AA A0 E0 AA AA AA AA AA AA' + 'AA 00 AA AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF FF FF FF 70 AA A7 7F 7F 7F 7F 7F 7F 70 A7 FB' + 'FB FB FB FB FB 80 7F FF FF FF FF F7 0F 8A A7 FB' + 'FB F0 FB FB FB 80 7F FF FF FF FF F7 0F 8A 7F FF' + 'FF FF FF F7 0F 8A AA AA A0 E0 AA AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF 44 44 FF 70 AA A7 F7 F7 F7 F7 F7 F7 70 A7 FF' + 'BF BF BF BF BF 80 77 77 77 77 77 78 FB 8A A7 FF' + 'BF B0 BF BF BF 80 77 77 77 77 77 78 FB 8A 77 77' + '77 77 77 78 FB 8A AA A0 00 E0 00 AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 FF FF FF FF 70 AA AA A7' + 'FF FF FF FF 70 AA A7 7F 7F 7F 7F 7F 7F 70 A7 FB' + 'FB FB FB FB FB 80 A7 BF BF BF BF BF BF 8A A7 FB' + 'FB FB FB FB FB 80 A7 BF BF BF BF BF BF 8A A7 BF' + 'BF BF BF BF BF 8A AA A0 E6 66 60 AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 FF FF F7 77 7A AA AA A7' + 'FF 44 F7 77 7A AA A7 F7 F7 F7 F7 F7 F7 70 A7 FF' + 'FF FF FF FF FF 80 A7 FB FB FB FF FF FF 8A A7 FF' + 'FF FF FF FF FF 80 A7 FB FB FB FF FF FF 8A A7 FB' + 'FB FB FF FF FF 8A AA AA 0E 66 0A AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 FF FF F7 F7 AA AA AA A7' + 'FF FF F7 F7 AA AA A7 77 77 77 77 77 77 70 A7 FB' + 'FB FB F7 77 77 8A A7 BF BF BF F7 77 77 8A A7 FB' + 'FB FB F7 77 77 8A A7 BF BF BF F7 77 77 8A A7 BF' + 'BF BF F7 77 77 8A AA AA A0 E0 AA AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 FF FF F7 7A AA AA AA A7' + 'FF FF F7 7A AA AA A7 EE EE EE EE EE EE 70 AA 7F' + 'BF BF 7A AA AA AA AA 7F FF FF 7A AA AA AA AA 7F' + 'BF BF 7A AA AA AA AA 7F FF FF 7A AA AA AA AA 7F' + 'FF FF 7A AA AA AA AA AA AA 0A AA AA AA AA AA AA' + 'AA AA AA AA AA AA AA A7 77 77 77 AA AA AA AA A7' + '77 77 77 AA AA AA A7 77 77 77 77 77 77 7A AA A7' + '77 77 AA AA AA AA AA A7 77 77 AA AA AA AA AA A7' + '77 77 AA AA AA AA AA A7 77 77 AA AA AA AA AA A7' + '77 77 AA AA AA AA AA AA AA AA AA AA AA AA AA AA' + 'AA AA AA AA AA AA' +} +#endif diff --git a/rosapps/winefile/splitpath.c b/rosapps/winefile/splitpath.c new file mode 100644 index 00000000000..7081f75d3d1 --- /dev/null +++ b/rosapps/winefile/splitpath.c @@ -0,0 +1,155 @@ +/* + * Copyright 2000, 2004 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "winefile.h" + + +#ifdef __WINE__ +#ifdef UNICODE + +void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext) +{ + const WCHAR* end; /* end of processed string */ + const WCHAR* p; /* search pointer */ + const WCHAR* s; /* copy pointer */ + + /* extract drive name */ + if (path[0] && path[1]==':') { + if (drv) { + *drv++ = *path++; + *drv++ = *path++; + *drv = L'\0'; + } + } else if (drv) + *drv = L'\0'; + + /* search for end of string or stream separator */ + for(end=path; *end && *end!=L':'; ) + end++; + + /* search for begin of file extension */ + for(p=end; p>path && *--p!=L'\\' && *p!=L'/'; ) + if (*p == L'.') { + end = p; + break; + } + + if (ext) + for(s=end; (*ext=*s++); ) + ext++; + + /* search for end of directory name */ + for(p=end; p>path; ) + if (*--p=='\\' || *p=='/') { + p++; + break; + } + + if (name) { + for(s=p; spath && *--p!='\\' && *p!='/'; ) + if (*p == '.') { + end = p; + break; + } + + if (ext) + for(s=end; (*ext=*s++); ) + ext++; + + /* search for end of directory name */ + for(p=end; p>path; ) + if (*--p=='\\' || *p=='/') { + p++; + break; + } + + if (name) { + for(s=p; sAzpYfV1w__Gjw6-Ko-p|n;b_l-Kqco zp5pN&WZD;5PqM5}zkVr?-+p{?8c(Rd;`xbZi|3R3j2iFCxOU!Ey>lq8?=7K5(;bgT zWDaC4E@!sz;Kx^}L}X+jTWD__?Cp}r_VQk2!?=8YKSz%U7}uHF^M1I>fgd4;!fEdF z6ocUi*%@5pYcHn(IiZxCL!C298a~k4Vt0xODs$l~{{!x|-u5ECHSx9^074C!Dw}$r z?{Wd8Ugg4A6ph7{(x_(DYuxB3%!2Ufjmz2ecjW{6=0lx0vteMvGbEuqjuliP3OCi% zyU!CA@H>f#ys(_tiVLTgbE97KxSH{~`f0%T-1cSq^PB5ED|dIp#bPV&MJ#v+1i2+s zFApxJ+Sg%-(=_EU;$Eo@b~~1PfcsFmx>Ho{6>8OnHFt**j}3sU954Hq!wi3iV#6($ ze!z$BEN3}&;OaGi9rOV_EL_c8wK^PlaFN#$wvOO>=t{H~eac?zE!r&F zP#Rkm@aU^8Dww+IgK^&e9qa#F;dW=^%EN{bR-O$;X_VuObpp5j1uVIgYsbr$_1|)k zqF4H@!EWow<41TOMfNiB1{(+aQNH)rdDqbh_}gz9o}7v{%uOAEK}`NTIR6tJK6;SG K>EGfX6aE5k^t?g< literal 0 HcmV?d00001 diff --git a/rosapps/winefile/winefile.c b/rosapps/winefile/winefile.c new file mode 100644 index 00000000000..a95b639fb11 --- /dev/null +++ b/rosapps/winefile/winefile.c @@ -0,0 +1,4929 @@ +/* + * Winefile + * + * Copyright 2000, 2003, 2004, 2005 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef __WINE__ +#include "config.h" +#include "wine/port.h" + +/* for unix filesystem function calls */ +#include +#include +#include +#endif + +#define COBJMACROS + +#include "winefile.h" + +#include "resource.h" + + +#ifdef _NO_EXTENSIONS +#undef _LEFT_FILES +#endif + +#ifndef _MAX_PATH +#define _MAX_DRIVE 3 +#define _MAX_FNAME 256 +#define _MAX_DIR _MAX_FNAME +#define _MAX_EXT _MAX_FNAME +#define _MAX_PATH 260 +#endif + +#ifdef NONAMELESSUNION +#define UNION_MEMBER(x) DUMMYUNIONNAME.x +#else +#define UNION_MEMBER(x) x +#endif + + +#ifdef _SHELL_FOLDERS +#define DEFAULT_SPLIT_POS 300 +#else +#define DEFAULT_SPLIT_POS 200 +#endif + + +enum ENTRY_TYPE { + ET_WINDOWS, + ET_UNIX, +#ifdef _SHELL_FOLDERS + ET_SHELL +#endif +}; + +typedef struct _Entry { + struct _Entry* next; + struct _Entry* down; + struct _Entry* up; + + BOOL expanded; + BOOL scanned; + int level; + + WIN32_FIND_DATA data; + +#ifndef _NO_EXTENSIONS + BY_HANDLE_FILE_INFORMATION bhfi; + BOOL bhfi_valid; + enum ENTRY_TYPE etype; +#endif +#ifdef _SHELL_FOLDERS + LPITEMIDLIST pidl; + IShellFolder* folder; + HICON hicon; +#endif +} Entry; + +typedef struct { + Entry entry; + TCHAR path[MAX_PATH]; + TCHAR volname[_MAX_FNAME]; + TCHAR fs[_MAX_DIR]; + DWORD drive_type; + DWORD fs_flags; +} Root; + +enum COLUMN_FLAGS { + COL_SIZE = 0x01, + COL_DATE = 0x02, + COL_TIME = 0x04, + COL_ATTRIBUTES = 0x08, + COL_DOSNAMES = 0x10, +#ifdef _NO_EXTENSIONS + COL_ALL = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES +#else + COL_INDEX = 0x20, + COL_LINKS = 0x40, + COL_ALL = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES|COL_INDEX|COL_LINKS +#endif +}; + +typedef enum { + SORT_NAME, + SORT_EXT, + SORT_SIZE, + SORT_DATE +} SORT_ORDER; + +typedef struct { + HWND hwnd; +#ifndef _NO_EXTENSIONS + HWND hwndHeader; +#endif + +#ifndef _NO_EXTENSIONS +#define COLUMNS 10 +#else +#define COLUMNS 5 +#endif + int widths[COLUMNS]; + int positions[COLUMNS+1]; + + BOOL treePane; + int visible_cols; + Entry* root; + Entry* cur; +} Pane; + +typedef struct { + HWND hwnd; + Pane left; + Pane right; + int focus_pane; /* 0: left 1: right */ + WINDOWPLACEMENT pos; + int split_pos; + BOOL header_wdths_ok; + + TCHAR path[MAX_PATH]; + TCHAR filter_pattern[MAX_PATH]; + int filter_flags; + Root root; + + SORT_ORDER sortOrder; +} ChildWnd; + + + +static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd); +static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd); +static void refresh_child(ChildWnd* child); +static void refresh_drives(void); +static void get_path(Entry* dir, PTSTR path); +static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols); + +static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam); +static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam); +static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam); + + +/* globals */ +WINEFILE_GLOBALS Globals; + +static int last_split; + + +/* some common string constants */ +const static TCHAR sEmpty[] = {'\0'}; +const static TCHAR sSpace[] = {' ', '\0'}; +const static TCHAR sNumFmt[] = {'%','d','\0'}; +const static TCHAR sQMarks[] = {'?','?','?','\0'}; + +/* window class names */ +const static TCHAR sWINEFILEFRAME[] = {'W','F','S','_','F','r','a','m','e','\0'}; +const static TCHAR sWINEFILETREE[] = {'W','F','S','_','T','r','e','e','\0'}; + +#ifdef _MSC_VER +/* #define LONGLONGARG _T("I64") */ +const static TCHAR sLongHexFmt[] = {'%','I','6','4','X','\0'}; +const static TCHAR sLongNumFmt[] = {'%','I','6','4','d','\0'}; +#else +/* #define LONGLONGARG _T("L") */ +const static TCHAR sLongHexFmt[] = {'%','L','X','\0'}; +const static TCHAR sLongNumFmt[] = {'%','L','d','\0'}; +#endif + + +/* load resource string */ +static LPTSTR load_string(LPTSTR buffer, UINT id) +{ + LoadString(Globals.hInstance, id, buffer, BUFFER_LEN); + + return buffer; +} + +#define RS(b, i) load_string(b, i) + + +/* display error message for the specified WIN32 error code */ +static void display_error(HWND hwnd, DWORD error) +{ + TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN]; + PTSTR msg; + + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + 0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PTSTR)&msg, 0, NULL)) + MessageBox(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK); + else + MessageBox(hwnd, RS(b1,IDS_ERROR), RS(b2,IDS_WINEFILE), MB_OK); + + LocalFree(msg); +} + + +/* display network error message using WNetGetLastError() */ +static void display_network_error(HWND hwnd) +{ + TCHAR msg[BUFFER_LEN], provider[BUFFER_LEN], b2[BUFFER_LEN]; + DWORD error; + + if (WNetGetLastError(&error, msg, BUFFER_LEN, provider, BUFFER_LEN) == NO_ERROR) + MessageBox(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK); +} + + +#ifdef __WINE__ + +static VOID WineLicense(HWND Wnd) +{ + TCHAR cap[20], text[1024]; + LoadString(Globals.hInstance, IDS_LICENSE, text, 1024); + LoadString(Globals.hInstance, IDS_LICENSE_CAPTION, cap, 20); + MessageBox(Wnd, text, cap, MB_ICONINFORMATION | MB_OK); +} + +static VOID WineWarranty(HWND Wnd) +{ + TCHAR cap[20], text[1024]; + LoadString(Globals.hInstance, IDS_WARRANTY, text, 1024); + LoadString(Globals.hInstance, IDS_WARRANTY_CAPTION, cap, 20); + MessageBox(Wnd, text, cap, MB_ICONEXCLAMATION | MB_OK); +} + +#ifdef UNICODE + +/* call vswprintf() in msvcrt.dll */ +/*TODO: fix swprintf() in non-msvcrt mode, so that this dynamic linking function can be removed */ +static int msvcrt_swprintf(WCHAR* buffer, const WCHAR* fmt, ...) +{ + static int (__cdecl *pvswprintf)(WCHAR*, const WCHAR*, va_list) = NULL; + va_list ap; + int ret; + + if (!pvswprintf) { + HMODULE hModMsvcrt = LoadLibraryA("msvcrt"); + pvswprintf = (int(__cdecl*)(WCHAR*,const WCHAR*,va_list)) GetProcAddress(hModMsvcrt, "vswprintf"); + } + + va_start(ap, fmt); + ret = (*pvswprintf)(buffer, fmt, ap); + va_end(ap); + + return ret; +} + +static LPCWSTR my_wcsrchr(LPCWSTR str, WCHAR c) +{ + LPCWSTR p = str; + + while(*p) + ++p; + + do { + if (--p < str) + return NULL; + } while(*p != c); + + return p; +} + +#define _tcsrchr my_wcsrchr +#else /* UNICODE */ +#define _tcsrchr strrchr +#endif /* UNICODE */ + +#endif /* __WINE__ */ + + +/* allocate and initialise a directory entry */ +static Entry* alloc_entry(void) +{ + Entry* entry = (Entry*) malloc(sizeof(Entry)); + +#ifdef _SHELL_FOLDERS + entry->pidl = NULL; + entry->folder = NULL; + entry->hicon = 0; +#endif + + return entry; +} + +/* free a directory entry */ +static void free_entry(Entry* entry) +{ +#ifdef _SHELL_FOLDERS + if (entry->hicon && entry->hicon!=(HICON)-1) + DestroyIcon(entry->hicon); + + if (entry->folder && entry->folder!=Globals.iDesktop) + IShellFolder_Release(entry->folder); + + if (entry->pidl) + IMalloc_Free(Globals.iMalloc, entry->pidl); +#endif + + free(entry); +} + +/* recursively free all child entries */ +static void free_entries(Entry* dir) +{ + Entry *entry, *next=dir->down; + + if (next) { + dir->down = 0; + + do { + entry = next; + next = entry->next; + + free_entries(entry); + free_entry(entry); + } while(next); + } +} + + +static void read_directory_win(Entry* dir, LPCTSTR path) +{ + Entry* first_entry = NULL; + Entry* last = NULL; + Entry* entry; + + int level = dir->level + 1; + WIN32_FIND_DATA w32fd; + HANDLE hFind; +#ifndef _NO_EXTENSIONS + HANDLE hFile; +#endif + + TCHAR buffer[MAX_PATH], *p; + for(p=buffer; *path; ) + *p++ = *path++; + + *p++ = '\\'; + p[0] = '*'; + p[1] = '\0'; + + hFind = FindFirstFile(buffer, &w32fd); + + if (hFind != INVALID_HANDLE_VALUE) { + do { +#ifdef _NO_EXTENSIONS + /* hide directory entry "." */ + if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + LPCTSTR name = w32fd.cFileName; + + if (name[0]=='.' && name[1]=='\0') + continue; + } +#endif + entry = alloc_entry(); + + if (!first_entry) + first_entry = entry; + + if (last) + last->next = entry; + + memcpy(&entry->data, &w32fd, sizeof(WIN32_FIND_DATA)); + entry->down = NULL; + entry->up = dir; + entry->expanded = FALSE; + entry->scanned = FALSE; + entry->level = level; + +#ifndef _NO_EXTENSIONS + entry->etype = ET_WINDOWS; + entry->bhfi_valid = FALSE; + + lstrcpy(p, entry->data.cFileName); + + hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, + 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); + + if (hFile != INVALID_HANDLE_VALUE) { + if (GetFileInformationByHandle(hFile, &entry->bhfi)) + entry->bhfi_valid = TRUE; + + CloseHandle(hFile); + } +#endif + + last = entry; + } while(FindNextFile(hFind, &w32fd)); + + if (last) + last->next = NULL; + + FindClose(hFind); + } + + dir->down = first_entry; + dir->scanned = TRUE; +} + + +static Entry* find_entry_win(Entry* dir, LPCTSTR name) +{ + Entry* entry; + + for(entry=dir->down; entry; entry=entry->next) { + LPCTSTR p = name; + LPCTSTR q = entry->data.cFileName; + + do { + if (!*p || *p==TEXT('\\') || *p==TEXT('/')) + return entry; + } while(tolower(*p++) == tolower(*q++)); + + p = name; + q = entry->data.cAlternateFileName; + + do { + if (!*p || *p==TEXT('\\') || *p==TEXT('/')) + return entry; + } while(tolower(*p++) == tolower(*q++)); + } + + return 0; +} + + +static Entry* read_tree_win(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd) +{ + TCHAR buffer[MAX_PATH]; + Entry* entry = &root->entry; + LPCTSTR s = path; + PTSTR d = buffer; + + HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT)); + +#ifndef _NO_EXTENSIONS + entry->etype = ET_WINDOWS; +#endif + + while(entry) { + while(*s && *s!=TEXT('\\') && *s!=TEXT('/')) + *d++ = *s++; + + while(*s==TEXT('\\') || *s==TEXT('/')) + s++; + + *d++ = TEXT('\\'); + *d = TEXT('\0'); + + read_directory(entry, buffer, sortOrder, hwnd); + + if (entry->down) + entry->expanded = TRUE; + + if (!*s) + break; + + entry = find_entry_win(entry, s); + } + + SetCursor(old_cursor); + + return entry; +} + + +#if !defined(_NO_EXTENSIONS) && defined(__WINE__) + +static BOOL time_to_filetime(const time_t* t, FILETIME* ftime) +{ + struct tm* tm = gmtime(t); + SYSTEMTIME stime; + + if (!tm) + return FALSE; + + stime.wYear = tm->tm_year+1900; + stime.wMonth = tm->tm_mon+1; + /* stime.wDayOfWeek */ + stime.wDay = tm->tm_mday; + stime.wHour = tm->tm_hour; + stime.wMinute = tm->tm_min; + stime.wSecond = tm->tm_sec; + + return SystemTimeToFileTime(&stime, ftime); +} + +static void read_directory_unix(Entry* dir, LPCTSTR path) +{ + Entry* first_entry = NULL; + Entry* last = NULL; + Entry* entry; + DIR* pdir; + + int level = dir->level + 1; +#ifdef UNICODE + char cpath[MAX_PATH]; + + WideCharToMultiByte(CP_UNIXCP, 0, path, -1, cpath, MAX_PATH, NULL, NULL); +#else + const char* cpath = path; +#endif + + pdir = opendir(cpath); + + if (pdir) { + struct stat st; + struct dirent* ent; + char buffer[MAX_PATH], *p; + const char* s; + + for(p=buffer,s=cpath; *s; ) + *p++ = *s++; + + if (p==buffer || p[-1]!='/') + *p++ = '/'; + + while((ent=readdir(pdir))) { + entry = alloc_entry(); + + if (!first_entry) + first_entry = entry; + + if (last) + last->next = entry; + + entry->etype = ET_UNIX; + + strcpy(p, ent->d_name); +#ifdef UNICODE + MultiByteToWideChar(CP_UNIXCP, 0, p, -1, entry->data.cFileName, MAX_PATH); +#else + lstrcpy(entry->data.cFileName, p); +#endif + + if (!stat(buffer, &st)) { + entry->data.dwFileAttributes = p[0]=='.'? FILE_ATTRIBUTE_HIDDEN: 0; + + if (S_ISDIR(st.st_mode)) + entry->data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY; + + entry->data.nFileSizeLow = st.st_size & 0xFFFFFFFF; + entry->data.nFileSizeHigh = st.st_size >> 32; + + memset(&entry->data.ftCreationTime, 0, sizeof(FILETIME)); + time_to_filetime(&st.st_atime, &entry->data.ftLastAccessTime); + time_to_filetime(&st.st_mtime, &entry->data.ftLastWriteTime); + + entry->bhfi.nFileIndexLow = ent->d_ino; + entry->bhfi.nFileIndexHigh = 0; + + entry->bhfi.nNumberOfLinks = st.st_nlink; + + entry->bhfi_valid = TRUE; + } else { + entry->data.nFileSizeLow = 0; + entry->data.nFileSizeHigh = 0; + entry->bhfi_valid = FALSE; + } + + entry->down = NULL; + entry->up = dir; + entry->expanded = FALSE; + entry->scanned = FALSE; + entry->level = level; + + last = entry; + } + + if (last) + last->next = NULL; + + closedir(pdir); + } + + dir->down = first_entry; + dir->scanned = TRUE; +} + +static Entry* find_entry_unix(Entry* dir, LPCTSTR name) +{ + Entry* entry; + + for(entry=dir->down; entry; entry=entry->next) { + LPCTSTR p = name; + LPCTSTR q = entry->data.cFileName; + + do { + if (!*p || *p==TEXT('/')) + return entry; + } while(*p++ == *q++); + } + + return 0; +} + +static Entry* read_tree_unix(Root* root, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd) +{ + TCHAR buffer[MAX_PATH]; + Entry* entry = &root->entry; + LPCTSTR s = path; + PTSTR d = buffer; + + HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT)); + + entry->etype = ET_UNIX; + + while(entry) { + while(*s && *s!=TEXT('/')) + *d++ = *s++; + + while(*s == TEXT('/')) + s++; + + *d++ = TEXT('/'); + *d = TEXT('\0'); + + read_directory(entry, buffer, sortOrder, hwnd); + + if (entry->down) + entry->expanded = TRUE; + + if (!*s) + break; + + entry = find_entry_unix(entry, s); + } + + SetCursor(old_cursor); + + return entry; +} + +#endif /* !defined(_NO_EXTENSIONS) && defined(__WINE__) */ + + +#ifdef _SHELL_FOLDERS + +#ifdef UNICODE +#define get_strret get_strretW +#define path_from_pidl path_from_pidlW +#else +#define get_strret get_strretA +#define path_from_pidl path_from_pidlA +#endif + + +static void free_strret(STRRET* str) +{ + if (str->uType == STRRET_WSTR) + IMalloc_Free(Globals.iMalloc, str->UNION_MEMBER(pOleStr)); +} + + +#ifndef UNICODE + +static LPSTR strcpyn(LPSTR dest, LPCSTR source, size_t count) +{ + LPCSTR s; + LPSTR d = dest; + + for(s=source; count&&(*d++=*s++); ) + count--; + + return dest; +} + +static void get_strretA(STRRET* str, const SHITEMID* shiid, LPSTR buffer, int len) +{ + switch(str->uType) { + case STRRET_WSTR: + WideCharToMultiByte(CP_ACP, 0, str->UNION_MEMBER(pOleStr), -1, buffer, len, NULL, NULL); + break; + + case STRRET_OFFSET: + strcpyn(buffer, (LPCSTR)shiid+str->UNION_MEMBER(uOffset), len); + break; + + case STRRET_CSTR: + strcpyn(buffer, str->UNION_MEMBER(cStr), len); + } +} + +static HRESULT path_from_pidlA(IShellFolder* folder, LPITEMIDLIST pidl, LPSTR buffer, int len) +{ + STRRET str; + + /* SHGDN_FORPARSING: get full path of id list */ + HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, SHGDN_FORPARSING, &str); + + if (SUCCEEDED(hr)) { + get_strretA(&str, &pidl->mkid, buffer, len); + free_strret(&str); + } else + buffer[0] = '\0'; + + return hr; +} + +#endif + +static LPWSTR wcscpyn(LPWSTR dest, LPCWSTR source, size_t count) +{ + LPCWSTR s; + LPWSTR d = dest; + + for(s=source; count&&(*d++=*s++); ) + count--; + + return dest; +} + +static void get_strretW(STRRET* str, const SHITEMID* shiid, LPWSTR buffer, int len) +{ + switch(str->uType) { + case STRRET_WSTR: + wcscpyn(buffer, str->UNION_MEMBER(pOleStr), len); + break; + + case STRRET_OFFSET: + MultiByteToWideChar(CP_ACP, 0, (LPCSTR)shiid+str->UNION_MEMBER(uOffset), -1, buffer, len); + break; + + case STRRET_CSTR: + MultiByteToWideChar(CP_ACP, 0, str->UNION_MEMBER(cStr), -1, buffer, len); + } +} + + +static HRESULT name_from_pidl(IShellFolder* folder, LPITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags) +{ + STRRET str; + + HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, flags, &str); + + if (SUCCEEDED(hr)) { + get_strret(&str, &pidl->mkid, buffer, len); + free_strret(&str); + } else + buffer[0] = '\0'; + + return hr; +} + + +static HRESULT path_from_pidlW(IShellFolder* folder, LPITEMIDLIST pidl, LPWSTR buffer, int len) +{ + STRRET str; + + /* SHGDN_FORPARSING: get full path of id list */ + HRESULT hr = IShellFolder_GetDisplayNameOf(folder, pidl, SHGDN_FORPARSING, &str); + + if (SUCCEEDED(hr)) { + get_strretW(&str, &pidl->mkid, buffer, len); + free_strret(&str); + } else + buffer[0] = '\0'; + + return hr; +} + + + /* create an item id list from a file system path */ + +static LPITEMIDLIST get_path_pidl(LPTSTR path, HWND hwnd) +{ + LPITEMIDLIST pidl; + HRESULT hr; + ULONG len; + +#ifdef UNICODE + LPWSTR buffer = path; +#else + WCHAR buffer[MAX_PATH]; + MultiByteToWideChar(CP_ACP, 0, path, -1, buffer, MAX_PATH); +#endif + + hr = IShellFolder_ParseDisplayName(Globals.iDesktop, hwnd, NULL, buffer, &len, &pidl, NULL); + if (FAILED(hr)) + return NULL; + + return pidl; +} + + + /* convert an item id list from relative to absolute (=relative to the desktop) format */ + +static LPITEMIDLIST get_to_absolute_pidl(Entry* entry, HWND hwnd) +{ + if (entry->up && entry->up->etype==ET_SHELL) { + IShellFolder* folder = entry->up->folder; + WCHAR buffer[MAX_PATH]; + + HRESULT hr = path_from_pidlW(folder, entry->pidl, buffer, MAX_PATH); + + if (SUCCEEDED(hr)) { + LPITEMIDLIST pidl; + ULONG len; + + hr = IShellFolder_ParseDisplayName(Globals.iDesktop, hwnd, NULL, buffer, &len, &pidl, NULL); + + if (SUCCEEDED(hr)) + return pidl; + } + } else if (entry->etype == ET_WINDOWS) { + TCHAR path[MAX_PATH]; + + get_path(entry, path); + + return get_path_pidl(path, hwnd); + } else if (entry->pidl) + return ILClone(entry->pidl); + + return NULL; +} + + +static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl) +{ + IExtractIcon* pExtract; + + if (SUCCEEDED(IShellFolder_GetUIObjectOf(folder, 0, 1, (LPCITEMIDLIST*)&pidl, &IID_IExtractIcon, 0, (LPVOID*)&pExtract))) { + TCHAR path[_MAX_PATH]; + unsigned flags; + HICON hicon; + int idx; + + if (SUCCEEDED((*pExtract->lpVtbl->GetIconLocation)(pExtract, GIL_FORSHELL, path, _MAX_PATH, &idx, &flags))) { + if (!(flags & GIL_NOTFILENAME)) { + if (idx == -1) + idx = 0; /* special case for some control panel applications */ + + if ((int)ExtractIconEx(path, idx, 0, &hicon, 1) > 0) + flags &= ~GIL_DONTCACHE; + } else { + HICON hIconLarge = 0; + + HRESULT hr = (*pExtract->lpVtbl->Extract)(pExtract, path, idx, &hIconLarge, &hicon, MAKELONG(0/*GetSystemMetrics(SM_CXICON)*/,GetSystemMetrics(SM_CXSMICON))); + + if (SUCCEEDED(hr)) + DestroyIcon(hIconLarge); + } + + return hicon; + } + } + + return 0; +} + + +static Entry* find_entry_shell(Entry* dir, LPCITEMIDLIST pidl) +{ + Entry* entry; + + for(entry=dir->down; entry; entry=entry->next) { + if (entry->pidl->mkid.cb == pidl->mkid.cb && + !memcmp(entry->pidl, pidl, entry->pidl->mkid.cb)) + return entry; + } + + return 0; +} + +static Entry* read_tree_shell(Root* root, LPITEMIDLIST pidl, SORT_ORDER sortOrder, HWND hwnd) +{ + Entry* entry = &root->entry; + Entry* next; + LPITEMIDLIST next_pidl = pidl; + IShellFolder* folder; + IShellFolder* child = NULL; + HRESULT hr; + + HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT)); + +#ifndef _NO_EXTENSIONS + entry->etype = ET_SHELL; +#endif + + folder = Globals.iDesktop; + + while(entry) { + entry->pidl = next_pidl; + entry->folder = folder; + + if (!pidl->mkid.cb) + break; + + /* copy first element of item idlist */ + next_pidl = IMalloc_Alloc(Globals.iMalloc, pidl->mkid.cb+sizeof(USHORT)); + memcpy(next_pidl, pidl, pidl->mkid.cb); + ((LPITEMIDLIST)((LPBYTE)next_pidl+pidl->mkid.cb))->mkid.cb = 0; + + hr = IShellFolder_BindToObject(folder, next_pidl, 0, &IID_IShellFolder, (void**)&child); + if (!SUCCEEDED(hr)) + break; + + read_directory(entry, NULL, sortOrder, hwnd); + + if (entry->down) + entry->expanded = TRUE; + + next = find_entry_shell(entry, next_pidl); + if (!next) + break; + + folder = child; + entry = next; + + /* go to next element */ + pidl = (LPITEMIDLIST) ((LPBYTE)pidl+pidl->mkid.cb); + } + + SetCursor(old_cursor); + + return entry; +} + + +static void fill_w32fdata_shell(IShellFolder* folder, LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA* w32fdata) +{ + if (!(attribs & SFGAO_FILESYSTEM) || + FAILED(SHGetDataFromIDList(folder, pidl, SHGDFIL_FINDDATA, w32fdata, sizeof(WIN32_FIND_DATA)))) { + WIN32_FILE_ATTRIBUTE_DATA fad; + IDataObject* pDataObj; + + STGMEDIUM medium = {0, {0}, 0}; + FORMATETC fmt = {Globals.cfStrFName, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; + + HRESULT hr = IShellFolder_GetUIObjectOf(folder, 0, 1, &pidl, &IID_IDataObject, 0, (LPVOID*)&pDataObj); + + if (SUCCEEDED(hr)) { + hr = IDataObject_GetData(pDataObj, &fmt, &medium); + + IDataObject_Release(pDataObj); + + if (SUCCEEDED(hr)) { + LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal)); + UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS); + + if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) { + w32fdata->dwFileAttributes = fad.dwFileAttributes; + w32fdata->ftCreationTime = fad.ftCreationTime; + w32fdata->ftLastAccessTime = fad.ftLastAccessTime; + w32fdata->ftLastWriteTime = fad.ftLastWriteTime; + + if (!(fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + w32fdata->nFileSizeLow = fad.nFileSizeLow; + w32fdata->nFileSizeHigh = fad.nFileSizeHigh; + } + } + + SetErrorMode(sem_org); + + GlobalUnlock(medium.UNION_MEMBER(hGlobal)); + GlobalFree(medium.UNION_MEMBER(hGlobal)); + } + } + } + + if (attribs & (SFGAO_FOLDER|SFGAO_HASSUBFOLDER)) + w32fdata->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY; + + if (attribs & SFGAO_READONLY) + w32fdata->dwFileAttributes |= FILE_ATTRIBUTE_READONLY; + + if (attribs & SFGAO_COMPRESSED) + w32fdata->dwFileAttributes |= FILE_ATTRIBUTE_COMPRESSED; +} + + +static void read_directory_shell(Entry* dir, HWND hwnd) +{ + IShellFolder* folder = dir->folder; + int level = dir->level + 1; + HRESULT hr; + + IShellFolder* child; + IEnumIDList* idlist; + + Entry* first_entry = NULL; + Entry* last = NULL; + Entry* entry; + + if (!folder) + return; + + hr = IShellFolder_EnumObjects(folder, hwnd, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN|SHCONTF_SHAREABLE|SHCONTF_STORAGE, &idlist); + + if (SUCCEEDED(hr)) { + for(;;) { +#define FETCH_ITEM_COUNT 32 + LPITEMIDLIST pidls[FETCH_ITEM_COUNT]; + SFGAOF attribs; + ULONG cnt = 0; + ULONG n; + + memset(pidls, 0, sizeof(pidls)); + + hr = IEnumIDList_Next(idlist, FETCH_ITEM_COUNT, pidls, &cnt); + if (!SUCCEEDED(hr)) + break; + + if (hr == S_FALSE) + break; + + for(n=0; nnext = entry; + + memset(&entry->data, 0, sizeof(WIN32_FIND_DATA)); + entry->bhfi_valid = FALSE; + + attribs = ~SFGAO_FILESYSTEM; /*SFGAO_HASSUBFOLDER|SFGAO_FOLDER; SFGAO_FILESYSTEM sorgt dafr, da "My Documents" anstatt von "Martin's Documents" angezeigt wird */ + + hr = IShellFolder_GetAttributesOf(folder, 1, (LPCITEMIDLIST*)&pidls[n], &attribs); + + if (SUCCEEDED(hr)) { + if (attribs != (SFGAOF)~SFGAO_FILESYSTEM) { + fill_w32fdata_shell(folder, pidls[n], attribs, &entry->data); + + entry->bhfi_valid = TRUE; + } else + attribs = 0; + } else + attribs = 0; + + entry->pidl = pidls[n]; + + if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + hr = IShellFolder_BindToObject(folder, pidls[n], 0, &IID_IShellFolder, (void**)&child); + + if (SUCCEEDED(hr)) + entry->folder = child; + else + entry->folder = NULL; + } + else + entry->folder = NULL; + + if (!entry->data.cFileName[0]) + /*hr = */name_from_pidl(folder, pidls[n], entry->data.cFileName, MAX_PATH, /*SHGDN_INFOLDER*/0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/); + + /* get display icons for files and virtual objects */ + if (!(entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + !(attribs & SFGAO_FILESYSTEM)) { + entry->hicon = extract_icon(folder, pidls[n]); + + if (!entry->hicon) + entry->hicon = (HICON)-1; /* don't try again later */ + } + + entry->down = NULL; + entry->up = dir; + entry->expanded = FALSE; + entry->scanned = FALSE; + entry->level = level; + +#ifndef _NO_EXTENSIONS + entry->etype = ET_SHELL; + entry->bhfi_valid = FALSE; +#endif + + last = entry; + } + } + + IEnumIDList_Release(idlist); + } + + if (last) + last->next = NULL; + + dir->down = first_entry; + dir->scanned = TRUE; +} + +#endif /* _SHELL_FOLDERS */ + + +/* sort order for different directory/file types */ +enum TYPE_ORDER { + TO_DIR = 0, + TO_DOT = 1, + TO_DOTDOT = 2, + TO_OTHER_DIR = 3, + TO_FILE = 4 +}; + +/* distinguish between ".", ".." and any other directory names */ +static int TypeOrderFromDirname(LPCTSTR name) +{ + if (name[0] == '.') { + if (name[1] == '\0') + return TO_DOT; /* "." */ + + if (name[1]=='.' && name[2]=='\0') + return TO_DOTDOT; /* ".." */ + } + + return TO_OTHER_DIR; /* anything else */ +} + +/* directories first... */ +static int compareType(const WIN32_FIND_DATA* fd1, const WIN32_FIND_DATA* fd2) +{ + int order1 = fd1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE; + int order2 = fd2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? TO_DIR: TO_FILE; + + /* Handle "." and ".." as special case and move them at the very first beginning. */ + if (order1==TO_DIR && order2==TO_DIR) { + order1 = TypeOrderFromDirname(fd1->cFileName); + order2 = TypeOrderFromDirname(fd2->cFileName); + } + + return order2==order1? 0: order1data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; + + int cmp = compareType(fd1, fd2); + if (cmp) + return cmp; + + return lstrcmpi(fd1->cFileName, fd2->cFileName); +} + +static int compareExt(const void* arg1, const void* arg2) +{ + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; + const TCHAR *name1, *name2, *ext1, *ext2; + + int cmp = compareType(fd1, fd2); + if (cmp) + return cmp; + + name1 = fd1->cFileName; + name2 = fd2->cFileName; + + ext1 = _tcsrchr(name1, TEXT('.')); + ext2 = _tcsrchr(name2, TEXT('.')); + + if (ext1) + ext1++; + else + ext1 = sEmpty; + + if (ext2) + ext2++; + else + ext2 = sEmpty; + + cmp = lstrcmpi(ext1, ext2); + if (cmp) + return cmp; + + return lstrcmpi(name1, name2); +} + +static int compareSize(const void* arg1, const void* arg2) +{ + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; + + int cmp = compareType(fd1, fd2); + if (cmp) + return cmp; + + cmp = fd2->nFileSizeHigh - fd1->nFileSizeHigh; + + if (cmp < 0) + return -1; + else if (cmp > 0) + return 1; + + cmp = fd2->nFileSizeLow - fd1->nFileSizeLow; + + return cmp<0? -1: cmp>0? 1: 0; +} + +static int compareDate(const void* arg1, const void* arg2) +{ + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; + + int cmp = compareType(fd1, fd2); + if (cmp) + return cmp; + + return CompareFileTime(&fd2->ftLastWriteTime, &fd1->ftLastWriteTime); +} + + +static int (*sortFunctions[])(const void* arg1, const void* arg2) = { + compareName, /* SORT_NAME */ + compareExt, /* SORT_EXT */ + compareSize, /* SORT_SIZE */ + compareDate /* SORT_DATE */ +}; + + +static void SortDirectory(Entry* dir, SORT_ORDER sortOrder) +{ + Entry* entry = dir->down; + Entry** array, **p; + int len; + + len = 0; + for(entry=dir->down; entry; entry=entry->next) + len++; + + if (len) { + array = HeapAlloc(GetProcessHeap(), 0, len*sizeof(Entry*)); + + p = array; + for(entry=dir->down; entry; entry=entry->next) + *p++ = entry; + + /* call qsort with the appropriate compare function */ + qsort(array, len, sizeof(array[0]), sortFunctions[sortOrder]); + + dir->down = array[0]; + + for(p=array; --len; p++) + p[0]->next = p[1]; + + (*p)->next = 0; + + HeapFree(GetProcessHeap(), 0, array); + } +} + + +static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd) +{ + TCHAR buffer[MAX_PATH]; + Entry* entry; + LPCTSTR s; + PTSTR d; + +#ifdef _SHELL_FOLDERS + if (dir->etype == ET_SHELL) + { + read_directory_shell(dir, hwnd); + + if (Globals.prescan_node) { + s = path; + d = buffer; + + while(*s) + *d++ = *s++; + + *d++ = TEXT('\\'); + + for(entry=dir->down; entry; entry=entry->next) + if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + read_directory_shell(entry, hwnd); + SortDirectory(entry, sortOrder); + } + } + } + else +#endif +#if !defined(_NO_EXTENSIONS) && defined(__WINE__) + if (dir->etype == ET_UNIX) + { + read_directory_unix(dir, path); + + if (Globals.prescan_node) { + s = path; + d = buffer; + + while(*s) + *d++ = *s++; + + *d++ = TEXT('/'); + + for(entry=dir->down; entry; entry=entry->next) + if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + lstrcpy(d, entry->data.cFileName); + read_directory_unix(entry, buffer); + SortDirectory(entry, sortOrder); + } + } + } + else +#endif + { + read_directory_win(dir, path); + + if (Globals.prescan_node) { + s = path; + d = buffer; + + while(*s) + *d++ = *s++; + + *d++ = TEXT('\\'); + + for(entry=dir->down; entry; entry=entry->next) + if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + lstrcpy(d, entry->data.cFileName); + read_directory_win(entry, buffer); + SortDirectory(entry, sortOrder); + } + } + } + + SortDirectory(dir, sortOrder); +} + + +static Entry* read_tree(Root* root, LPCTSTR path, LPITEMIDLIST pidl, LPTSTR drv, SORT_ORDER sortOrder, HWND hwnd) +{ +#if !defined(_NO_EXTENSIONS) && defined(__WINE__) + const static TCHAR sSlash[] = {'/', '\0'}; +#endif + const static TCHAR sBackslash[] = {'\\', '\0'}; + +#ifdef _SHELL_FOLDERS + if (pidl) + { + /* read shell namespace tree */ + root->drive_type = DRIVE_UNKNOWN; + drv[0] = '\\'; + drv[1] = '\0'; + load_string(root->volname, IDS_DESKTOP); + root->fs_flags = 0; + load_string(root->fs, IDS_SHELL); + + return read_tree_shell(root, pidl, sortOrder, hwnd); + } + else +#endif +#if !defined(_NO_EXTENSIONS) && defined(__WINE__) + if (*path == '/') + { + /* read unix file system tree */ + root->drive_type = GetDriveType(path); + + lstrcat(drv, sSlash); + load_string(root->volname, IDS_ROOT_FS); + root->fs_flags = 0; + load_string(root->fs, IDS_UNIXFS); + + lstrcpy(root->path, sSlash); + + return read_tree_unix(root, path, sortOrder, hwnd); + } +#endif + + /* read WIN32 file system tree */ + root->drive_type = GetDriveType(path); + + lstrcat(drv, sBackslash); + GetVolumeInformation(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR); + + lstrcpy(root->path, drv); + + return read_tree_win(root, path, sortOrder, hwnd); +} + + +/* flags to filter different file types */ +enum TYPE_FILTER { + TF_DIRECTORIES = 0x01, + TF_PROGRAMS = 0x02, + TF_DOCUMENTS = 0x04, + TF_OTHERS = 0x08, + TF_HIDDEN = 0x10, + TF_ALL = 0x1F +}; + + +static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd) +{ + TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT]; + TCHAR dir_path[MAX_PATH]; + TCHAR b1[BUFFER_LEN]; + const static TCHAR sAsterics[] = {'*', '\0'}; + + ChildWnd* child = (ChildWnd*) malloc(sizeof(ChildWnd)); + Root* root = &child->root; + Entry* entry; + + memset(child, 0, sizeof(ChildWnd)); + + child->left.treePane = TRUE; + child->left.visible_cols = 0; + + child->right.treePane = FALSE; +#ifndef _NO_EXTENSIONS + child->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_INDEX|COL_LINKS; +#else + child->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES; +#endif + + child->pos.length = sizeof(WINDOWPLACEMENT); + child->pos.flags = 0; + child->pos.showCmd = SW_SHOWNORMAL; + child->pos.rcNormalPosition.left = CW_USEDEFAULT; + child->pos.rcNormalPosition.top = CW_USEDEFAULT; + child->pos.rcNormalPosition.right = CW_USEDEFAULT; + child->pos.rcNormalPosition.bottom = CW_USEDEFAULT; + + child->focus_pane = 0; + child->split_pos = DEFAULT_SPLIT_POS; + child->sortOrder = SORT_NAME; + child->header_wdths_ok = FALSE; + + if (path) + { + lstrcpy(child->path, path); + + _tsplitpath(path, drv, dir, name, ext); + } + + lstrcpy(child->filter_pattern, sAsterics); + child->filter_flags = TF_ALL; + + root->entry.level = 0; + + lstrcpy(dir_path, drv); + lstrcat(dir_path, dir); + entry = read_tree(root, dir_path, pidl, drv, child->sortOrder, hwnd); + +#ifdef _SHELL_FOLDERS + if (root->entry.etype == ET_SHELL) + load_string(root->entry.data.cFileName, IDS_DESKTOP); + else +#endif + wsprintf(root->entry.data.cFileName, RS(b1,IDS_TITLEFMT), drv, root->fs); + + root->entry.data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; + + child->left.root = &root->entry; + child->right.root = NULL; + + set_curdir(child, entry, 0, hwnd); + + return child; +} + + +/* free all memory associated with a child window */ +static void free_child_window(ChildWnd* child) +{ + free_entries(&child->root.entry); + free(child); +} + + +/* get full path of specified directory entry */ +static void get_path(Entry* dir, PTSTR path) +{ + Entry* entry; + int len = 0; + int level = 0; + +#ifdef _SHELL_FOLDERS + if (dir->etype == ET_SHELL) + { + SFGAOF attribs; + HRESULT hr = S_OK; + + path[0] = TEXT('\0'); + + attribs = 0; + + if (dir->folder) + hr = IShellFolder_GetAttributesOf(dir->folder, 1, (LPCITEMIDLIST*)&dir->pidl, &attribs); + + if (SUCCEEDED(hr) && (attribs&SFGAO_FILESYSTEM)) { + IShellFolder* parent = dir->up? dir->up->folder: Globals.iDesktop; + + hr = path_from_pidl(parent, dir->pidl, path, MAX_PATH); + } + } + else +#endif + { + for(entry=dir; entry; level++) { + LPCTSTR name; + int l; + + { + LPCTSTR s; + name = entry->data.cFileName; + s = name; + + for(l=0; *s && *s!=TEXT('/') && *s!=TEXT('\\'); s++) + l++; + } + + if (entry->up) { + if (l > 0) { + memmove(path+l+1, path, len*sizeof(TCHAR)); + memcpy(path+1, name, l*sizeof(TCHAR)); + len += l+1; + +#ifndef _NO_EXTENSIONS + if (entry->etype == ET_UNIX) + path[0] = TEXT('/'); + else +#endif + path[0] = TEXT('\\'); + } + + entry = entry->up; + } else { + memmove(path+l, path, len*sizeof(TCHAR)); + memcpy(path, name, l*sizeof(TCHAR)); + len += l; + break; + } + } + + if (!level) { +#ifndef _NO_EXTENSIONS + if (entry->etype == ET_UNIX) + path[len++] = TEXT('/'); + else +#endif + path[len++] = TEXT('\\'); + } + + path[len] = TEXT('\0'); + } +} + + +static void resize_frame_rect(HWND hwnd, PRECT prect) +{ + int new_top; + RECT rt; + + if (IsWindowVisible(Globals.htoolbar)) { + SendMessage(Globals.htoolbar, WM_SIZE, 0, 0); + GetClientRect(Globals.htoolbar, &rt); + prect->top = rt.bottom+3; + prect->bottom -= rt.bottom+3; + } + + if (IsWindowVisible(Globals.hdrivebar)) { + SendMessage(Globals.hdrivebar, WM_SIZE, 0, 0); + GetClientRect(Globals.hdrivebar, &rt); + new_top = --prect->top + rt.bottom+3; + MoveWindow(Globals.hdrivebar, 0, prect->top, rt.right, new_top, TRUE); + prect->top = new_top; + prect->bottom -= rt.bottom+2; + } + + if (IsWindowVisible(Globals.hstatusbar)) { + int parts[] = {300, 500}; + + SendMessage(Globals.hstatusbar, WM_SIZE, 0, 0); + SendMessage(Globals.hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts); + GetClientRect(Globals.hstatusbar, &rt); + prect->bottom -= rt.bottom; + } + + MoveWindow(Globals.hmdiclient, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE); +} + +static void resize_frame(HWND hwnd, int cx, int cy) +{ + RECT rect; + + rect.left = 0; + rect.top = 0; + rect.right = cx; + rect.bottom = cy; + + resize_frame_rect(hwnd, &rect); +} + +static void resize_frame_client(HWND hwnd) +{ + RECT rect; + + GetClientRect(hwnd, &rect); + + resize_frame_rect(hwnd, &rect); +} + + +static HHOOK hcbthook; +static ChildWnd* newchild = NULL; + +static LRESULT CALLBACK CBTProc(int code, WPARAM wparam, LPARAM lparam) +{ + if (code==HCBT_CREATEWND && newchild) { + ChildWnd* child = newchild; + newchild = NULL; + + child->hwnd = (HWND) wparam; + SetWindowLongPtr(child->hwnd, GWLP_USERDATA, (LPARAM)child); + } + + return CallNextHookEx(hcbthook, code, wparam, lparam); +} + +static HWND create_child_window(ChildWnd* child) +{ + MDICREATESTRUCT mcs; + int idx; + + mcs.szClass = sWINEFILETREE; + mcs.szTitle = (LPTSTR)child->path; + mcs.hOwner = Globals.hInstance; + mcs.x = child->pos.rcNormalPosition.left; + mcs.y = child->pos.rcNormalPosition.top; + mcs.cx = child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left; + mcs.cy = child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top; + mcs.style = 0; + mcs.lParam = 0; + + hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId()); + + newchild = child; + child->hwnd = (HWND) SendMessage(Globals.hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs); + if (!child->hwnd) { + UnhookWindowsHookEx(hcbthook); + return 0; + } + + UnhookWindowsHookEx(hcbthook); + + (void)ListBox_SetItemHeight(child->left.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3)); + (void)ListBox_SetItemHeight(child->right.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3)); + + idx = ListBox_FindItemData(child->left.hwnd, 0, child->left.cur); + (void)ListBox_SetCurSel(child->left.hwnd, idx); + + return child->hwnd; +} + + +struct ExecuteDialog { + TCHAR cmd[MAX_PATH]; + int cmdshow; +}; + +static INT_PTR CALLBACK ExecuteDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + static struct ExecuteDialog* dlg; + + switch(nmsg) { + case WM_INITDIALOG: + dlg = (struct ExecuteDialog*) lparam; + return 1; + + case WM_COMMAND: { + int id = (int)wparam; + + if (id == IDOK) { + GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH); + dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED? + SW_SHOWMINIMIZED: SW_SHOWNORMAL; + EndDialog(hwnd, id); + } else if (id == IDCANCEL) + EndDialog(hwnd, id); + + return 1;} + } + + return 0; +} + + +static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN]; + + switch(nmsg) { + case WM_INITDIALOG: + SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); + SetWindowText(GetDlgItem(hwnd, 201), (LPCTSTR)lparam); + return 1; + + case WM_COMMAND: { + int id = (int)wparam; + + switch(id) { + case IDOK: { + LPTSTR dest = (LPTSTR) GetWindowLongPtr(hwnd, GWLP_USERDATA); + GetWindowText(GetDlgItem(hwnd, 201), dest, MAX_PATH); + EndDialog(hwnd, id); + break;} + + case IDCANCEL: + EndDialog(hwnd, id); + break; + + case 254: + MessageBox(hwnd, RS(b1,IDS_NO_IMPL), RS(b2,IDS_WINEFILE), MB_OK); + break; + } + + return 1; + } + } + + return 0; +} + + +struct FilterDialog { + TCHAR pattern[MAX_PATH]; + int flags; +}; + +static INT_PTR CALLBACK FilterDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + static struct FilterDialog* dlg; + + switch(nmsg) { + case WM_INITDIALOG: + dlg = (struct FilterDialog*) lparam; + SetWindowText(GetDlgItem(hwnd, IDC_VIEW_PATTERN), dlg->pattern); + Button_SetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_DIRECTORIES), (dlg->flags&TF_DIRECTORIES? BST_CHECKED: BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_PROGRAMS), dlg->flags&TF_PROGRAMS? BST_CHECKED: BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_DOCUMENTS), dlg->flags&TF_DOCUMENTS? BST_CHECKED: BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_OTHERS), dlg->flags&TF_OTHERS? BST_CHECKED: BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_HIDDEN), dlg->flags&TF_HIDDEN? BST_CHECKED: BST_UNCHECKED); + return 1; + + case WM_COMMAND: { + int id = (int)wparam; + + if (id == IDOK) { + int flags = 0; + + GetWindowText(GetDlgItem(hwnd, IDC_VIEW_PATTERN), dlg->pattern, MAX_PATH); + + flags |= Button_GetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_DIRECTORIES))&BST_CHECKED? TF_DIRECTORIES: 0; + flags |= Button_GetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_PROGRAMS))&BST_CHECKED? TF_PROGRAMS: 0; + flags |= Button_GetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_DOCUMENTS))&BST_CHECKED? TF_DOCUMENTS: 0; + flags |= Button_GetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_OTHERS))&BST_CHECKED? TF_OTHERS: 0; + flags |= Button_GetCheck(GetDlgItem(hwnd,IDC_VIEW_TYPE_HIDDEN))&BST_CHECKED? TF_HIDDEN: 0; + + dlg->flags = flags; + + EndDialog(hwnd, id); + } else if (id == IDCANCEL) + EndDialog(hwnd, id); + + return 1;} + } + + return 0; +} + + +struct PropertiesDialog { + TCHAR path[MAX_PATH]; + Entry entry; + void* pVersionData; +}; + +/* Structure used to store enumerated languages and code pages. */ +struct LANGANDCODEPAGE { + WORD wLanguage; + WORD wCodePage; +} *lpTranslate; + +static LPCSTR InfoStrings[] = { + "Comments", + "CompanyName", + "FileDescription", + "FileVersion", + "InternalName", + "LegalCopyright", + "LegalTrademarks", + "OriginalFilename", + "PrivateBuild", + "ProductName", + "ProductVersion", + "SpecialBuild", + NULL +}; + +static void PropDlg_DisplayValue(HWND hlbox, HWND hedit) +{ + int idx = ListBox_GetCurSel(hlbox); + + if (idx != LB_ERR) { + LPCTSTR pValue = (LPCTSTR) ListBox_GetItemData(hlbox, idx); + + if (pValue) + SetWindowText(hedit, pValue); + } +} + +static void CheckForFileInfo(struct PropertiesDialog* dlg, HWND hwnd, LPCTSTR strFilename) +{ + static TCHAR sBackSlash[] = {'\\','\0'}; + static TCHAR sTranslation[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n','\0'}; + static TCHAR sStringFileInfo[] = {'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o','\\', + '%','0','4','x','%','0','4','x','\\','%','s','\0'}; + DWORD dwVersionDataLen = GetFileVersionInfoSize((LPTSTR)strFilename, NULL); /* VC6 and MinGW headers use LPTSTR instead of LPCTSTR */ + + if (dwVersionDataLen) { + dlg->pVersionData = malloc(dwVersionDataLen); + + if (GetFileVersionInfo((LPTSTR)strFilename, 0, dwVersionDataLen, dlg->pVersionData)) { /* VC6 and MinGW headers use LPTSTR instead of LPCTSTR */ + LPVOID pVal; + UINT nValLen; + + if (VerQueryValue(dlg->pVersionData, sBackSlash, &pVal, &nValLen)) { + if (nValLen == sizeof(VS_FIXEDFILEINFO)) { + VS_FIXEDFILEINFO* pFixedFileInfo = (VS_FIXEDFILEINFO*)pVal; + char buffer[BUFFER_LEN]; + + sprintf(buffer, "%d.%d.%d.%d", + HIWORD(pFixedFileInfo->dwFileVersionMS), LOWORD(pFixedFileInfo->dwFileVersionMS), + HIWORD(pFixedFileInfo->dwFileVersionLS), LOWORD(pFixedFileInfo->dwFileVersionLS)); + + SetDlgItemTextA(hwnd, IDC_STATIC_PROP_VERSION, buffer); + } + } + + /* Read the list of languages and code pages. */ + if (VerQueryValue(dlg->pVersionData, sTranslation, &pVal, &nValLen)) { + struct LANGANDCODEPAGE* pTranslate = (struct LANGANDCODEPAGE*)pVal; + struct LANGANDCODEPAGE* pEnd = (struct LANGANDCODEPAGE*)((LPBYTE)pVal+nValLen); + + HWND hlbox = GetDlgItem(hwnd, IDC_LIST_PROP_VERSION_TYPES); + + /* Read the file description for each language and code page. */ + for(; pTranslatewLanguage, pTranslate->wCodePage, infoStr); + + /* Retrieve file description for language and code page */ + if (VerQueryValue(dlg->pVersionData, subblock, (PVOID)&pTxt, &nValLen)) { + int idx = ListBox_AddString(hlbox, infoStr); + (void)ListBox_SetItemData(hlbox, idx, pTxt); + } + } + } + + (void)ListBox_SetCurSel(hlbox, 0); + + PropDlg_DisplayValue(hlbox, GetDlgItem(hwnd,IDC_LIST_PROP_VERSION_VALUES)); + } + } + } +} + +static INT_PTR CALLBACK PropertiesDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + static struct PropertiesDialog* dlg; + + switch(nmsg) { + case WM_INITDIALOG: { + const static TCHAR sByteFmt[] = {'%','s',' ','B','y','t','e','s','\0'}; + TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN]; + LPWIN32_FIND_DATA pWFD; + ULONGLONG size; + + dlg = (struct PropertiesDialog*) lparam; + pWFD = (LPWIN32_FIND_DATA) &dlg->entry.data; + + GetWindowText(hwnd, b1, MAX_PATH); + wsprintf(b2, b1, pWFD->cFileName); + SetWindowText(hwnd, b2); + + format_date(&pWFD->ftLastWriteTime, b1, COL_DATE|COL_TIME); + SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_LASTCHANGE), b1); + + size = ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow; + _stprintf(b1, sLongNumFmt, size); + wsprintf(b2, sByteFmt, b1); + SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2); + + SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_FILENAME), pWFD->cFileName); + SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_PATH), dlg->path); + + Button_SetCheck(GetDlgItem(hwnd,IDC_CHECK_READONLY), (pWFD->dwFileAttributes&FILE_ATTRIBUTE_READONLY? BST_CHECKED: BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(hwnd,IDC_CHECK_ARCHIVE), (pWFD->dwFileAttributes&FILE_ATTRIBUTE_ARCHIVE? BST_CHECKED: BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(hwnd,IDC_CHECK_COMPRESSED), (pWFD->dwFileAttributes&FILE_ATTRIBUTE_COMPRESSED? BST_CHECKED: BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(hwnd,IDC_CHECK_HIDDEN), (pWFD->dwFileAttributes&FILE_ATTRIBUTE_HIDDEN? BST_CHECKED: BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(hwnd,IDC_CHECK_SYSTEM), (pWFD->dwFileAttributes&FILE_ATTRIBUTE_SYSTEM? BST_CHECKED: BST_UNCHECKED)); + + CheckForFileInfo(dlg, hwnd, dlg->path); + return 1;} + + case WM_COMMAND: { + int id = (int)wparam; + + switch(HIWORD(wparam)) { + case LBN_SELCHANGE: { + HWND hlbox = GetDlgItem(hwnd, IDC_LIST_PROP_VERSION_TYPES); + PropDlg_DisplayValue(hlbox, GetDlgItem(hwnd,IDC_LIST_PROP_VERSION_VALUES)); + break; + } + + case BN_CLICKED: + if (id==IDOK || id==IDCANCEL) + EndDialog(hwnd, id); + } + + return 1;} + + case WM_NCDESTROY: + free(dlg->pVersionData); + dlg->pVersionData = NULL; + break; + } + + return 0; +} + +static void show_properties_dlg(Entry* entry, HWND hwnd) +{ + struct PropertiesDialog dlg; + + memset(&dlg, 0, sizeof(struct PropertiesDialog)); + get_path(entry, dlg.path); + memcpy(&dlg.entry, entry, sizeof(Entry)); + + DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_PROPERTIES), hwnd, PropertiesDialogDlgProc, (LPARAM)&dlg); +} + + +#ifndef _NO_EXTENSIONS + +static struct FullScreenParameters { + BOOL mode; + RECT orgPos; + BOOL wasZoomed; +} g_fullscreen = { + FALSE, /* mode */ + {0, 0, 0, 0}, + FALSE +}; + +static void frame_get_clientspace(HWND hwnd, PRECT prect) +{ + RECT rt; + + if (!IsIconic(hwnd)) + GetClientRect(hwnd, prect); + else { + WINDOWPLACEMENT wp; + + GetWindowPlacement(hwnd, &wp); + + prect->left = prect->top = 0; + prect->right = wp.rcNormalPosition.right-wp.rcNormalPosition.left- + 2*(GetSystemMetrics(SM_CXSIZEFRAME)+GetSystemMetrics(SM_CXEDGE)); + prect->bottom = wp.rcNormalPosition.bottom-wp.rcNormalPosition.top- + 2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))- + GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE); + } + + if (IsWindowVisible(Globals.htoolbar)) { + GetClientRect(Globals.htoolbar, &rt); + prect->top += rt.bottom+2; + } + + if (IsWindowVisible(Globals.hdrivebar)) { + GetClientRect(Globals.hdrivebar, &rt); + prect->top += rt.bottom+2; + } + + if (IsWindowVisible(Globals.hstatusbar)) { + GetClientRect(Globals.hstatusbar, &rt); + prect->bottom -= rt.bottom; + } +} + +static BOOL toggle_fullscreen(HWND hwnd) +{ + RECT rt; + + if ((g_fullscreen.mode=!g_fullscreen.mode)) { + GetWindowRect(hwnd, &g_fullscreen.orgPos); + g_fullscreen.wasZoomed = IsZoomed(hwnd); + + (void)Frame_CalcFrameClient(hwnd, &rt); + ClientToScreen(hwnd, (LPPOINT)&rt.left); + ClientToScreen(hwnd, (LPPOINT)&rt.right); + + rt.left = g_fullscreen.orgPos.left-rt.left; + rt.top = g_fullscreen.orgPos.top-rt.top; + rt.right = GetSystemMetrics(SM_CXSCREEN)+g_fullscreen.orgPos.right-rt.right; + rt.bottom = GetSystemMetrics(SM_CYSCREEN)+g_fullscreen.orgPos.bottom-rt.bottom; + + MoveWindow(hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE); + } else { + MoveWindow(hwnd, g_fullscreen.orgPos.left, g_fullscreen.orgPos.top, + g_fullscreen.orgPos.right-g_fullscreen.orgPos.left, + g_fullscreen.orgPos.bottom-g_fullscreen.orgPos.top, TRUE); + + if (g_fullscreen.wasZoomed) + ShowWindow(hwnd, WS_MAXIMIZE); + } + + return g_fullscreen.mode; +} + +static void fullscreen_move(HWND hwnd) +{ + RECT rt, pos; + GetWindowRect(hwnd, &pos); + + (void)Frame_CalcFrameClient(hwnd, &rt); + ClientToScreen(hwnd, (LPPOINT)&rt.left); + ClientToScreen(hwnd, (LPPOINT)&rt.right); + + rt.left = pos.left-rt.left; + rt.top = pos.top-rt.top; + rt.right = GetSystemMetrics(SM_CXSCREEN)+pos.right-rt.right; + rt.bottom = GetSystemMetrics(SM_CYSCREEN)+pos.bottom-rt.bottom; + + MoveWindow(hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE); +} + +#endif + + +static void toggle_child(HWND hwnd, UINT cmd, HWND hchild) +{ + BOOL vis = IsWindowVisible(hchild); + + CheckMenuItem(Globals.hMenuOptions, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED); + + ShowWindow(hchild, vis?SW_HIDE:SW_SHOW); + +#ifndef _NO_EXTENSIONS + if (g_fullscreen.mode) + fullscreen_move(hwnd); +#endif + + resize_frame_client(hwnd); +} + +static BOOL activate_drive_window(LPCTSTR path) +{ + TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE]; + HWND child_wnd; + + _tsplitpath(path, drv1, 0, 0, 0); + + /* search for a already open window for the same drive */ + for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) { + ChildWnd* child = (ChildWnd*) GetWindowLongPtr(child_wnd, GWLP_USERDATA); + + if (child) { + _tsplitpath(child->root.path, drv2, 0, 0, 0); + + if (!lstrcmpi(drv2, drv1)) { + SendMessage(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0); + + if (IsMinimized(child_wnd)) + ShowWindow(child_wnd, SW_SHOWNORMAL); + + return TRUE; + } + } + } + + return FALSE; +} + +static BOOL activate_fs_window(LPCTSTR filesys) +{ + HWND child_wnd; + + /* search for a already open window of the given file system name */ + for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) { + ChildWnd* child = (ChildWnd*) GetWindowLongPtr(child_wnd, GWLP_USERDATA); + + if (child) { + if (!lstrcmpi(child->root.fs, filesys)) { + SendMessage(Globals.hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0); + + if (IsMinimized(child_wnd)) + ShowWindow(child_wnd, SW_SHOWNORMAL); + + return TRUE; + } + } + } + + return FALSE; +} + +static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN]; + + switch(nmsg) { + case WM_CLOSE: + DestroyWindow(hwnd); + + /* clear handle variables */ + Globals.hMenuFrame = 0; + Globals.hMenuView = 0; + Globals.hMenuOptions = 0; + Globals.hMainWnd = 0; + Globals.hmdiclient = 0; + Globals.hdrivebar = 0; + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + case WM_INITMENUPOPUP: { + HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0); + + if (!SendMessage(hwndClient, WM_INITMENUPOPUP, wparam, lparam)) + return 0; + break;} + + case WM_COMMAND: { + UINT cmd = LOWORD(wparam); + HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0); + + if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wparam, lparam)) + break; + + if (cmd>=ID_DRIVE_FIRST && cmd<=ID_DRIVE_FIRST+0xFF) { + TCHAR drv[_MAX_DRIVE], path[MAX_PATH]; + ChildWnd* child; + LPCTSTR root = Globals.drives; + int i; + + for(i=cmd-ID_DRIVE_FIRST; i--; root++) + while(*root) + root++; + + if (activate_drive_window(root)) + return 0; + + _tsplitpath(root, drv, 0, 0, 0); + + if (!SetCurrentDirectory(drv)) { + display_error(hwnd, GetLastError()); + return 0; + } + + GetCurrentDirectory(MAX_PATH, path); /*TODO: store last directory per drive */ + child = alloc_child_window(path, NULL, hwnd); + + if (!create_child_window(child)) + free(child); + } else switch(cmd) { + case ID_FILE_EXIT: + SendMessage(hwnd, WM_CLOSE, 0, 0); + break; + + case ID_WINDOW_NEW: { + TCHAR path[MAX_PATH]; + ChildWnd* child; + + GetCurrentDirectory(MAX_PATH, path); + child = alloc_child_window(path, NULL, hwnd); + + if (!create_child_window(child)) + free(child); + break;} + + case ID_REFRESH: + refresh_drives(); + break; + + case ID_WINDOW_CASCADE: + SendMessage(Globals.hmdiclient, WM_MDICASCADE, 0, 0); + break; + + case ID_WINDOW_TILE_HORZ: + SendMessage(Globals.hmdiclient, WM_MDITILE, MDITILE_HORIZONTAL, 0); + break; + + case ID_WINDOW_TILE_VERT: + SendMessage(Globals.hmdiclient, WM_MDITILE, MDITILE_VERTICAL, 0); + break; + + case ID_WINDOW_ARRANGE: + SendMessage(Globals.hmdiclient, WM_MDIICONARRANGE, 0, 0); + break; + + case ID_SELECT_FONT: { + TCHAR dlg_name[BUFFER_LEN], dlg_info[BUFFER_LEN]; + CHOOSEFONT chFont; + LOGFONT lFont; + + HDC hdc = GetDC(hwnd); + chFont.lStructSize = sizeof(CHOOSEFONT); + chFont.hwndOwner = hwnd; + chFont.hDC = NULL; + chFont.lpLogFont = &lFont; + chFont.Flags = CF_SCREENFONTS | CF_FORCEFONTEXIST | CF_LIMITSIZE | CF_NOSCRIPTSEL; + chFont.rgbColors = RGB(0,0,0); + chFont.lCustData = 0; + chFont.lpfnHook = NULL; + chFont.lpTemplateName = NULL; + chFont.hInstance = Globals.hInstance; + chFont.lpszStyle = NULL; + chFont.nFontType = SIMULATED_FONTTYPE; + chFont.nSizeMin = 0; + chFont.nSizeMax = 24; + + if (ChooseFont(&chFont)) { + HWND childWnd; + HFONT hFontOld; + + DeleteObject(Globals.hfont); + Globals.hfont = CreateFontIndirect(&lFont); + hFontOld = SelectFont(hdc, Globals.hfont); + GetTextExtentPoint32(hdc, sSpace, 1, &Globals.spaceSize); + + /* change font in all open child windows */ + for(childWnd=GetWindow(Globals.hmdiclient,GW_CHILD); childWnd; childWnd=GetNextWindow(childWnd,GW_HWNDNEXT)) { + ChildWnd* child = (ChildWnd*) GetWindowLongPtr(childWnd, GWLP_USERDATA); + SetWindowFont(child->left.hwnd, Globals.hfont, TRUE); + SetWindowFont(child->right.hwnd, Globals.hfont, TRUE); + (void)ListBox_SetItemHeight(child->left.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3)); + (void)ListBox_SetItemHeight(child->right.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3)); + InvalidateRect(child->left.hwnd, NULL, TRUE); + InvalidateRect(child->right.hwnd, NULL, TRUE); + } + + (void)SelectFont(hdc, hFontOld); + } + else if (CommDlgExtendedError()) { + LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN); + LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, BUFFER_LEN); + MessageBox(hwnd, dlg_info, dlg_name, MB_OK); + } + + ReleaseDC(hwnd, hdc); + break; + } + + case ID_VIEW_TOOL_BAR: + toggle_child(hwnd, cmd, Globals.htoolbar); + break; + + case ID_VIEW_DRIVE_BAR: + toggle_child(hwnd, cmd, Globals.hdrivebar); + break; + + case ID_VIEW_STATUSBAR: + toggle_child(hwnd, cmd, Globals.hstatusbar); + break; + + case ID_EXECUTE: { + struct ExecuteDialog dlg; + + memset(&dlg, 0, sizeof(struct ExecuteDialog)); + + if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_EXECUTE), hwnd, ExecuteDialogDlgProc, (LPARAM)&dlg) == IDOK) { + HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow); + + if ((int)hinst <= 32) + display_error(hwnd, GetLastError()); + } + break;} + + case ID_CONNECT_NETWORK_DRIVE: { + DWORD ret = WNetConnectionDialog(hwnd, RESOURCETYPE_DISK); + if (ret == NO_ERROR) + refresh_drives(); + else if (ret != (DWORD)-1) { + if (ret == ERROR_EXTENDED_ERROR) + display_network_error(hwnd); + else + display_error(hwnd, ret); + } + break;} + + case ID_DISCONNECT_NETWORK_DRIVE: { + DWORD ret = WNetDisconnectDialog(hwnd, RESOURCETYPE_DISK); + if (ret == NO_ERROR) + refresh_drives(); + else if (ret != (DWORD)-1) { + if (ret == ERROR_EXTENDED_ERROR) + display_network_error(hwnd); + else + display_error(hwnd, ret); + } + break;} + +#ifndef __MINGW32__ /* SHFormatDrive missing in MinGW (as of 13.5.2005) */ + case ID_FORMAT_DISK: { + UINT sem_org = SetErrorMode(0); /* Get the current Error Mode settings. */ + SetErrorMode(sem_org & ~SEM_FAILCRITICALERRORS); /* Force O/S to handle */ + SHFormatDrive(hwnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0); + SetErrorMode(sem_org); /* Put it back the way it was. */ + break;} +#endif + + case ID_HELP: + WinHelp(hwnd, RS(b1,IDS_WINEFILE), HELP_INDEX, 0); + break; + +#ifndef _NO_EXTENSIONS + case ID_VIEW_FULLSCREEN: + CheckMenuItem(Globals.hMenuOptions, cmd, toggle_fullscreen(hwnd)?MF_CHECKED:0); + break; + +#ifdef __WINE__ + case ID_DRIVE_UNIX_FS: { + TCHAR path[MAX_PATH]; +#ifdef UNICODE + char cpath[MAX_PATH]; +#endif + ChildWnd* child; + + if (activate_fs_window(RS(b1,IDS_UNIXFS))) + break; + + +#ifdef UNICODE + getcwd(cpath, MAX_PATH); + MultiByteToWideChar(CP_UNIXCP, 0, cpath, -1, path, MAX_PATH); +#else + getcwd(path, MAX_PATH); +#endif + child = alloc_child_window(path, NULL, hwnd); + + if (!create_child_window(child)) + free(child); + break;} +#endif + +#ifdef _SHELL_FOLDERS + case ID_DRIVE_SHELL_NS: { + TCHAR path[MAX_PATH]; + ChildWnd* child; + + if (activate_fs_window(RS(b1,IDS_SHELL))) + break; + + GetCurrentDirectory(MAX_PATH, path); + child = alloc_child_window(path, get_path_pidl(path,hwnd), hwnd); + + if (!create_child_window(child)) + free(child); + break;} +#endif +#endif + + /*TODO: There are even more menu items! */ + +#ifndef _NO_EXTENSIONS +#ifdef __WINE__ + case ID_LICENSE: + WineLicense(Globals.hMainWnd); + break; + + case ID_NO_WARRANTY: + WineWarranty(Globals.hMainWnd); + break; + + case ID_ABOUT_WINE: + ShellAbout(hwnd, RS(b2,IDS_WINE), RS(b1,IDS_WINEFILE), 0); + break; +#endif + + case ID_ABOUT: + ShellAbout(hwnd, RS(b1,IDS_WINEFILE), NULL, 0); + break; +#endif /* _NO_EXTENSIONS */ + + default: + /*TODO: if (wParam >= PM_FIRST_LANGUAGE && wParam <= PM_LAST_LANGUAGE) + STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE); + else */if ((cmd=IDW_FIRST_CHILD+0x100) && + (cmdSC_RESTORE)) + MessageBox(hwnd, RS(b2,IDS_NO_IMPL), RS(b1,IDS_WINEFILE), MB_OK); + + return DefFrameProc(hwnd, Globals.hmdiclient, nmsg, wparam, lparam); + } + break;} + + case WM_SIZE: + resize_frame(hwnd, LOWORD(lparam), HIWORD(lparam)); + break; /* do not pass message to DefFrameProc */ + +#ifndef _NO_EXTENSIONS + case WM_GETMINMAXINFO: { + LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam; + + lpmmi->ptMaxTrackSize.x <<= 1;/*2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN */ + lpmmi->ptMaxTrackSize.y <<= 1;/*2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN */ + break;} + + case FRM_CALC_CLIENT: + frame_get_clientspace(hwnd, (PRECT)lparam); + return TRUE; +#endif /* _NO_EXTENSIONS */ + + default: + return DefFrameProc(hwnd, Globals.hmdiclient, nmsg, wparam, lparam); + } + + return 0; +} + + +static TCHAR g_pos_names[COLUMNS][20] = { + {'\0'} /* symbol */ +}; + +static const int g_pos_align[] = { + 0, + HDF_LEFT, /* Name */ + HDF_RIGHT, /* Size */ + HDF_LEFT, /* CDate */ +#ifndef _NO_EXTENSIONS + HDF_LEFT, /* ADate */ + HDF_LEFT, /* MDate */ + HDF_LEFT, /* Index */ + HDF_CENTER, /* Links */ +#endif + HDF_CENTER, /* Attributes */ +#ifndef _NO_EXTENSIONS + HDF_LEFT /* Security */ +#endif +}; + +static void resize_tree(ChildWnd* child, int cx, int cy) +{ + HDWP hdwp = BeginDeferWindowPos(4); + RECT rt; + + rt.left = 0; + rt.top = 0; + rt.right = cx; + rt.bottom = cy; + + cx = child->split_pos + SPLIT_WIDTH/2; + +#ifndef _NO_EXTENSIONS + { + WINDOWPOS wp; + HD_LAYOUT hdl; + + hdl.prc = &rt; + hdl.pwpos = ℘ + + (void)Header_Layout(child->left.hwndHeader, &hdl); + + DeferWindowPos(hdwp, child->left.hwndHeader, wp.hwndInsertAfter, + wp.x-1, wp.y, child->split_pos-SPLIT_WIDTH/2+1, wp.cy, wp.flags); + DeferWindowPos(hdwp, child->right.hwndHeader, wp.hwndInsertAfter, + rt.left+cx+1, wp.y, wp.cx-cx+2, wp.cy, wp.flags); + } +#endif /* _NO_EXTENSIONS */ + + DeferWindowPos(hdwp, child->left.hwnd, 0, rt.left, rt.top, child->split_pos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); + DeferWindowPos(hdwp, child->right.hwnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); + + EndDeferWindowPos(hdwp); +} + + +#ifndef _NO_EXTENSIONS + +static HWND create_header(HWND parent, Pane* pane, int id) +{ + HD_ITEM hdi; + int idx; + + HWND hwnd = CreateWindow(WC_HEADER, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ/*TODO: |HDS_BUTTONS + sort orders*/, + 0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0); + if (!hwnd) + return 0; + + SetWindowFont(hwnd, GetStockObject(DEFAULT_GUI_FONT), FALSE); + + hdi.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT; + + for(idx=0; idxwidths[idx]; + (void)Header_InsertItem(hwnd, idx, &hdi); + } + + return hwnd; +} + +#endif /* _NO_EXTENSIONS */ + + +static void init_output(HWND hwnd) +{ + const static TCHAR s1000[] = {'1','0','0','0','\0'}; + + TCHAR b[16]; + HFONT old_font; + HDC hdc = GetDC(hwnd); + + if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, s1000, 0, b, 16) > 4) + Globals.num_sep = b[1]; + else + Globals.num_sep = TEXT('.'); + + old_font = SelectFont(hdc, Globals.hfont); + GetTextExtentPoint32(hdc, sSpace, 1, &Globals.spaceSize); + (void)SelectFont(hdc, old_font); + ReleaseDC(hwnd, hdc); +} + +static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol); + + +/* calculate preferred width for all visible columns */ + +static BOOL calc_widths(Pane* pane, BOOL anyway) +{ + int col, x, cx, spc=3*Globals.spaceSize.cx; + int entries = ListBox_GetCount(pane->hwnd); + int orgWidths[COLUMNS]; + int orgPositions[COLUMNS+1]; + HFONT hfontOld; + HDC hdc; + int cnt; + + if (!anyway) { + memcpy(orgWidths, pane->widths, sizeof(orgWidths)); + memcpy(orgPositions, pane->positions, sizeof(orgPositions)); + } + + for(col=0; colwidths[col] = 0; + + hdc = GetDC(pane->hwnd); + hfontOld = SelectFont(hdc, Globals.hfont); + + for(cnt=0; cnthwnd, cnt); + + DRAWITEMSTRUCT dis; + + dis.CtlType = 0; + dis.CtlID = 0; + dis.itemID = 0; + dis.itemAction = 0; + dis.itemState = 0; + dis.hwndItem = pane->hwnd; + dis.hDC = hdc; + dis.rcItem.left = 0; + dis.rcItem.top = 0; + dis.rcItem.right = 0; + dis.rcItem.bottom = 0; + /*dis.itemData = 0; */ + + draw_item(pane, &dis, entry, COLUMNS); + } + + SelectObject(hdc, hfontOld); + ReleaseDC(pane->hwnd, hdc); + + x = 0; + for(col=0; colpositions[col] = x; + cx = pane->widths[col]; + + if (cx) { + cx += spc; + + if (cx < IMAGE_WIDTH) + cx = IMAGE_WIDTH; + + pane->widths[col] = cx; + } + + x += cx; + } + + pane->positions[COLUMNS] = x; + + ListBox_SetHorizontalExtent(pane->hwnd, x); + + /* no change? */ + if (!memcmp(orgWidths, pane->widths, sizeof(orgWidths))) + return FALSE; + + /* don't move, if only collapsing an entry */ + if (!anyway && pane->widths[0]widths+1, sizeof(orgWidths)-sizeof(int))) { + pane->widths[0] = orgWidths[0]; + memcpy(pane->positions, orgPositions, sizeof(orgPositions)); + + return FALSE; + } + + InvalidateRect(pane->hwnd, 0, TRUE); + + return TRUE; +} + + +/* calculate one preferred column width */ + +static void calc_single_width(Pane* pane, int col) +{ + HFONT hfontOld; + int x, cx; + int entries = ListBox_GetCount(pane->hwnd); + int cnt; + HDC hdc; + + pane->widths[col] = 0; + + hdc = GetDC(pane->hwnd); + hfontOld = SelectFont(hdc, Globals.hfont); + + for(cnt=0; cnthwnd, cnt); + DRAWITEMSTRUCT dis; + + dis.CtlType = 0; + dis.CtlID = 0; + dis.itemID = 0; + dis.itemAction = 0; + dis.itemState = 0; + dis.hwndItem = pane->hwnd; + dis.hDC = hdc; + dis.rcItem.left = 0; + dis.rcItem.top = 0; + dis.rcItem.right = 0; + dis.rcItem.bottom = 0; + /*dis.itemData = 0; */ + + draw_item(pane, &dis, entry, col); + } + + SelectObject(hdc, hfontOld); + ReleaseDC(pane->hwnd, hdc); + + cx = pane->widths[col]; + + if (cx) { + cx += 3*Globals.spaceSize.cx; + + if (cx < IMAGE_WIDTH) + cx = IMAGE_WIDTH; + } + + pane->widths[col] = cx; + + x = pane->positions[col] + cx; + + for(; colpositions[++col] = x; + x += pane->widths[col]; + } + + ListBox_SetHorizontalExtent(pane->hwnd, x); +} + + +static BOOL pattern_match(LPCTSTR str, LPCTSTR pattern) +{ + for( ; *str&&*pattern; str++,pattern++) { + if (*pattern == '*') { + do pattern++; + while(*pattern == '*'); + + if (!*pattern) + return TRUE; + + for(; *str; str++) + if (*str==*pattern && pattern_match(str, pattern)) + return TRUE; + + return FALSE; + } + else if (*str!=*pattern && *pattern!='?') + return FALSE; + } + + if (*str || *pattern) + if (*pattern!='*' || pattern[1]!='\0') + return FALSE; + + return TRUE; +} + +static BOOL pattern_imatch(LPCTSTR str, LPCTSTR pattern) +{ + TCHAR b1[BUFFER_LEN], b2[BUFFER_LEN]; + + lstrcpy(b1, str); + lstrcpy(b2, pattern); + CharUpper(b1); + CharUpper(b2); + + return pattern_match(b1, b2); +} + + +enum FILE_TYPE { + FT_OTHER = 0, + FT_EXECUTABLE = 1, + FT_DOCUMENT = 2 +}; + +static enum FILE_TYPE get_file_type(LPCTSTR filename); + + +/* insert listbox entries after index idx */ + +static int insert_entries(Pane* pane, Entry* dir, LPCTSTR pattern, int filter_flags, int idx) +{ + Entry* entry = dir; + + if (!entry) + return idx; + + ShowWindow(pane->hwnd, SW_HIDE); + + for(; entry; entry=entry->next) { +#ifndef _LEFT_FILES + if (pane->treePane && !(entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) + continue; +#endif + + if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + /* don't display entries "." and ".." in the left pane */ + if (pane->treePane && entry->data.cFileName[0]==TEXT('.')) + if ( + #ifndef _NO_EXTENSIONS + entry->data.cFileName[1]==TEXT('\0') || + #endif + (entry->data.cFileName[1]==TEXT('.') && entry->data.cFileName[2]==TEXT('\0'))) + continue; + + /* filter directories in right pane */ + if (!pane->treePane && !(filter_flags&TF_DIRECTORIES)) + continue; + } + + /* filter using the file name pattern */ + if (pattern) + if (!pattern_imatch(entry->data.cFileName, pattern)) + continue; + + /* filter system and hidden files */ + if (!(filter_flags&TF_HIDDEN) && (entry->data.dwFileAttributes&(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) + continue; + + /* filter looking at the file type */ + if ((filter_flags&(TF_PROGRAMS|TF_DOCUMENTS|TF_OTHERS)) != (TF_PROGRAMS|TF_DOCUMENTS|TF_OTHERS)) + switch(get_file_type(entry->data.cFileName)) { + case FT_EXECUTABLE: + if (!(filter_flags & TF_PROGRAMS)) + continue; + break; + + case FT_DOCUMENT: + if (!(filter_flags & TF_DOCUMENTS)) + continue; + break; + + default: /* TF_OTHERS */ + if (!(filter_flags & TF_OTHERS)) + continue; + } + + if (idx != -1) + idx++; + + (void)ListBox_InsertItemData(pane->hwnd, idx, entry); + + if (pane->treePane && entry->expanded) + idx = insert_entries(pane, entry->down, pattern, filter_flags, idx); + } + + ShowWindow(pane->hwnd, SW_SHOW); + + return idx; +} + + +static void format_bytes(LPTSTR buffer, LONGLONG bytes) +{ + const static TCHAR sFmtGB[] = {'%', '.', '1', 'f', ' ', 'G', 'B', '\0'}; + const static TCHAR sFmtMB[] = {'%', '.', '1', 'f', ' ', 'M', 'B', '\0'}; + const static TCHAR sFmtkB[] = {'%', '.', '1', 'f', ' ', 'k', 'B', '\0'}; + + float fBytes = (float)bytes; + +#ifdef __WINE__ /* work around for incorrect implementation of wsprintf()/_stprintf() in WINE */ + if (bytes >= 1073741824) /* 1 GB */ + wsprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f); + else if (bytes >= 1048576) /* 1 MB */ + wsprintf(buffer, sFmtMB, fBytes/1048576.f+.5f); + else if (bytes >= 1024) /* 1 kB */ + wsprintf(buffer, sFmtkB, fBytes/1024.f+.5f); +#else + if (bytes >= 1073741824) /* 1 GB */ + _stprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f); + else if (bytes >= 1048576) /* 1 MB */ + _stprintf(buffer, sFmtMB, fBytes/1048576.f+.5f); + else if (bytes >= 1024) /* 1 kB */ + _stprintf(buffer, sFmtkB, fBytes/1024.f+.5f); +#endif + else + _stprintf(buffer, sLongNumFmt, bytes); +} + +static void set_space_status(void) +{ + ULARGE_INTEGER ulFreeBytesToCaller, ulTotalBytes, ulFreeBytes; + TCHAR fmt[64], b1[64], b2[64], buffer[BUFFER_LEN]; + + if (GetDiskFreeSpaceEx(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) { + format_bytes(b1, ulFreeBytesToCaller.QuadPart); + format_bytes(b2, ulTotalBytes.QuadPart); + wsprintf(buffer, RS(fmt,IDS_FREE_SPACE_FMT), b1, b2); + } else + lstrcpy(buffer, sQMarks); + + SendMessage(Globals.hstatusbar, SB_SETTEXT, 0, (LPARAM)buffer); +} + + +static WNDPROC g_orgTreeWndProc; + +static void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPCTSTR pattern, int filter_flags) +{ + const static TCHAR sListBox[] = {'L','i','s','t','B','o','x','\0'}; + + static int s_init = 0; + Entry* entry = pane->root; + + pane->hwnd = CreateWindow(sListBox, sEmpty, WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL| + LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY, + 0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0); + + SetWindowLongPtr(pane->hwnd, GWLP_USERDATA, (LPARAM)pane); + g_orgTreeWndProc = SubclassWindow(pane->hwnd, TreeWndProc); + + SetWindowFont(pane->hwnd, Globals.hfont, FALSE); + + /* insert entries into listbox */ + if (entry) + insert_entries(pane, entry, pattern, filter_flags, -1); + + /* calculate column widths */ + if (!s_init) { + s_init = 1; + init_output(pane->hwnd); + } + + calc_widths(pane, TRUE); + +#ifndef _NO_EXTENSIONS + pane->hwndHeader = create_header(parent, pane, id_header); +#endif +} + + +static void InitChildWindow(ChildWnd* child) +{ + create_tree_window(child->hwnd, &child->left, IDW_TREE_LEFT, IDW_HEADER_LEFT, NULL, TF_ALL); + create_tree_window(child->hwnd, &child->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT, child->filter_pattern, child->filter_flags); +} + + +static void format_date(const FILETIME* ft, TCHAR* buffer, int visible_cols) +{ + SYSTEMTIME systime; + FILETIME lft; + int len = 0; + + *buffer = TEXT('\0'); + + if (!ft->dwLowDateTime && !ft->dwHighDateTime) + return; + + if (!FileTimeToLocalFileTime(ft, &lft)) + {err: lstrcpy(buffer,sQMarks); return;} + + if (!FileTimeToSystemTime(&lft, &systime)) + goto err; + + if (visible_cols & COL_DATE) { + len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN); + if (!len) + goto err; + } + + if (visible_cols & COL_TIME) { + if (len) + buffer[len-1] = ' '; + + buffer[len++] = ' '; + + if (!GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len)) + buffer[len] = TEXT('\0'); + } +} + + +static void calc_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str) +{ + RECT rt = {0, 0, 0, 0}; + + DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX); + + if (rt.right > pane->widths[col]) + pane->widths[col] = rt.right; +} + +static void calc_tabbed_width(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str) +{ + RECT rt = {0, 0, 0, 0}; + +/* DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2}; + DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/ + + DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8)); + /*FIXME rt (0,0) ??? */ + + if (rt.right > pane->widths[col]) + pane->widths[col] = rt.right; +} + + +static void output_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str, DWORD flags) +{ + int x = dis->rcItem.left; + RECT rt; + + rt.left = x+pane->positions[col]+Globals.spaceSize.cx; + rt.top = dis->rcItem.top; + rt.right = x+pane->positions[col+1]-Globals.spaceSize.cx; + rt.bottom = dis->rcItem.bottom; + + DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|flags); +} + +static void output_tabbed_text(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str) +{ + int x = dis->rcItem.left; + RECT rt; + + rt.left = x+pane->positions[col]+Globals.spaceSize.cx; + rt.top = dis->rcItem.top; + rt.right = x+pane->positions[col+1]-Globals.spaceSize.cx; + rt.bottom = dis->rcItem.bottom; + +/* DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2}; + DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/ + + DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8)); +} + +static void output_number(Pane* pane, LPDRAWITEMSTRUCT dis, int col, LPCTSTR str) +{ + int x = dis->rcItem.left; + RECT rt; + LPCTSTR s = str; + TCHAR b[128]; + LPTSTR d = b; + int pos; + + rt.left = x+pane->positions[col]+Globals.spaceSize.cx; + rt.top = dis->rcItem.top; + rt.right = x+pane->positions[col+1]-Globals.spaceSize.cx; + rt.bottom = dis->rcItem.bottom; + + if (*s) + *d++ = *s++; + + /* insert number separator characters */ + pos = lstrlen(s) % 3; + + while(*s) + if (pos--) + *d++ = *s++; + else { + *d++ = Globals.num_sep; + pos = 3; + } + + DrawText(dis->hDC, b, d-b, &rt, DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS); +} + + +static BOOL is_exe_file(LPCTSTR ext) +{ + static const TCHAR executable_extensions[][4] = { + {'C','O','M','\0'}, + {'E','X','E','\0'}, + {'B','A','T','\0'}, + {'C','M','D','\0'}, +#ifndef _NO_EXTENSIONS + {'C','M','M','\0'}, + {'B','T','M','\0'}, + {'A','W','K','\0'}, +#endif /* _NO_EXTENSIONS */ + {'\0'} + }; + + TCHAR ext_buffer[_MAX_EXT]; + const TCHAR (*p)[4]; + LPCTSTR s; + LPTSTR d; + + for(s=ext+1,d=ext_buffer; (*d=tolower(*s)); s++) + d++; + + for(p=executable_extensions; (*p)[0]; p++) + if (!lstrcmpi(ext_buffer, *p)) + return TRUE; + + return FALSE; +} + +static BOOL is_registered_type(LPCTSTR ext) +{ + /* check if there exists a classname for this file extension in the registry */ + if (!RegQueryValue(HKEY_CLASSES_ROOT, ext, NULL, NULL)) + return TRUE; + + return FALSE; +} + +static enum FILE_TYPE get_file_type(LPCTSTR filename) +{ + LPCTSTR ext = _tcsrchr(filename, '.'); + if (!ext) + ext = sEmpty; + + if (is_exe_file(ext)) + return FT_EXECUTABLE; + else if (is_registered_type(ext)) + return FT_DOCUMENT; + else + return FT_OTHER; +} + + +static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol) +{ + TCHAR buffer[BUFFER_LEN]; + DWORD attrs; + int visible_cols = pane->visible_cols; + COLORREF bkcolor, textcolor; + RECT focusRect = dis->rcItem; + HBRUSH hbrush; + enum IMAGE img; + int img_pos, cx; + int col = 0; + + if (entry) { + attrs = entry->data.dwFileAttributes; + + if (attrs & FILE_ATTRIBUTE_DIRECTORY) { + if (entry->data.cFileName[0]==TEXT('.') && entry->data.cFileName[1]==TEXT('.') + && entry->data.cFileName[2]==TEXT('\0')) + img = IMG_FOLDER_UP; +#ifndef _NO_EXTENSIONS + else if (entry->data.cFileName[0]==TEXT('.') && entry->data.cFileName[1]==TEXT('\0')) + img = IMG_FOLDER_CUR; +#endif + else if ( +#ifdef _NO_EXTENSIONS + entry->expanded || +#endif + (pane->treePane && (dis->itemState&ODS_FOCUS))) + img = IMG_OPEN_FOLDER; + else + img = IMG_FOLDER; + } else { + switch(get_file_type(entry->data.cFileName)) { + case FT_EXECUTABLE: img = IMG_EXECUTABLE; break; + case FT_DOCUMENT: img = IMG_DOCUMENT; break; + default: img = IMG_FILE; + } + } + } else { + attrs = 0; + img = IMG_NONE; + } + + if (pane->treePane) { + if (entry) { + img_pos = dis->rcItem.left + entry->level*(IMAGE_WIDTH+TREE_LINE_DX); + + if (calcWidthCol == -1) { + int x; + int y = dis->rcItem.top + IMAGE_HEIGHT/2; + Entry* up; + RECT rt_clip; + HRGN hrgn_org = CreateRectRgn(0, 0, 0, 0); + HRGN hrgn; + + rt_clip.left = dis->rcItem.left; + rt_clip.top = dis->rcItem.top; + rt_clip.right = dis->rcItem.left+pane->widths[col]; + rt_clip.bottom = dis->rcItem.bottom; + + hrgn = CreateRectRgnIndirect(&rt_clip); + + if (!GetClipRgn(dis->hDC, hrgn_org)) { + DeleteObject(hrgn_org); + hrgn_org = 0; + } + + /* HGDIOBJ holdPen = SelectObject(dis->hDC, GetStockObject(BLACK_PEN)); */ + ExtSelectClipRgn(dis->hDC, hrgn, RGN_AND); + DeleteObject(hrgn); + + if ((up=entry->up) != NULL) { + MoveToEx(dis->hDC, img_pos-IMAGE_WIDTH/2, y, 0); + LineTo(dis->hDC, img_pos-2, y); + + x = img_pos - IMAGE_WIDTH/2; + + do { + x -= IMAGE_WIDTH+TREE_LINE_DX; + + if (up->next +#ifndef _LEFT_FILES + && (up->next->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) +#endif + ) { + MoveToEx(dis->hDC, x, dis->rcItem.top, 0); + LineTo(dis->hDC, x, dis->rcItem.bottom); + } + } while((up=up->up) != NULL); + } + + x = img_pos - IMAGE_WIDTH/2; + + MoveToEx(dis->hDC, x, dis->rcItem.top, 0); + LineTo(dis->hDC, x, y); + + if (entry->next +#ifndef _LEFT_FILES + && (entry->next->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) +#endif + ) + LineTo(dis->hDC, x, dis->rcItem.bottom); + + SelectClipRgn(dis->hDC, hrgn_org); + if (hrgn_org) DeleteObject(hrgn_org); + /* SelectObject(dis->hDC, holdPen); */ + } else if (calcWidthCol==col || calcWidthCol==COLUMNS) { + int right = img_pos + IMAGE_WIDTH - TREE_LINE_DX; + + if (right > pane->widths[col]) + pane->widths[col] = right; + } + } else { + img_pos = dis->rcItem.left; + } + } else { + img_pos = dis->rcItem.left; + + if (calcWidthCol==col || calcWidthCol==COLUMNS) + pane->widths[col] = IMAGE_WIDTH; + } + + if (calcWidthCol == -1) { + focusRect.left = img_pos - 2; + +#ifdef _NO_EXTENSIONS + if (pane->treePane && entry) { + RECT rt = {0}; + + DrawText(dis->hDC, entry->data.cFileName, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX); + + focusRect.right = dis->rcItem.left+pane->positions[col+1]+TREE_LINE_DX + rt.right +2; + } +#else + + if (attrs & FILE_ATTRIBUTE_COMPRESSED) + textcolor = COLOR_COMPRESSED; + else +#endif /* _NO_EXTENSIONS */ + textcolor = RGB(0,0,0); + + if (dis->itemState & ODS_FOCUS) { + textcolor = COLOR_SELECTION_TXT; + bkcolor = COLOR_SELECTION; + } else { + bkcolor = GetSysColor(COLOR_WINDOW); + } + + hbrush = CreateSolidBrush(bkcolor); + FillRect(dis->hDC, &focusRect, hbrush); + DeleteObject(hbrush); + + SetBkMode(dis->hDC, TRANSPARENT); + SetTextColor(dis->hDC, textcolor); + + cx = pane->widths[col]; + + if (cx && img!=IMG_NONE) { + if (cx > IMAGE_WIDTH) + cx = IMAGE_WIDTH; + +#ifdef _SHELL_FOLDERS + if (entry->hicon && entry->hicon!=(HICON)-1) + DrawIconEx(dis->hDC, img_pos, dis->rcItem.top, entry->hicon, cx, GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); + else +#endif + ImageList_DrawEx(Globals.himl, img, dis->hDC, + img_pos, dis->rcItem.top, cx, + IMAGE_HEIGHT, bkcolor, CLR_DEFAULT, ILD_NORMAL); + } + } + + if (!entry) + return; + +#ifdef _NO_EXTENSIONS + if (img >= IMG_FOLDER_UP) + return; +#endif + + col++; + + /* ouput file name */ + if (calcWidthCol == -1) + output_text(pane, dis, col, entry->data.cFileName, 0); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, entry->data.cFileName); + + col++; + +#ifdef _NO_EXTENSIONS + if (!pane->treePane) { +#endif + + /* display file size */ + if (visible_cols & COL_SIZE) { +#ifdef _NO_EXTENSIONS + if (!(attrs&FILE_ATTRIBUTE_DIRECTORY)) +#endif + { + ULONGLONG size; + + size = ((ULONGLONG)entry->data.nFileSizeHigh << 32) | entry->data.nFileSizeLow; + + _stprintf(buffer, sLongNumFmt, size); + + if (calcWidthCol == -1) + output_number(pane, dis, col, buffer); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, buffer);/*TODO: not in every case time enough */ + } + + col++; + } + + /* display file date */ + if (visible_cols & (COL_DATE|COL_TIME)) { +#ifndef _NO_EXTENSIONS + format_date(&entry->data.ftCreationTime, buffer, visible_cols); + if (calcWidthCol == -1) + output_text(pane, dis, col, buffer, 0); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, buffer); + col++; + + format_date(&entry->data.ftLastAccessTime, buffer, visible_cols); + if (calcWidthCol == -1) + output_text(pane, dis, col, buffer, 0); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, buffer); + col++; +#endif /* _NO_EXTENSIONS */ + + format_date(&entry->data.ftLastWriteTime, buffer, visible_cols); + if (calcWidthCol == -1) + output_text(pane, dis, col, buffer, 0); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, buffer); + col++; + } + +#ifndef _NO_EXTENSIONS + if (entry->bhfi_valid) { + ULONGLONG index = ((ULONGLONG)entry->bhfi.nFileIndexHigh << 32) | entry->bhfi.nFileIndexLow; + + if (visible_cols & COL_INDEX) { + _stprintf(buffer, sLongHexFmt, index); + + if (calcWidthCol == -1) + output_text(pane, dis, col, buffer, DT_RIGHT); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, buffer); + + col++; + } + + if (visible_cols & COL_LINKS) { + wsprintf(buffer, sNumFmt, entry->bhfi.nNumberOfLinks); + + if (calcWidthCol == -1) + output_text(pane, dis, col, buffer, DT_CENTER); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_width(pane, dis, col, buffer); + + col++; + } + } else + col += 2; +#endif /* _NO_EXTENSIONS */ + + /* show file attributes */ + if (visible_cols & COL_ATTRIBUTES) { +#ifdef _NO_EXTENSIONS + const static TCHAR s4Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'}; + lstrcpy(buffer, s4Tabs); +#else + const static TCHAR s11Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'}; + lstrcpy(buffer, s11Tabs); +#endif + + if (attrs & FILE_ATTRIBUTE_NORMAL) buffer[ 0] = 'N'; + else { + if (attrs & FILE_ATTRIBUTE_READONLY) buffer[ 2] = 'R'; + if (attrs & FILE_ATTRIBUTE_HIDDEN) buffer[ 4] = 'H'; + if (attrs & FILE_ATTRIBUTE_SYSTEM) buffer[ 6] = 'S'; + if (attrs & FILE_ATTRIBUTE_ARCHIVE) buffer[ 8] = 'A'; + if (attrs & FILE_ATTRIBUTE_COMPRESSED) buffer[10] = 'C'; +#ifndef _NO_EXTENSIONS + if (attrs & FILE_ATTRIBUTE_DIRECTORY) buffer[12] = 'D'; + if (attrs & FILE_ATTRIBUTE_ENCRYPTED) buffer[14] = 'E'; + if (attrs & FILE_ATTRIBUTE_TEMPORARY) buffer[16] = 'T'; + if (attrs & FILE_ATTRIBUTE_SPARSE_FILE) buffer[18] = 'P'; + if (attrs & FILE_ATTRIBUTE_REPARSE_POINT) buffer[20] = 'Q'; + if (attrs & FILE_ATTRIBUTE_OFFLINE) buffer[22] = 'O'; + if (attrs & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) buffer[24] = 'X'; +#endif /* _NO_EXTENSIONS */ + } + + if (calcWidthCol == -1) + output_tabbed_text(pane, dis, col, buffer); + else if (calcWidthCol==col || calcWidthCol==COLUMNS) + calc_tabbed_width(pane, dis, col, buffer); + + col++; + } + +/*TODO + if (flags.security) { + const static TCHAR sSecTabs[] = { + ' ','\t',' ','\t',' ','\t',' ', + ' ','\t',' ', + ' ','\t',' ','\t',' ','\t',' ', + ' ','\t',' ', + ' ','\t',' ','\t',' ','\t',' ', + '\0' + }; + + DWORD rights = get_access_mask(); + + lstrcpy(buffer, sSecTabs); + + if (rights & FILE_READ_DATA) buffer[ 0] = 'R'; + if (rights & FILE_WRITE_DATA) buffer[ 2] = 'W'; + if (rights & FILE_APPEND_DATA) buffer[ 4] = 'A'; + if (rights & FILE_READ_EA) {buffer[6] = 'entry'; buffer[ 7] = 'R';} + if (rights & FILE_WRITE_EA) {buffer[9] = 'entry'; buffer[10] = 'W';} + if (rights & FILE_EXECUTE) buffer[12] = 'X'; + if (rights & FILE_DELETE_CHILD) buffer[14] = 'D'; + if (rights & FILE_READ_ATTRIBUTES) {buffer[16] = 'a'; buffer[17] = 'R';} + if (rights & FILE_WRITE_ATTRIBUTES) {buffer[19] = 'a'; buffer[20] = 'W';} + if (rights & WRITE_DAC) buffer[22] = 'C'; + if (rights & WRITE_OWNER) buffer[24] = 'O'; + if (rights & SYNCHRONIZE) buffer[26] = 'S'; + + output_text(dis, col++, buffer, DT_LEFT, 3, psize); + } + + if (flags.description) { + get_description(buffer); + output_text(dis, col++, buffer, 0, psize); + } +*/ + +#ifdef _NO_EXTENSIONS + } + + /* draw focus frame */ + if ((dis->itemState&ODS_FOCUS) && calcWidthCol==-1) { + /* Currently [04/2000] Wine neither behaves exactly the same */ + /* way as WIN 95 nor like Windows NT... */ + HGDIOBJ lastBrush; + HPEN lastPen; + HPEN hpen; + + if (!(GetVersion() & 0x80000000)) { /* Windows NT or higher? */ + LOGBRUSH lb = {PS_SOLID, RGB(255,255,255)}; + hpen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &lb, 0, 0); + } else + hpen = CreatePen(PS_DOT, 0, RGB(255,255,255)); + + lastPen = SelectPen(dis->hDC, hpen); + lastBrush = SelectObject(dis->hDC, GetStockObject(HOLLOW_BRUSH)); + SetROP2(dis->hDC, R2_XORPEN); + Rectangle(dis->hDC, focusRect.left, focusRect.top, focusRect.right, focusRect.bottom); + SelectObject(dis->hDC, lastBrush); + SelectObject(dis->hDC, lastPen); + DeleteObject(hpen); + } +#endif /* _NO_EXTENSIONS */ +} + + +#ifdef _NO_EXTENSIONS + +static void draw_splitbar(HWND hwnd, int x) +{ + RECT rt; + HDC hdc = GetDC(hwnd); + + GetClientRect(hwnd, &rt); + + rt.left = x - SPLIT_WIDTH/2; + rt.right = x + SPLIT_WIDTH/2+1; + + InvertRect(hdc, &rt); + + ReleaseDC(hwnd, hdc); +} + +#endif /* _NO_EXTENSIONS */ + + +#ifndef _NO_EXTENSIONS + +static void set_header(Pane* pane) +{ + HD_ITEM item; + int scroll_pos = GetScrollPos(pane->hwnd, SB_HORZ); + int i=0, x=0; + + item.mask = HDI_WIDTH; + item.cxy = 0; + + for(; x+pane->widths[i]widths[i]; + (void)Header_SetItem(pane->hwndHeader, i, &item); + } + + if (i < COLUMNS) { + x += pane->widths[i]; + item.cxy = x - scroll_pos; + (void)Header_SetItem(pane->hwndHeader, i++, &item); + + for(; iwidths[i]; + x += pane->widths[i]; + (void)Header_SetItem(pane->hwndHeader, i, &item); + } + } +} + +static LRESULT pane_notify(Pane* pane, NMHDR* pnmh) +{ + switch(pnmh->code) { + case HDN_TRACK: + case HDN_ENDTRACK: { + HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh; + int idx = phdn->iItem; + int dx = phdn->pitem->cxy - pane->widths[idx]; + int i; + + RECT clnt; + GetClientRect(pane->hwnd, &clnt); + + /* move immediate to simulate HDS_FULLDRAG (for now [04/2000] not really needed with WINELIB) */ + (void)Header_SetItem(pane->hwndHeader, idx, phdn->pitem); + + pane->widths[idx] += dx; + + for(i=idx; ++i<=COLUMNS; ) + pane->positions[i] += dx; + + { + int scroll_pos = GetScrollPos(pane->hwnd, SB_HORZ); + RECT rt_scr; + RECT rt_clip; + + rt_scr.left = pane->positions[idx+1]-scroll_pos; + rt_scr.top = 0; + rt_scr.right = clnt.right; + rt_scr.bottom = clnt.bottom; + + rt_clip.left = pane->positions[idx]-scroll_pos; + rt_clip.top = 0; + rt_clip.right = clnt.right; + rt_clip.bottom = clnt.bottom; + + if (rt_scr.left < 0) rt_scr.left = 0; + if (rt_clip.left < 0) rt_clip.left = 0; + + ScrollWindowEx(pane->hwnd, dx, 0, &rt_scr, &rt_clip, 0, 0, SW_INVALIDATE); + + rt_clip.right = pane->positions[idx+1]; + RedrawWindow(pane->hwnd, &rt_clip, 0, RDW_INVALIDATE|RDW_UPDATENOW); + + if (pnmh->code == HDN_ENDTRACK) { + ListBox_SetHorizontalExtent(pane->hwnd, pane->positions[COLUMNS]); + + if (GetScrollPos(pane->hwnd, SB_HORZ) != scroll_pos) + set_header(pane); + } + } + + return FALSE; + } + + case HDN_DIVIDERDBLCLICK: { + HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh; + HD_ITEM item; + + calc_single_width(pane, phdn->iItem); + item.mask = HDI_WIDTH; + item.cxy = pane->widths[phdn->iItem]; + + (void)Header_SetItem(pane->hwndHeader, phdn->iItem, &item); + InvalidateRect(pane->hwnd, 0, TRUE); + break;} + } + + return 0; +} + +#endif /* _NO_EXTENSIONS */ + + +static void scan_entry(ChildWnd* child, Entry* entry, int idx, HWND hwnd) +{ + TCHAR path[MAX_PATH]; + HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT)); + + /* delete sub entries in left pane */ + for(;;) { + LRESULT res = ListBox_GetItemData(child->left.hwnd, idx+1); + Entry* sub = (Entry*) res; + + if (res==LB_ERR || !sub || sub->level<=entry->level) + break; + + (void)ListBox_DeleteString(child->left.hwnd, idx+1); + } + + /* empty right pane */ + (void)ListBox_ResetContent(child->right.hwnd); + + /* release memory */ + free_entries(entry); + + /* read contents from disk */ +#ifdef _SHELL_FOLDERS + if (entry->etype == ET_SHELL) + { + read_directory(entry, NULL, child->sortOrder, hwnd); + } + else +#endif + { + get_path(entry, path); + read_directory(entry, path, child->sortOrder, hwnd); + } + + /* insert found entries in right pane */ + insert_entries(&child->right, entry->down, child->filter_pattern, child->filter_flags, -1); + calc_widths(&child->right, FALSE); +#ifndef _NO_EXTENSIONS + set_header(&child->right); +#endif + + child->header_wdths_ok = FALSE; + + SetCursor(old_cursor); +} + + +/* expand a directory entry */ + +static BOOL expand_entry(ChildWnd* child, Entry* dir) +{ + int idx; + Entry* p; + + if (!dir || dir->expanded || !dir->down) + return FALSE; + + p = dir->down; + + if (p->data.cFileName[0]=='.' && p->data.cFileName[1]=='\0' && p->next) { + p = p->next; + + if (p->data.cFileName[0]=='.' && p->data.cFileName[1]=='.' && + p->data.cFileName[2]=='\0' && p->next) + p = p->next; + } + + /* no subdirectories ? */ + if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) + return FALSE; + + idx = ListBox_FindItemData(child->left.hwnd, 0, dir); + + dir->expanded = TRUE; + + /* insert entries in left pane */ + insert_entries(&child->left, p, NULL, TF_ALL, idx); + + if (!child->header_wdths_ok) { + if (calc_widths(&child->left, FALSE)) { +#ifndef _NO_EXTENSIONS + set_header(&child->left); +#endif + + child->header_wdths_ok = TRUE; + } + } + + return TRUE; +} + + +static void collapse_entry(Pane* pane, Entry* dir) +{ + int idx = ListBox_FindItemData(pane->hwnd, 0, dir); + + ShowWindow(pane->hwnd, SW_HIDE); + + /* hide sub entries */ + for(;;) { + LRESULT res = ListBox_GetItemData(pane->hwnd, idx+1); + Entry* sub = (Entry*) res; + + if (res==LB_ERR || !sub || sub->level<=dir->level) + break; + + (void)ListBox_DeleteString(pane->hwnd, idx+1); + } + + dir->expanded = FALSE; + + ShowWindow(pane->hwnd, SW_SHOW); +} + + +static void refresh_right_pane(ChildWnd* child) +{ + (void)ListBox_ResetContent(child->right.hwnd); + insert_entries(&child->right, child->right.root, child->filter_pattern, child->filter_flags, -1); + calc_widths(&child->right, FALSE); + +#ifndef _NO_EXTENSIONS + set_header(&child->right); +#endif +} + +static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd) +{ + TCHAR path[MAX_PATH]; + + if (!entry) + return; + + path[0] = '\0'; + + child->left.cur = entry; + + child->right.root = entry->down? entry->down: entry; + child->right.cur = entry; + + if (!entry->scanned) + scan_entry(child, entry, idx, hwnd); + else + refresh_right_pane(child); + + get_path(entry, path); + lstrcpy(child->path, path); + + if (child->hwnd) /* only change window title, if the window already exists */ + SetWindowText(child->hwnd, path); + + if (path[0]) + if (SetCurrentDirectory(path)) + set_space_status(); +} + + +static void refresh_child(ChildWnd* child) +{ + TCHAR path[MAX_PATH], drv[_MAX_DRIVE+1]; + Entry* entry; + int idx; + + get_path(child->left.cur, path); + _tsplitpath(path, drv, NULL, NULL, NULL); + + child->right.root = NULL; + + scan_entry(child, &child->root.entry, 0, child->hwnd); + +#ifdef _SHELL_FOLDERS + if (child->root.entry.etype == ET_SHELL) + entry = read_tree(&child->root, NULL, get_path_pidl(path,child->hwnd), drv, child->sortOrder, child->hwnd); + else +#endif + entry = read_tree(&child->root, path, NULL, drv, child->sortOrder, child->hwnd); + + if (!entry) + entry = &child->root.entry; + + insert_entries(&child->left, child->root.entry.down, NULL, TF_ALL, 0); + + set_curdir(child, entry, 0, child->hwnd); + + idx = ListBox_FindItemData(child->left.hwnd, 0, child->left.cur); + (void)ListBox_SetCurSel(child->left.hwnd, idx); +} + + +static void create_drive_bar(void) +{ + TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}; +#ifndef _NO_EXTENSIONS + TCHAR b1[BUFFER_LEN]; +#endif + int btn = 1; + PTSTR p; + + GetLogicalDriveStrings(BUFFER_LEN, Globals.drives); + + Globals.hdrivebar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST, + IDW_DRIVEBAR, 2, Globals.hInstance, IDB_DRIVEBAR, &drivebarBtn, + 0, 16, 13, 16, 13, sizeof(TBBUTTON)); + +#ifndef _NO_EXTENSIONS +#ifdef __WINE__ + /* insert unix file system button */ + b1[0] = '/'; + b1[1] = '\0'; + b1[2] = '\0'; + SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1); + + drivebarBtn.idCommand = ID_DRIVE_UNIX_FS; + SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn); + drivebarBtn.iString++; +#endif +#ifdef _SHELL_FOLDERS + /* insert shell namespace button */ + load_string(b1, IDS_SHELL); + b1[lstrlen(b1)+1] = '\0'; + SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b1); + + drivebarBtn.idCommand = ID_DRIVE_SHELL_NS; + SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn); + drivebarBtn.iString++; +#endif + + /* register windows drive root strings */ + SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)Globals.drives); +#endif + + drivebarBtn.idCommand = ID_DRIVE_FIRST; + + for(p=Globals.drives; *p; ) { +#ifdef _NO_EXTENSIONS + /* insert drive letter */ + TCHAR b[3] = {tolower(*p)}; + SendMessage(Globals.hdrivebar, TB_ADDSTRING, 0, (LPARAM)b); +#endif + switch(GetDriveType(p)) { + case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break; + case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break; + case DRIVE_REMOTE: drivebarBtn.iBitmap = 4; break; + case DRIVE_RAMDISK: drivebarBtn.iBitmap = 5; break; + default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2; + } + + SendMessage(Globals.hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn); + drivebarBtn.idCommand++; + drivebarBtn.iString++; + + while(*p++); + } +} + +static void refresh_drives(void) +{ + RECT rect; + + /* destroy drive bar */ + DestroyWindow(Globals.hdrivebar); + Globals.hdrivebar = 0; + + /* re-create drive bar */ + create_drive_bar(); + + /* update window layout */ + GetClientRect(Globals.hMainWnd, &rect); + SendMessage(Globals.hMainWnd, WM_SIZE, 0, MAKELONG(rect.right, rect.bottom)); +} + + +static BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow) +{ + HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow); + + if ((int)hinst <= 32) { + display_error(hwnd, GetLastError()); + return FALSE; + } + + return TRUE; +} + + +static BOOL launch_entry(Entry* entry, HWND hwnd, UINT nCmdShow) +{ + TCHAR cmd[MAX_PATH]; + +#ifdef _SHELL_FOLDERS + if (entry->etype == ET_SHELL) { + BOOL ret = TRUE; + + SHELLEXECUTEINFO shexinfo; + + shexinfo.cbSize = sizeof(SHELLEXECUTEINFO); + shexinfo.fMask = SEE_MASK_IDLIST; + shexinfo.hwnd = hwnd; + shexinfo.lpVerb = NULL; + shexinfo.lpFile = NULL; + shexinfo.lpParameters = NULL; + shexinfo.lpDirectory = NULL; + shexinfo.nShow = nCmdShow; + shexinfo.lpIDList = get_to_absolute_pidl(entry, hwnd); + + if (!ShellExecuteEx(&shexinfo)) { + display_error(hwnd, GetLastError()); + ret = FALSE; + } + + if (shexinfo.lpIDList != entry->pidl) + IMalloc_Free(Globals.iMalloc, shexinfo.lpIDList); + + return ret; + } +#endif + + get_path(entry, cmd); + + /* start program, open document... */ + return launch_file(hwnd, cmd, nCmdShow); +} + + +static void activate_entry(ChildWnd* child, Pane* pane, HWND hwnd) +{ + Entry* entry = pane->cur; + + if (!entry) + return; + + if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + int scanned_old = entry->scanned; + + if (!scanned_old) + scan_entry(child, entry, ListBox_GetCurSel(child->left.hwnd), hwnd); + +#ifndef _NO_EXTENSIONS + if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='\0') + return; +#endif + + if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='.' && entry->data.cFileName[2]=='\0') { + entry = child->left.cur->up; + collapse_entry(&child->left, entry); + goto focus_entry; + } else if (entry->expanded) + collapse_entry(pane, child->left.cur); + else { + expand_entry(child, child->left.cur); + + if (!pane->treePane) focus_entry: { + int idx = ListBox_FindItemData(child->left.hwnd, ListBox_GetCurSel(child->left.hwnd), entry); + (void)ListBox_SetCurSel(child->left.hwnd, idx); + set_curdir(child, entry, idx, hwnd); + } + } + + if (!scanned_old) { + calc_widths(pane, FALSE); + +#ifndef _NO_EXTENSIONS + set_header(pane); +#endif + } + } else { + if (GetKeyState(VK_MENU) < 0) + show_properties_dlg(entry, child->hwnd); + else + launch_entry(entry, child->hwnd, SW_SHOWNORMAL); + } +} + + +static BOOL pane_command(Pane* pane, UINT cmd) +{ + switch(cmd) { + case ID_VIEW_NAME: + if (pane->visible_cols) { + pane->visible_cols = 0; + calc_widths(pane, TRUE); +#ifndef _NO_EXTENSIONS + set_header(pane); +#endif + InvalidateRect(pane->hwnd, 0, TRUE); + CheckMenuItem(Globals.hMenuView, ID_VIEW_NAME, MF_BYCOMMAND|MF_CHECKED); + CheckMenuItem(Globals.hMenuView, ID_VIEW_ALL_ATTRIBUTES, MF_BYCOMMAND); + CheckMenuItem(Globals.hMenuView, ID_VIEW_SELECTED_ATTRIBUTES, MF_BYCOMMAND); + } + break; + + case ID_VIEW_ALL_ATTRIBUTES: + if (pane->visible_cols != COL_ALL) { + pane->visible_cols = COL_ALL; + calc_widths(pane, TRUE); +#ifndef _NO_EXTENSIONS + set_header(pane); +#endif + InvalidateRect(pane->hwnd, 0, TRUE); + CheckMenuItem(Globals.hMenuView, ID_VIEW_NAME, MF_BYCOMMAND); + CheckMenuItem(Globals.hMenuView, ID_VIEW_ALL_ATTRIBUTES, MF_BYCOMMAND|MF_CHECKED); + CheckMenuItem(Globals.hMenuView, ID_VIEW_SELECTED_ATTRIBUTES, MF_BYCOMMAND); + } + break; + +#ifndef _NO_EXTENSIONS + case ID_PREFERRED_SIZES: { + calc_widths(pane, TRUE); + set_header(pane); + InvalidateRect(pane->hwnd, 0, TRUE); + break;} +#endif + + /* TODO: more command ids... */ + + default: + return FALSE; + } + + return TRUE; +} + + +static void set_sort_order(ChildWnd* child, SORT_ORDER sortOrder) +{ + if (child->sortOrder != sortOrder) { + child->sortOrder = sortOrder; + refresh_child(child); + } +} + +static void update_view_menu(ChildWnd* child) +{ + CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_NAME, child->sortOrder==SORT_NAME? MF_CHECKED: MF_UNCHECKED); + CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_TYPE, child->sortOrder==SORT_EXT? MF_CHECKED: MF_UNCHECKED); + CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_SIZE, child->sortOrder==SORT_SIZE? MF_CHECKED: MF_UNCHECKED); + CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_DATE, child->sortOrder==SORT_DATE? MF_CHECKED: MF_UNCHECKED); +} + + +static BOOL is_directory(LPCTSTR target) +{ + /*TODO correctly handle UNIX paths */ + DWORD target_attr = GetFileAttributes(target); + + if (target_attr == INVALID_FILE_ATTRIBUTES) + return FALSE; + + return target_attr&FILE_ATTRIBUTE_DIRECTORY? TRUE: FALSE; +} + +static BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target) +{ + TCHAR path[MAX_PATH]; + int len; + + get_path(pane->cur, path); + + if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK) + return FALSE; + + get_path(pane->cur, source); + + /* convert relative targets to absolute paths */ + if (path[0]!='/' && path[1]!=':') { + get_path(pane->cur->up, target); + len = lstrlen(target); + + if (target[len-1]!='\\' && target[len-1]!='/') + target[len++] = '/'; + + lstrcpy(target+len, path); + } else + lstrcpy(target, path); + + /* If the target already exists as directory, create a new target below this. */ + if (is_directory(path)) { + TCHAR fname[_MAX_FNAME], ext[_MAX_EXT]; + const static TCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'}; + + _tsplitpath(source, NULL, NULL, fname, ext); + + wsprintf(target, sAppend, path, fname, ext); + } + + return TRUE; +} + + +static IContextMenu2* s_pctxmenu2 = NULL; + +#ifndef __MINGW32__ /* IContextMenu3 missing in MinGW (as of 6.2.2005) */ +static IContextMenu3* s_pctxmenu3 = NULL; +#endif + +static void CtxMenu_reset(void) +{ + s_pctxmenu2 = NULL; + +#ifndef __MINGW32__ /* IContextMenu3 missing in MinGW (as of 6.2.2005) */ + s_pctxmenu3 = NULL; +#endif +} + +static IContextMenu* CtxMenu_query_interfaces(IContextMenu* pcm1) +{ + IContextMenu* pcm = NULL; + + CtxMenu_reset(); + +#ifndef __MINGW32__ /* IContextMenu3 missing in MinGW (as of 6.2.2005) */ + if (IUnknown_QueryInterface(pcm1, &IID_IContextMenu3, (void**)&pcm) == NOERROR) + s_pctxmenu3 = (LPCONTEXTMENU3)pcm; + else +#endif + if (IUnknown_QueryInterface(pcm1, &IID_IContextMenu2, (void**)&pcm) == NOERROR) + s_pctxmenu2 = (LPCONTEXTMENU2)pcm; + + if (pcm) { + IUnknown_Release(pcm1); + return pcm; + } else + return pcm1; +} + +static BOOL CtxMenu_HandleMenuMsg(UINT nmsg, WPARAM wparam, LPARAM lparam) +{ +#ifndef __MINGW32__ /* IContextMenu3 missing in MinGW (as of 6.2.2005) */ + if (s_pctxmenu3) { + if (SUCCEEDED((*s_pctxmenu3->lpVtbl->HandleMenuMsg)(s_pctxmenu3, nmsg, wparam, lparam))) + return TRUE; + } +#endif + + if (s_pctxmenu2) + if (SUCCEEDED((*s_pctxmenu2->lpVtbl->HandleMenuMsg)(s_pctxmenu2, nmsg, wparam, lparam))) + return TRUE; + + return FALSE; +} + + +static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST* apidl, int x, int y) +{ + IContextMenu* pcm; + BOOL executed = FALSE; + + HRESULT hr = IShellFolder_GetUIObjectOf(shell_folder, hwndParent, cidl, apidl, &IID_IContextMenu, NULL, (LPVOID*)&pcm); +/* HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm); */ + + if (SUCCEEDED(hr)) { + HMENU hmenu = CreatePopupMenu(); + + pcm = CtxMenu_query_interfaces(pcm); + + if (hmenu) { + hr = (*pcm->lpVtbl->QueryContextMenu)(pcm, hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL); + + if (SUCCEEDED(hr)) { + UINT idCmd = TrackPopupMenu(hmenu, TPM_LEFTALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, x, y, 0, hwndParent, NULL); + + CtxMenu_reset(); + + if (idCmd) { + CMINVOKECOMMANDINFO cmi; + + cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); + cmi.fMask = 0; + cmi.hwnd = hwndParent; + cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST); + cmi.lpParameters = NULL; + cmi.lpDirectory = NULL; + cmi.nShow = SW_SHOWNORMAL; + cmi.dwHotKey = 0; + cmi.hIcon = 0; + + hr = (*pcm->lpVtbl->InvokeCommand)(pcm, &cmi); + executed = TRUE; + } + } else + CtxMenu_reset(); + } + + IUnknown_Release(pcm); + } + + return FAILED(hr)? hr: executed? S_OK: S_FALSE; +} + + +static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + ChildWnd* child = (ChildWnd*) GetWindowLongPtr(hwnd, GWLP_USERDATA); + ASSERT(child); + + switch(nmsg) { + case WM_DRAWITEM: { + LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lparam; + Entry* entry = (Entry*) dis->itemData; + + if (dis->CtlID == IDW_TREE_LEFT) + draw_item(&child->left, dis, entry, -1); + else if (dis->CtlID == IDW_TREE_RIGHT) + draw_item(&child->right, dis, entry, -1); + else + goto draw_menu_item; + + return TRUE;} + + case WM_CREATE: + InitChildWindow(child); + break; + + case WM_NCDESTROY: + free_child_window(child); + SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); + break; + + case WM_PAINT: { + PAINTSTRUCT ps; + HBRUSH lastBrush; + RECT rt; + GetClientRect(hwnd, &rt); + BeginPaint(hwnd, &ps); + rt.left = child->split_pos-SPLIT_WIDTH/2; + rt.right = child->split_pos+SPLIT_WIDTH/2+1; + lastBrush = SelectBrush(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR)); + Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1); + SelectObject(ps.hdc, lastBrush); +#ifdef _NO_EXTENSIONS + rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL); + FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH)); +#endif + EndPaint(hwnd, &ps); + break;} + + case WM_SETCURSOR: + if (LOWORD(lparam) == HTCLIENT) { + POINT pt; + GetCursorPos(&pt); + ScreenToClient(hwnd, &pt); + + if (pt.x>=child->split_pos-SPLIT_WIDTH/2 && pt.xsplit_pos+SPLIT_WIDTH/2+1) { + SetCursor(LoadCursor(0, IDC_SIZEWE)); + return TRUE; + } + } + goto def; + + case WM_LBUTTONDOWN: { + RECT rt; + int x = GET_X_LPARAM(lparam); + + GetClientRect(hwnd, &rt); + + if (x>=child->split_pos-SPLIT_WIDTH/2 && xsplit_pos+SPLIT_WIDTH/2+1) { + last_split = child->split_pos; +#ifdef _NO_EXTENSIONS + draw_splitbar(hwnd, last_split); +#endif + SetCapture(hwnd); + } + + break;} + + case WM_LBUTTONUP: + if (GetCapture() == hwnd) { +#ifdef _NO_EXTENSIONS + RECT rt; + int x = LOWORD(lparam); + draw_splitbar(hwnd, last_split); + last_split = -1; + GetClientRect(hwnd, &rt); + child->split_pos = x; + resize_tree(child, rt.right, rt.bottom); +#endif + ReleaseCapture(); + } + break; + +#ifdef _NO_EXTENSIONS + case WM_CAPTURECHANGED: + if (GetCapture()==hwnd && last_split>=0) + draw_splitbar(hwnd, last_split); + break; +#endif + + case WM_KEYDOWN: + if (wparam == VK_ESCAPE) + if (GetCapture() == hwnd) { + RECT rt; +#ifdef _NO_EXTENSIONS + draw_splitbar(hwnd, last_split); +#else + child->split_pos = last_split; +#endif + GetClientRect(hwnd, &rt); + resize_tree(child, rt.right, rt.bottom); + last_split = -1; + ReleaseCapture(); + SetCursor(LoadCursor(0, IDC_ARROW)); + } + break; + + case WM_MOUSEMOVE: + if (GetCapture() == hwnd) { + RECT rt; + int x = LOWORD(lparam); + +#ifdef _NO_EXTENSIONS + HDC hdc = GetDC(hwnd); + GetClientRect(hwnd, &rt); + + rt.left = last_split-SPLIT_WIDTH/2; + rt.right = last_split+SPLIT_WIDTH/2+1; + InvertRect(hdc, &rt); + + last_split = x; + rt.left = x-SPLIT_WIDTH/2; + rt.right = x+SPLIT_WIDTH/2+1; + InvertRect(hdc, &rt); + + ReleaseDC(hwnd, hdc); +#else + GetClientRect(hwnd, &rt); + + if (x>=0 && xsplit_pos = x; + resize_tree(child, rt.right, rt.bottom); + rt.left = x-SPLIT_WIDTH/2; + rt.right = x+SPLIT_WIDTH/2+1; + InvalidateRect(hwnd, &rt, FALSE); + UpdateWindow(child->left.hwnd); + UpdateWindow(hwnd); + UpdateWindow(child->right.hwnd); + } +#endif + } + break; + +#ifndef _NO_EXTENSIONS + case WM_GETMINMAXINFO: + DefMDIChildProc(hwnd, nmsg, wparam, lparam); + + {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam; + + lpmmi->ptMaxTrackSize.x <<= 1;/*2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN */ + lpmmi->ptMaxTrackSize.y <<= 1;/*2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN */ + break;} +#endif /* _NO_EXTENSIONS */ + + case WM_SETFOCUS: + if (SetCurrentDirectory(child->path)) + set_space_status(); + SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd); + break; + + case WM_DISPATCH_COMMAND: { + Pane* pane = GetFocus()==child->left.hwnd? &child->left: &child->right; + + switch(LOWORD(wparam)) { + case ID_WINDOW_NEW: { + ChildWnd* new_child = alloc_child_window(child->path, NULL, hwnd); + + if (!create_child_window(new_child)) + free(new_child); + + break;} + + case ID_REFRESH: + refresh_drives(); + refresh_child(child); + break; + + case ID_ACTIVATE: + activate_entry(child, pane, hwnd); + break; + + case ID_FILE_MOVE: { + TCHAR source[BUFFER_LEN], target[BUFFER_LEN]; + + if (prompt_target(pane, source, target)) { + SHFILEOPSTRUCT shfo = {hwnd, FO_MOVE, source, target}; + + source[lstrlen(source)+1] = '\0'; + target[lstrlen(target)+1] = '\0'; + + if (!SHFileOperation(&shfo)) + refresh_child(child); + } + break;} + + case ID_FILE_COPY: { + TCHAR source[BUFFER_LEN], target[BUFFER_LEN]; + + if (prompt_target(pane, source, target)) { + SHFILEOPSTRUCT shfo = {hwnd, FO_COPY, source, target}; + + source[lstrlen(source)+1] = '\0'; + target[lstrlen(target)+1] = '\0'; + + if (!SHFileOperation(&shfo)) + refresh_child(child); + } + break;} + + case ID_FILE_DELETE: { + TCHAR path[BUFFER_LEN]; + SHFILEOPSTRUCT shfo = {hwnd, FO_DELETE, path}; + + get_path(pane->cur, path); + + path[lstrlen(path)+1] = '\0'; + + if (!SHFileOperation(&shfo)) + refresh_child(child); + break;} + + case ID_VIEW_SORT_NAME: + set_sort_order(child, SORT_NAME); + break; + + case ID_VIEW_SORT_TYPE: + set_sort_order(child, SORT_EXT); + break; + + case ID_VIEW_SORT_SIZE: + set_sort_order(child, SORT_SIZE); + break; + + case ID_VIEW_SORT_DATE: + set_sort_order(child, SORT_DATE); + break; + + case ID_VIEW_FILTER: { + struct FilterDialog dlg; + + memset(&dlg, 0, sizeof(struct FilterDialog)); + lstrcpy(dlg.pattern, child->filter_pattern); + dlg.flags = child->filter_flags; + + if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_VIEW_TYPE), hwnd, FilterDialogDlgProc, (LPARAM)&dlg) == IDOK) { + lstrcpy(child->filter_pattern, dlg.pattern); + child->filter_flags = dlg.flags; + refresh_right_pane(child); + } + break;} + + case ID_VIEW_SPLIT: { + last_split = child->split_pos; +#ifdef _NO_EXTENSIONS + draw_splitbar(hwnd, last_split); +#endif + SetCapture(hwnd); + break;} + + case ID_EDIT_PROPERTIES: + show_properties_dlg(pane->cur, child->hwnd); + break; + + default: + return pane_command(pane, LOWORD(wparam)); + } + + return TRUE;} + + case WM_COMMAND: { + Pane* pane = GetFocus()==child->left.hwnd? &child->left: &child->right; + + switch(HIWORD(wparam)) { + case LBN_SELCHANGE: { + int idx = ListBox_GetCurSel(pane->hwnd); + Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx); + + if (pane == &child->left) + set_curdir(child, entry, idx, hwnd); + else + pane->cur = entry; + break;} + + case LBN_DBLCLK: + activate_entry(child, pane, hwnd); + break; + } + break;} + +#ifndef _NO_EXTENSIONS + case WM_NOTIFY: { + NMHDR* pnmh = (NMHDR*) lparam; + return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &child->left: &child->right, pnmh);} +#endif + +#ifdef _SHELL_FOLDERS + case WM_CONTEXTMENU: { + POINT pt, pt_clnt; + Pane* pane; + int idx; + + /* first select the current item in the listbox */ + HWND hpanel = (HWND) wparam; + pt_clnt.x = pt.x = (short)LOWORD(lparam); + pt_clnt.y = pt.y = (short)HIWORD(lparam); + ScreenToClient(hpanel, &pt_clnt); + SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt_clnt.x, pt_clnt.y)); + SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt_clnt.x, pt_clnt.y)); + + /* now create the popup menu using shell namespace and IContextMenu */ + pane = GetFocus()==child->left.hwnd? &child->left: &child->right; + idx = ListBox_GetCurSel(pane->hwnd); + + if (idx != -1) { + Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx); + + LPITEMIDLIST pidl_abs = get_to_absolute_pidl(entry, hwnd); + + if (pidl_abs) { + IShellFolder* parentFolder; + LPCITEMIDLIST pidlLast; + + /* get and use the parent folder to display correct context menu in all cases */ + if (SUCCEEDED(SHBindToParent(pidl_abs, &IID_IShellFolder, (LPVOID*)&parentFolder, &pidlLast))) { + if (ShellFolderContextMenu(parentFolder, hwnd, 1, &pidlLast, pt.x, pt.y) == S_OK) + refresh_child(child); + + IShellFolder_Release(parentFolder); + } + + IMalloc_Free(Globals.iMalloc, pidl_abs); + } + } + break;} +#endif + + case WM_MEASUREITEM: + draw_menu_item: + if (!wparam) /* Is the message menu-related? */ + if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam)) + return TRUE; + + break; + + case WM_INITMENUPOPUP: + if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam)) + return 0; + + update_view_menu(child); + break; + +#ifndef __MINGW32__ /* IContextMenu3 missing in MinGW (as of 6.2.2005) */ + case WM_MENUCHAR: /* only supported by IContextMenu3 */ + if (s_pctxmenu3) { + LRESULT lResult = 0; + + (*s_pctxmenu3->lpVtbl->HandleMenuMsg2)(s_pctxmenu3, nmsg, wparam, lparam, &lResult); + + return lResult; + } + + break; +#endif + + case WM_SIZE: + if (wparam != SIZE_MINIMIZED) + resize_tree(child, LOWORD(lparam), HIWORD(lparam)); + /* fall through */ + + default: def: + return DefMDIChildProc(hwnd, nmsg, wparam, lparam); + } + + return 0; +} + + +static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + ChildWnd* child = (ChildWnd*) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); + Pane* pane = (Pane*) GetWindowLongPtr(hwnd, GWLP_USERDATA); + ASSERT(child); + + switch(nmsg) { +#ifndef _NO_EXTENSIONS + case WM_HSCROLL: + set_header(pane); + break; +#endif + + case WM_SETFOCUS: + child->focus_pane = pane==&child->right? 1: 0; + (void)ListBox_SetSel(hwnd, TRUE, 1); + /*TODO: check menu items */ + break; + + case WM_KEYDOWN: + if (wparam == VK_TAB) { + /*TODO: SetFocus(Globals.hdrivebar) */ + SetFocus(child->focus_pane? child->left.hwnd: child->right.hwnd); + } + } + + return CallWindowProc(g_orgTreeWndProc, hwnd, nmsg, wparam, lparam); +} + + +static void InitInstance(HINSTANCE hinstance) +{ + const static TCHAR sFont[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'}; + + WNDCLASSEX wcFrame; + WNDCLASS wcChild; + ATOM hChildClass; + int col; + + INITCOMMONCONTROLSEX icc = { + sizeof(INITCOMMONCONTROLSEX), + ICC_BAR_CLASSES + }; + + HDC hdc = GetDC(0); + + setlocale(LC_COLLATE, ""); /* set collating rules to local settings for compareName */ + + InitCommonControlsEx(&icc); + + + /* register frame window class */ + + wcFrame.cbSize = sizeof(WNDCLASSEX); + wcFrame.style = 0; + wcFrame.lpfnWndProc = FrameWndProc; + wcFrame.cbClsExtra = 0; + wcFrame.cbWndExtra = 0; + wcFrame.hInstance = hinstance; + wcFrame.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_WINEFILE)); + wcFrame.hCursor = LoadCursor(0, IDC_ARROW); + wcFrame.hbrBackground = 0; + wcFrame.lpszMenuName = 0; + wcFrame.lpszClassName = sWINEFILEFRAME; + wcFrame.hIconSm = (HICON)LoadImage(hinstance, + MAKEINTRESOURCE(IDI_WINEFILE), + IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_SHARED); + + Globals.hframeClass = RegisterClassEx(&wcFrame); + + + /* register tree windows class */ + + wcChild.style = CS_CLASSDC|CS_DBLCLKS|CS_VREDRAW; + wcChild.lpfnWndProc = ChildWndProc; + wcChild.cbClsExtra = 0; + wcChild.cbWndExtra = 0; + wcChild.hInstance = hinstance; + wcChild.hIcon = 0; + wcChild.hCursor = LoadCursor(0, IDC_ARROW); + wcChild.hbrBackground = 0; + wcChild.lpszMenuName = 0; + wcChild.lpszClassName = sWINEFILETREE; + + hChildClass = RegisterClass(&wcChild); + + + Globals.haccel = LoadAccelerators(hinstance, MAKEINTRESOURCE(IDA_WINEFILE)); + + Globals.hfont = CreateFont(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sFont); + + ReleaseDC(0, hdc); + + Globals.hInstance = hinstance; + +#ifdef _SHELL_FOLDERS + CoInitialize(NULL); + CoGetMalloc(MEMCTX_TASK, &Globals.iMalloc); + SHGetDesktopFolder(&Globals.iDesktop); +#ifdef __WINE__ + Globals.cfStrFName = RegisterClipboardFormatA(CFSTR_FILENAME); +#else + Globals.cfStrFName = RegisterClipboardFormat(CFSTR_FILENAME); +#endif +#endif + + /* load column strings */ + col = 1; + + load_string(g_pos_names[col++], IDS_COL_NAME); + load_string(g_pos_names[col++], IDS_COL_SIZE); + load_string(g_pos_names[col++], IDS_COL_CDATE); +#ifndef _NO_EXTENSIONS + load_string(g_pos_names[col++], IDS_COL_ADATE); + load_string(g_pos_names[col++], IDS_COL_MDATE); + load_string(g_pos_names[col++], IDS_COL_IDX); + load_string(g_pos_names[col++], IDS_COL_LINKS); +#endif + load_string(g_pos_names[col++], IDS_COL_ATTR); +#ifndef _NO_EXTENSIONS + load_string(g_pos_names[col++], IDS_COL_SEC); +#endif +} + + +static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path) +{ + const static TCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'}; + + TCHAR buffer[MAX_PATH], b1[BUFFER_LEN]; + ChildWnd* child; + HMENU hMenuFrame, hMenuWindow; + + CLIENTCREATESTRUCT ccs; + + if (Globals.hMainWnd) + return; + + hMenuFrame = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(IDM_WINEFILE)); + hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2); + + Globals.hMenuFrame = hMenuFrame; + Globals.hMenuView = GetSubMenu(hMenuFrame, 3); + Globals.hMenuOptions = GetSubMenu(hMenuFrame, 4); + + ccs.hWindowMenu = hMenuWindow; + ccs.idFirstChild = IDW_FIRST_CHILD; + + + /* create main window */ + Globals.hMainWnd = CreateWindowEx(0, (LPCTSTR)(int)Globals.hframeClass, RS(b1,IDS_WINE_FILE), WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + hwndParent, Globals.hMenuFrame, Globals.hInstance, 0/*lpParam*/); + + + Globals.hmdiclient = CreateWindowEx(0, sMDICLIENT, NULL, + WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER, + 0, 0, 0, 0, + Globals.hMainWnd, 0, Globals.hInstance, &ccs); + + + CheckMenuItem(Globals.hMenuOptions, ID_VIEW_DRIVE_BAR, MF_BYCOMMAND|MF_CHECKED); + + create_drive_bar(); + + { + TBBUTTON toolbarBtns[] = { + {0, 0, 0, BTNS_SEP, {0, 0}, 0, 0}, + {0, ID_WINDOW_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, + {1, ID_WINDOW_CASCADE, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, + {2, ID_WINDOW_TILE_HORZ, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, + {3, ID_WINDOW_TILE_VERT, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, +/*TODO + {4, ID_... , TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, + {5, ID_... , TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, +*/ }; + + Globals.htoolbar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE, + IDW_TOOLBAR, 2, Globals.hInstance, IDB_TOOLBAR, toolbarBtns, + sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON)); + CheckMenuItem(Globals.hMenuOptions, ID_VIEW_TOOL_BAR, MF_BYCOMMAND|MF_CHECKED); + } + + Globals.hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, Globals.hMainWnd, IDW_STATUSBAR); + CheckMenuItem(Globals.hMenuOptions, ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED); + +/* CreateStatusWindow does not accept WS_BORDER + Globals.hstatusbar = CreateWindowEx(WS_EX_NOPARENTNOTIFY, STATUSCLASSNAME, 0, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0, + Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/ + + /*TODO: read paths and window placements from registry */ + + if (!path || !*path) { + GetCurrentDirectory(MAX_PATH, buffer); + path = buffer; + } + + ShowWindow(Globals.hMainWnd, cmdshow); + +//#if defined(_SHELL_FOLDERS) && !defined(__WINE__) +// // Shell Namespace as default: +// child = alloc_child_window(path, get_path_pidl(path,Globals.hMainWnd), Globals.hMainWnd); +//#else + child = alloc_child_window(path, NULL, Globals.hMainWnd); +//#endif + + child->pos.showCmd = SW_SHOWMAXIMIZED; + child->pos.rcNormalPosition.left = 0; + child->pos.rcNormalPosition.top = 0; + child->pos.rcNormalPosition.right = 320; + child->pos.rcNormalPosition.bottom = 280; + + if (!create_child_window(child)) + free(child); + + SetWindowPlacement(child->hwnd, &child->pos); + + Globals.himl = ImageList_LoadBitmap(Globals.hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0)); + + Globals.prescan_node = FALSE; + + UpdateWindow(Globals.hMainWnd); + + if (path && path[0]) + { + int index,count; + TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT]; + TCHAR fullname[_MAX_FNAME+_MAX_EXT+1]; + + memset(name,0,sizeof(name)); + memset(name,0,sizeof(ext)); + _tsplitpath(path, drv, dir, name, ext); + if (name[0]) + { + count = ListBox_GetCount(child->right.hwnd); + lstrcpy(fullname,name); + lstrcat(fullname,ext); + + for (index = 0; index < count; index ++) + { + Entry* entry = (Entry*) ListBox_GetItemData(child->right.hwnd, + index); + if (lstrcmp(entry->data.cFileName,fullname)==0 || + lstrcmp(entry->data.cAlternateFileName,fullname)==0) + { + (void)ListBox_SetCurSel(child->right.hwnd, index); + SetFocus(child->right.hwnd); + break; + } + } + } + } +} + +static void ExitInstance(void) +{ +#ifdef _SHELL_FOLDERS + IShellFolder_Release(Globals.iDesktop); + IMalloc_Release(Globals.iMalloc); + CoUninitialize(); +#endif + + DeleteObject(Globals.hfont); + ImageList_Destroy(Globals.himl); +} + +#ifdef _NO_EXTENSIONS + +/* search for already running win[e]files */ + +static int g_foundPrevInstance = 0; + +static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam) +{ + TCHAR cls[128]; + + GetClassName(hwnd, cls, 128); + + if (!lstrcmp(cls, (LPCTSTR)lparam)) { + g_foundPrevInstance++; + return FALSE; + } + + return TRUE; +} + +/* search for window of given class name to allow only one running instance */ +static int find_window_class(LPCTSTR classname) +{ + EnumWindows(EnumWndProc, (LPARAM)classname); + + if (g_foundPrevInstance) + return 1; + + return 0; +} + +#endif + +static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCTSTR path) +{ + MSG msg; + + InitInstance(hinstance); + + if (cmdshow == SW_SHOWNORMAL) + /*TODO: read window placement from registry */ + cmdshow = SW_MAXIMIZE; + + show_frame(0, cmdshow, path); + + while(GetMessage(&msg, 0, 0, 0)) { + if (Globals.hmdiclient && TranslateMDISysAccel(Globals.hmdiclient, &msg)) + continue; + + if (Globals.hMainWnd && TranslateAccelerator(Globals.hMainWnd, Globals.haccel, &msg)) + continue; + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + ExitInstance(); + + return msg.wParam; +} + + +#if defined(UNICODE) && defined(_MSC_VER) +int APIENTRY wWinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPWSTR cmdline, int cmdshow) +#else +int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE previnstance, LPSTR cmdline, int cmdshow) +#endif +{ +#ifdef _NO_EXTENSIONS + if (find_window_class(sWINEFILEFRAME)) + return 1; +#endif + +#if defined(UNICODE) && !defined(_MSC_VER) + { /* convert ANSI cmdline into WCS path string */ + TCHAR buffer[MAX_PATH]; + MultiByteToWideChar(CP_ACP, 0, cmdline, -1, buffer, MAX_PATH); + winefile_main(hinstance, cmdshow, buffer); + } +#else + winefile_main(hinstance, cmdshow, cmdline); +#endif + + return 0; +} diff --git a/rosapps/winefile/winefile.dsp b/rosapps/winefile/winefile.dsp new file mode 100644 index 00000000000..1ed7ccd31e0 --- /dev/null +++ b/rosapps/winefile/winefile.dsp @@ -0,0 +1,269 @@ +# Microsoft Developer Studio Project File - Name="winefile" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=winefile - Win32 Unicode 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 "winefile.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 "winefile.mak" CFG="winefile - Win32 Unicode Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "winefile - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "winefile - Win32 Unicode Debug" (based on "Win32 (x86) Application") +!MESSAGE "winefile - Win32 UNICODE Release" (based on "Win32 (x86) Application") +!MESSAGE "winefile - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "winefile - 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 "winefileDebug" +# PROP Intermediate_Dir "winefileDebug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D _WIN32_WINNT=0x0501 /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /i ".." /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:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib comdlg32.lib ole32.lib version.lib mpr.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "winefile - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Unicode Debug" +# PROP BASE Intermediate_Dir "Unicode Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "winefileUDebug" +# PROP Intermediate_Dir "winefileUDebug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D _WIN32_WINNT=0x0501 /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /i ".." /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:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib comdlg32.lib ole32.lib version.lib mpr.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "winefile - Win32 UNICODE Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "winefile___Win32_UNICODE_Release" +# PROP BASE Intermediate_Dir "winefile___Win32_UNICODE_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "winefileURelease" +# PROP Intermediate_Dir "winefileURelease" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "UNICODE" /D _WIN32_WINNT=0x0501 /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /i ".." /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib comdlg32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib comdlg32.lib ole32.lib version.lib mpr.lib /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "winefile - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "winefile___Win32_Release" +# PROP BASE Intermediate_Dir "winefile___Win32_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "winefileRelease" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "UNICODE" /D WINE_UNUSED= /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D _WIN32_WINNT=0x0501 /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /i ".." /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib comdlg32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib comdlg32.lib ole32.lib version.lib mpr.lib /nologo /subsystem:windows /machine:I386 /out:"winefile-ansi.exe" + +!ENDIF + +# Begin Target + +# Name "winefile - Win32 Debug" +# Name "winefile - Win32 Unicode Debug" +# Name "winefile - Win32 UNICODE Release" +# Name "winefile - Win32 Release" +# Begin Group "Resources" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\cs.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\de.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\drivebar.bmp +# End Source File +# Begin Source File + +SOURCE=.\en.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\es.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\fr.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\hu.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\images.bmp +# End Source File +# Begin Source File + +SOURCE=.\it.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\nl.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\pl.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\pt.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\resource.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\ru.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\si.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\Sv.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\toolbar.bmp +# End Source File +# Begin Source File + +SOURCE=.\winefile.ico +# End Source File +# Begin Source File + +SOURCE=.\winefile.rc +# End Source File +# Begin Source File + +SOURCE=.\zh.rc +# PROP Exclude_From_Build 1 +# End Source File +# End Group +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\splitpath.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\winefile.c +# End Source File +# Begin Source File + +SOURCE=.\winefile.h +# End Source File +# End Target +# End Project diff --git a/rosapps/winefile/winefile.dsw b/rosapps/winefile/winefile.dsw new file mode 100644 index 00000000000..7fff73d5724 --- /dev/null +++ b/rosapps/winefile/winefile.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "make_explorer"=.\make_winefile.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "winefile"=.\winefile.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/rosapps/winefile/winefile.h b/rosapps/winefile/winefile.h new file mode 100644 index 00000000000..4cb7e0ca738 --- /dev/null +++ b/rosapps/winefile/winefile.h @@ -0,0 +1,166 @@ +/* + * Copyright 2000, 2003, 2004, 2005 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define WIN32_LEAN_AND_MEAN +#define WIN32_EXTRA_LEAN +#define NOSERVICE +#define NOMCX +#define NOIME +#define NOCOMM +#define NOKANJI +#define NORPC +#define NOPROXYSTUB +#define NOIMAGE +#define NOTAPE + +#define NONAMELESSUNION +#include +#include +#include +#include + +#ifdef UNICODE +#define _UNICODE +#endif + +#include +#include +#include +#include +#include + +#ifndef __WINE__ +#include /* for alloca() */ + + // ugly hack to use alloca() while keeping Wine's developers happy +#define HeapAlloc(h,f,s) alloca(s) +#define HeapFree(h,f,p) +#endif + +#include /* for ShellExecute() */ +#include /* for SHFormatDrive() */ + +#ifndef _NO_EXTENSIONS +#define _SHELL_FOLDERS +#endif /* _NO_EXTENSIONS */ + +#ifndef FILE_ATTRIBUTE_NOT_CONTENT_INDEXED +#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040 +#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 +#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 +#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 +#endif + + +#ifdef _DEBUG +#define ASSERT(x) {if (!(x)) DebugBreak();} +#else +#define ASSERT(x) /* nothing */ +#endif + +#define BUFFER_LEN 1024 + + +enum IMAGE { + IMG_NONE=-1, IMG_FILE=0, IMG_DOCUMENT, IMG_EXECUTABLE, + IMG_FOLDER, IMG_OPEN_FOLDER, IMG_FOLDER_PLUS,IMG_OPEN_PLUS, IMG_OPEN_MINUS, + IMG_FOLDER_UP, IMG_FOLDER_CUR +}; + +#define IMAGE_WIDTH 16 +#define IMAGE_HEIGHT 13 +#define SPLIT_WIDTH 5 +#define TREE_LINE_DX 3 + +#define IDW_STATUSBAR 0x100 +#define IDW_TOOLBAR 0x101 +#define IDW_DRIVEBAR 0x102 +#define IDW_FIRST_CHILD 0xC000 /*0x200*/ + +#define IDW_TREE_LEFT 3 +#define IDW_TREE_RIGHT 6 +#define IDW_HEADER_LEFT 2 +#define IDW_HEADER_RIGHT 5 + +#define WM_DISPATCH_COMMAND 0xBF80 + +#define COLOR_COMPRESSED RGB(0,0,255) +#define COLOR_SELECTION RGB(0,0,128) +#define COLOR_SELECTION_TXT RGB(255,255,255) + +#ifdef _NO_EXTENSIONS +#define COLOR_SPLITBAR WHITE_BRUSH +#else +#define COLOR_SPLITBAR LTGRAY_BRUSH +#endif + +#define FRM_CALC_CLIENT 0xBF83 +#define Frame_CalcFrameClient(hwnd, prt) ((BOOL)SNDMSG(hwnd, FRM_CALC_CLIENT, 0, (LPARAM)(PRECT)prt)) + + +typedef struct +{ + HANDLE hInstance; + HACCEL haccel; + ATOM hframeClass; + + HWND hMainWnd; + HMENU hMenuFrame; + HMENU hWindowsMenu; + HMENU hLanguageMenu; + HMENU hMenuView; + HMENU hMenuOptions; + HWND hmdiclient; + HWND hstatusbar; + HWND htoolbar; + HWND hdrivebar; + HFONT hfont; + + TCHAR num_sep; + SIZE spaceSize; + HIMAGELIST himl; + + TCHAR drives[BUFFER_LEN]; + BOOL prescan_node; /*TODO*/ + +#ifdef _SHELL_FOLDERS + IShellFolder* iDesktop; + IMalloc* iMalloc; + UINT cfStrFName; +#endif +} WINEFILE_GLOBALS; + +extern WINEFILE_GLOBALS Globals; + +#ifdef __WINE__ + +#ifdef UNICODE +extern void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext); +#define _tsplitpath _wsplitpath +#define _stprintf msvcrt_swprintf +#else +extern void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext); +#define _tsplitpath _splitpath +#define _stprintf sprintf +#endif + +#else + +#include /* for _tsplitpath() */ + +#endif diff --git a/rosapps/winefile/winefile.ico b/rosapps/winefile/winefile.ico new file mode 100644 index 0000000000000000000000000000000000000000..3c7fd13dae4595863041ae59e70d61db61489ad2 GIT binary patch literal 2734 zcmcgt!D`z;5FOV+q9iEkp{LR$^pv9urL<6*eu__`xA^4TY(b&llTYxihvpwDC|Eto zKE;6+Z{M4pUCFUr5?VSiJ3BLPW@kscE0Lb`<@8h__vFVTk=G(J7PPn}y^{remBX`)vBs-u2n zZ|^VW_kJzcHT(DV#{TH)7(#zM+_@XuZ)$*r>2ZTMnqDLVOn;c*a)q3L55Xz85AFs2 zg!x+ntQ5~k zs7LT@C_X`<=v$~?1Bj=JJyT^RfmVGl|sKxk7TPsgn_Kg6Z=Kn!{xBLf_ z^cmCNUm + + + . + + + 0x0501 + 0x0501 + uuid + kernel32 + gdi32 + user32 + comctl32 + advapi32 + comdlg32 + shell32 + ole32 + version + mpr + winefile.c + winefile.rc + + diff --git a/rosapps/winefile/winefile.rc b/rosapps/winefile/winefile.rc new file mode 100644 index 00000000000..bbf6ef7aef6 --- /dev/null +++ b/rosapps/winefile/winefile.rc @@ -0,0 +1,44 @@ +/* + * Copyright 2000 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "windows.h" +#include "resource.h" + +/* define language neutral resources */ + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#include "resource.rc" + +/* include localised resources */ + +#include "lang/en-US.rc" +#include "lang/cs-CZ.rc" +#include "lang/de-DE.rc" +#include "lang/es-ES.rc" +#include "lang/fr-FR.rc" +#include "lang/hu-HU.rc" +#include "lang/it-IT.rc" +#include "lang/nl-NL.rc" +#include "lang/pl-PL.rc" +#include "lang/pt-PT.rc" +#include "lang/ru-RU.rc" +#include "lang/sl-SI.rc" +#include "lang/zh-CN.rc" +#include "lang/sv-SE.rc" +#include "lang/nb-NO.rc" diff --git a/rosapps/winefile/winefile.sln b/rosapps/winefile/winefile.sln new file mode 100644 index 00000000000..a7ead544054 --- /dev/null +++ b/rosapps/winefile/winefile.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_winefile", "make_winefile.vcproj", "{D5D64C37-5820-4EE1-9982-98A2CFFAC645}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winefile", "winefile.vcproj", "{33A963F1-6C9A-4582-80E5-C6AAD0173499}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Unicode Debug|Win32 = Unicode Debug|Win32 + UNICODE Release|Win32 = UNICODE Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5D64C37-5820-4EE1-9982-98A2CFFAC645}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5D64C37-5820-4EE1-9982-98A2CFFAC645}.Release|Win32.ActiveCfg = Release|Win32 + {D5D64C37-5820-4EE1-9982-98A2CFFAC645}.Release|Win32.Build.0 = Release|Win32 + {D5D64C37-5820-4EE1-9982-98A2CFFAC645}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 + {D5D64C37-5820-4EE1-9982-98A2CFFAC645}.Unicode Debug|Win32.Build.0 = Debug|Win32 + {D5D64C37-5820-4EE1-9982-98A2CFFAC645}.UNICODE Release|Win32.ActiveCfg = Release|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.Debug|Win32.ActiveCfg = Debug|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.Debug|Win32.Build.0 = Debug|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.Release|Win32.ActiveCfg = Release|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.Release|Win32.Build.0 = Release|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.UNICODE Release|Win32.ActiveCfg = UNICODE Release|Win32 + {33A963F1-6C9A-4582-80E5-C6AAD0173499}.UNICODE Release|Win32.Build.0 = UNICODE Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/rosapps/winefile/winefile.vcproj b/rosapps/winefile/winefile.vcproj new file mode 100644 index 00000000000..75f24f1c39e --- /dev/null +++ b/rosapps/winefile/winefile.vcproj @@ -0,0 +1,1220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rosapps/winver/winver.c b/rosapps/winver/winver.c new file mode 100644 index 00000000000..b9855549934 --- /dev/null +++ b/rosapps/winver/winver.c @@ -0,0 +1,12 @@ +#include +#include + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { + static const WCHAR szROS[] = { 'R','e','a','c','t','O','S','\n',0 }; + UNREFERENCED_PARAMETER(lpCmdLine); + UNREFERENCED_PARAMETER(nCmdShow); + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(hInstance); + ShellAbout(0, szROS, 0, 0); + return 1; +} diff --git a/rosapps/winver/winver.rbuild b/rosapps/winver/winver.rbuild new file mode 100644 index 00000000000..0d484c1b22f --- /dev/null +++ b/rosapps/winver/winver.rbuild @@ -0,0 +1,11 @@ + + . + + + + 0x501 + 0x0501 + shell32 + kernel32 + winver.c +