Sync up to trunk head.
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 22 May 2010 13:41:48 +0000 (13:41 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 22 May 2010 13:41:48 +0000 (13:41 +0000)
svn path=/branches/header-work/; revision=47301

616 files changed:
1  2 
Makefile
ReactOS-arm.rbuild
base/applications/cacls/lang/ja-JP.rc
base/applications/cacls/rsrc.rc
base/applications/fontview/display.c
base/applications/mstsc/win32.c
base/applications/paint/main.c
base/applications/paint/mouse.c
base/applications/rapps/lang/it-IT.rc
base/applications/rapps/rapps/dosbox.txt
base/applications/rapps/rapps/firefox2.txt
base/applications/rapps/rapps/firefox3.txt
base/applications/rapps/rapps/irfanview.txt
base/applications/rapps/rapps/irfanviewplugins.txt
base/applications/rapps/rapps/mirandaim.txt
base/applications/rapps/rapps/openttd.txt
base/applications/rapps/rapps/opera.txt
base/applications/rapps/rapps/rosbe.txt
base/applications/rapps/rapps/scite.txt
base/applications/rapps/rapps/scummvm.txt
base/applications/rapps/rapps/utorrent.txt
base/applications/rapps/rsrc.rc
base/applications/regedit/find.c
base/applications/regedit/framewnd.c
base/applications/regedit/lang/bg-BG.rc
base/applications/regedit/lang/cs-CZ.rc
base/applications/regedit/lang/de-DE.rc
base/applications/regedit/lang/el-GR.rc
base/applications/regedit/lang/en-US.rc
base/applications/regedit/lang/es-ES.rc
base/applications/regedit/lang/fr-FR.rc
base/applications/regedit/lang/hu-HU.rc
base/applications/regedit/lang/id-ID.rc
base/applications/regedit/lang/it-IT.rc
base/applications/regedit/lang/ja-JP.rc
base/applications/regedit/lang/ko-KR.rc
base/applications/regedit/lang/nl-NL.rc
base/applications/regedit/lang/no-NO.rc
base/applications/regedit/lang/pl-PL.rc
base/applications/regedit/lang/pt-BR.rc
base/applications/regedit/lang/pt-PT.rc
base/applications/regedit/lang/ru-RU.rc
base/applications/regedit/lang/sk-SK.rc
base/applications/regedit/lang/sl-SI.rc
base/applications/regedit/lang/sv-SE.rc
base/applications/regedit/lang/th-TH.rc
base/applications/regedit/lang/uk-UA.rc
base/applications/regedit/lang/zh-CN.rc
base/applications/regedit/listview.c
base/applications/regedit/regproc.c
base/applications/regedit/regproc.h
base/applications/wordpad/wordpad.rbuild
base/services/services.rbuild
base/setup/setup/setup.c
base/setup/usetup/inffile.c
base/setup/usetup/inffile.h
base/setup/usetup/interface/usetup.c
base/setup/usetup/lang/it-IT.h
base/setup/usetup/registry.c
base/setup/usetup/registry.h
base/setup/usetup/usetup.rbuild
base/shell/explorer/res/startmenu.ico
base/shell/explorer/taskbar/traynotify.cpp
base/system/userinit/userinit.c
base/system/winlogon/environment.c
base/system/winlogon/sas.c
base/system/winlogon/winlogon.c
base/system/winlogon/winlogon.h
base/system/winlogon/winlogon.rbuild
boot/bootdata/hivecls_arm.inf
boot/bootdata/hivecls_i386.inf
boot/bootdata/hivedef_arm.inf
boot/bootdata/hivedef_i386.inf
boot/bootdata/hivesft_arm.inf
boot/bootdata/hivesft_i386.inf
boot/bootdata/hivesys_i386.inf
boot/bootdata/packages/reactos.dff
boot/freeldr/freeldr/arch/i386/hardware.c
boot/freeldr/freeldr/arch/i386/machpc.c
boot/freeldr/freeldr/arch/i386/machxbox.c
boot/freeldr/freeldr/arch/i386/miscboot.c
boot/freeldr/freeldr/arch/i386/xboxhw.c
boot/freeldr/freeldr/arch/powerpc/mach.c
boot/freeldr/freeldr/disk/disk.c
boot/freeldr/freeldr/disk/partition.c
boot/freeldr/freeldr/fs/iso.c
boot/freeldr/freeldr/include/disk.h
boot/freeldr/freeldr/include/machine.h
boot/freeldr/freeldr/linuxboot.c
boot/freeldr/freeldr/machine.c
boot/freeldr/freeldr/reactos/arcname.c
boot/freeldr/freeldr/reactos/reactos.c
boot/freeldr/freeldr/setupldr.rbuild
dll/cpl/appwiz/lang/cs-CZ.rc
dll/cpl/console/colors.c
dll/cpl/console/layout.c
dll/cpl/input/settings.c
dll/cpl/intl/lang/bg-BG.rc
dll/cpl/intl/lang/cs-CZ.rc
dll/cpl/intl/lang/de-DE.rc
dll/cpl/intl/lang/en-US.rc
dll/cpl/intl/lang/es-ES.rc
dll/cpl/intl/lang/fr-FR.rc
dll/cpl/intl/lang/it-IT.rc
dll/cpl/intl/lang/no-NO.rc
dll/cpl/intl/lang/pl-PL.rc
dll/cpl/intl/lang/ro-RO.rc
dll/cpl/intl/lang/ru-RU.rc
dll/cpl/intl/lang/sk-SK.rc
dll/cpl/intl/lang/uk-UA.rc
dll/cpl/intl/lang/zh-CN.rc
dll/cpl/intl/numbers.c
dll/cpl/intl/resource.h
dll/cpl/sysdm/lang/cs-CZ.rc
dll/cpl/sysdm/lang/it-IT.rc
dll/cpl/sysdm/lang/uk-UA.rc
dll/cpl/usrmgr/groups.c
dll/cpl/usrmgr/users.c
dll/cpl/usrmgr/usrmgr.rbuild
dll/ntdll/ldr/utils.c
dll/win32/advapi32/misc/hwprofiles.c
dll/win32/advapi32/reg/reg.c
dll/win32/advapi32/service/eventlog.c
dll/win32/comctl32/comctl32.rbuild
dll/win32/comdlg32/filedlg.c
dll/win32/comdlg32/fontdlg.c
dll/win32/comdlg32/printdlg.c
dll/win32/crypt32/decode.c
dll/win32/dhcpcsvc/dhcp/adapter.c
dll/win32/dhcpcsvc/dhcp/alloc.c
dll/win32/dhcpcsvc/dhcp/api.c
dll/win32/dhcpcsvc/dhcp/compat.c
dll/win32/dhcpcsvc/dhcp/dhclient.c
dll/win32/dhcpcsvc/dhcp/dispatch.c
dll/win32/dhcpcsvc/dhcp/hash.c
dll/win32/dhcpcsvc/dhcp/options.c
dll/win32/dhcpcsvc/dhcp/pipe.c
dll/win32/dhcpcsvc/dhcp/socket.c
dll/win32/dhcpcsvc/dhcp/tables.c
dll/win32/dhcpcsvc/dhcp/tree.c
dll/win32/dhcpcsvc/dhcp/util.c
dll/win32/dhcpcsvc/dhcpcsvc.c
dll/win32/dhcpcsvc/dhcpcsvc.rbuild
dll/win32/dhcpcsvc/dhcpcsvc.spec
dll/win32/dhcpcsvc/include/debug.h
dll/win32/dhcpcsvc/include/dhcp.h
dll/win32/dhcpcsvc/include/dhcpd.h
dll/win32/dhcpcsvc/include/hash.h
dll/win32/dhcpcsvc/include/rosdhcp.h
dll/win32/dhcpcsvc/include/tree.h
dll/win32/gdi32/include/gdi32p.h
dll/win32/gdi32/objects/dc.c
dll/win32/gdi32/objects/region.c
dll/win32/gdiplus/brush.c
dll/win32/gdiplus/font.c
dll/win32/gdiplus/gdiplus.spec
dll/win32/gdiplus/gdiplus_private.h
dll/win32/gdiplus/graphics.c
dll/win32/gdiplus/image.c
dll/win32/hhctrl.ocx/hhctrl.c
dll/win32/inetcomm/mimeintl.c
dll/win32/inetcomm/mimeole.c
dll/win32/inseng/inseng_main.c
dll/win32/iphlpapi/dhcp_reactos.c
dll/win32/iphlpapi/iphlpapi.rbuild
dll/win32/iphlpapi/iphlpapi_main.c
dll/win32/iphlpapi/iphlpapi_private.h
dll/win32/jscript/jscript.h
dll/win32/jscript/regexp.c
dll/win32/jscript/string.c
dll/win32/kernel32/include/kernel32.h
dll/win32/kernel32/kernel32.pspec
dll/win32/kernel32/lang/bg-BG.mc
dll/win32/kernel32/lang/de-DE.mc
dll/win32/kernel32/lang/pl-PL.mc
dll/win32/kernel32/lang/ru-RU.mc
dll/win32/kernel32/mem/global.c
dll/win32/kernel32/misc/console.c
dll/win32/kernel32/misc/dllmain.c
dll/win32/kernel32/misc/nls.c
dll/win32/kernel32/misc/stubs.c
dll/win32/kernel32/misc/utils.c
dll/win32/kernel32/process/cmdline.c
dll/win32/kernel32/thread/fiber.c
dll/win32/kernel32/thread/i386/fiber.S
dll/win32/localspl/provider.c
dll/win32/lpk/dllmain.c
dll/win32/mciavi32/mciavi.c
dll/win32/mcicda/mcicda.c
dll/win32/mciqtz32/mciqtz.c
dll/win32/mciqtz32/mciqtz_private.h
dll/win32/mciseq/mcimidi.c
dll/win32/mciwave/mciwave.c
dll/win32/mscoree/mscoree.rbuild
dll/win32/mscoree/mscoree_main.c
dll/win32/mscoree/mscoree_private.h
dll/win32/msctf/displayattributemgr.c
dll/win32/msctf/inputprocessor.c
dll/win32/msctf/msctf.c
dll/win32/msctf/msctf.rbuild
dll/win32/msctf/msctf_internal.h
dll/win32/msctf/regsvr.c
dll/win32/msgina/lang/bg-BG.rc
dll/win32/msgina/lang/cs-CZ.rc
dll/win32/msgina/lang/de-DE.rc
dll/win32/msgina/lang/en-US.rc
dll/win32/msgina/lang/es-ES.rc
dll/win32/msgina/lang/fr-FR.rc
dll/win32/msgina/lang/id-ID.rc
dll/win32/msgina/lang/it-IT.rc
dll/win32/msgina/lang/ja-JP.rc
dll/win32/msgina/lang/no-NO.rc
dll/win32/msgina/lang/pl-PL.rc
dll/win32/msgina/lang/ro-RO.rc
dll/win32/msgina/lang/ru-RU.rc
dll/win32/msgina/lang/sk-SK.rc
dll/win32/msgina/lang/uk-UA.rc
dll/win32/msgina/msgina.c
dll/win32/msgsm32.acm/msgsm32.c
dll/win32/mshtml/dispex.c
dll/win32/mshtml/editor.c
dll/win32/mshtml/htmlelem.c
dll/win32/mshtml/htmlwindow.c
dll/win32/mshtml/install.c
dll/win32/mshtml/mshtml_private.h
dll/win32/mshtml/navigate.c
dll/win32/mshtml/nsembed.c
dll/win32/mshtml/nsevents.c
dll/win32/mshtml/nsio.c
dll/win32/mshtml/olecmd.c
dll/win32/mshtml/view.c
dll/win32/msvfw32/mciwnd.c
dll/win32/msvidc32/msvideo1.c
dll/win32/msxml3/dispex.c
dll/win32/msxml3/element.c
dll/win32/msxml3/main.c
dll/win32/msxml3/node.c
dll/win32/netcfgx/netcfgx.c
dll/win32/netcfgx/netcfgx.rbuild
dll/win32/netcfgx/tcpipconf_notify.c
dll/win32/netshell/lang/bg-BG.rc
dll/win32/netshell/lang/cs-CZ.rc
dll/win32/netshell/lang/da-DK.rc
dll/win32/netshell/lang/de-DE.rc
dll/win32/netshell/lang/el-GR.rc
dll/win32/netshell/lang/en-US.rc
dll/win32/netshell/lang/es-ES.rc
dll/win32/netshell/lang/fr-FR.rc
dll/win32/netshell/lang/hu-HU.rc
dll/win32/netshell/lang/id-ID.rc
dll/win32/netshell/lang/it-IT.rc
dll/win32/netshell/lang/ja-JP.rc
dll/win32/netshell/lang/nl-NL.rc
dll/win32/netshell/lang/no-NO.rc
dll/win32/netshell/lang/pl-PL.rc
dll/win32/netshell/lang/ro-RO.rc
dll/win32/netshell/lang/ru-RU.rc
dll/win32/netshell/lang/sv-SE.rc
dll/win32/netshell/lang/uk-UA.rc
dll/win32/netshell/lang/zh-CN.rc
dll/win32/netshell/lanstatusui.c
dll/win32/netshell/netshell.rbuild
dll/win32/ole32/compobj.c
dll/win32/ole32/ftmarshal.c
dll/win32/ole32/ifs.c
dll/win32/ole32/moniker.c
dll/win32/ole32/ole32.rbuild
dll/win32/ole32/rpc.c
dll/win32/ole32/storage32.c
dll/win32/ole32/storage32.h
dll/win32/oleaut32/olepicture.c
dll/win32/oleaut32/regsvr.c
dll/win32/oleaut32/typelib.c
dll/win32/oleaut32/typelib2.c
dll/win32/oleaut32/vartype.c
dll/win32/qmgr/qmgr.inf
dll/win32/rsaenh/rsaenh.c
dll/win32/rsaenh/sha2.c
dll/win32/schannel/lsamode.c
dll/win32/setupapi/install.c
dll/win32/setupapi/interface.c
dll/win32/shell32/folder_options.c
dll/win32/shell32/folders.c
dll/win32/shell32/lang/cs-CZ.rc
dll/win32/shell32/lang/en-US.rc
dll/win32/shell32/lang/it-IT.rc
dll/win32/shell32/shelllink.c
dll/win32/shell32/shfldr_cpanel.c
dll/win32/shell32/shfldr_desktop.c
dll/win32/shell32/shlfileop.c
dll/win32/shell32/shlview.c
dll/win32/shell32/shresdef.h
dll/win32/shlwapi/ordinal.c
dll/win32/shlwapi/shlwapi.spec
dll/win32/shlwapi/url.c
dll/win32/sti/regsvr.c
dll/win32/sti/sti.c
dll/win32/sti/sti.rbuild
dll/win32/sti/sti.spec
dll/win32/sti/sti_main.c
dll/win32/sti/sti_private.h
dll/win32/sti/sti_wia.idl
dll/win32/syssetup/wizard.c
dll/win32/urlmon/bindprot.c
dll/win32/urlmon/regsvr.c
dll/win32/urlmon/urlmon_main.c
dll/win32/urlmon/urlmon_main.h
dll/win32/urlmon/urlmon_urlmon.idl
dll/win32/urlmon/usrmarshal.c
dll/win32/user32/controls/button.c
dll/win32/user32/user32.rbuild
dll/win32/user32/windows/menu.c
dll/win32/user32/windows/window.c
dll/win32/userenv/environment.c
dll/win32/userenv/lang/de-DE.rc
dll/win32/userenv/lang/es-ES.rc
dll/win32/userenv/lang/fr-FR.rc
dll/win32/userenv/lang/it-IT.rc
dll/win32/userenv/profile.c
dll/win32/userenv/setup.c
dll/win32/usp10/bidi.c
dll/win32/usp10/usp10.c
dll/win32/usp10/usp10.rbuild
dll/win32/usp10/usp10.spec
dll/win32/usp10/usp10_internal.h
dll/win32/version/resource.c
dll/win32/windowscodecs/bmpdecode.c
dll/win32/windowscodecs/clsfactory.c
dll/win32/windowscodecs/converter.c
dll/win32/windowscodecs/gifformat.c
dll/win32/windowscodecs/icoformat.c
dll/win32/windowscodecs/jpegformat.c
dll/win32/windowscodecs/palette.c
dll/win32/windowscodecs/pngformat.c
dll/win32/windowscodecs/regsvr.c
dll/win32/windowscodecs/stream.c
dll/win32/windowscodecs/tiffformat.c
dll/win32/windowscodecs/wincodecs_private.h
dll/win32/windowscodecs/windowscodecs.rbuild
dll/win32/wininet/internet.c
dll/win32/wininet/urlcache.c
dll/win32/wintrust/asn.c
dll/win32/ws2_32/misc/ns.c
drivers/bus/pci/fdo.c
drivers/bus/pci/pdo.c
drivers/network/afd/afd/lock.c
drivers/network/afd/afd/read.c
drivers/network/ndis/ndis/miniport.c
drivers/usb/nt4compat/usbdriver/devmgr.c
drivers/usb/nt4compat/usbdriver/devmgr.h
drivers/usb/nt4compat/usbdriver/ehci.c
drivers/usb/nt4compat/usbdriver/uhci.c
drivers/usb/nt4compat/usbdriver/usbdriver.rbuild
drivers/video/displays/vga/objects/pointer.c
drivers/video/videoprt/videoprt.c
drivers/wdm/audio/backpln/portcls/pin_dmus.cpp
drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
drivers/wdm/audio/backpln/portcls/port_dmus.cpp
drivers/wdm/audio/backpln/portcls/port_topology.cpp
drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp
drivers/wdm/audio/backpln/portcls/port_wavepci.cpp
drivers/wdm/audio/backpln/portcls/port_wavert.cpp
drivers/wdm/audio/backpln/portcls/registry.cpp
drivers/wdm/audio/backpln/portcls/service_group.cpp
drivers/wdm/audio/sysaudio/control.c
drivers/wdm/audio/sysaudio/deviface.c
drivers/wdm/audio/sysaudio/main.c
drivers/wdm/audio/sysaudio/pin.c
drivers/wdm/audio/sysaudio/sysaudio.h
hal/hal.pspec
hal/halx86/generic/bus/pcibus.c
hal/halx86/hal_generic.rbuild
hal/halx86/halamd64.rbuild
include/host/typedefs.h
include/host/wcsfuncs.h
include/ndk/i386/asm.h
include/ndk/i386/ketypes.h
include/psdk/commctrl.h
include/psdk/dhcpcapi.h
include/psdk/gdiplusflat.h
include/psdk/psdk.rbuild
include/psdk/shdeprecated.idl
include/psdk/shlwapi.h
include/psdk/sti.h
include/psdk/strsafe.h
include/psdk/wia.h
include/psdk/wia_lh.idl
include/psdk/wia_xp.idl
include/psdk/winbase.h
include/reactos/subsys/csrss/csrss.h
include/reactos/win32k/ntuser.h
include/reactos/wine/commctrl.h
lib/cmlib/cminit.c
lib/cmlib/cmlib.h
lib/cmlib/cmlib.rbuild
lib/drivers/ip/transport/tcp/tcp.c
lib/drivers/oskittcp/oskittcp/osenv.c
lib/host/wcsfuncs/wcsfuncs.c
lib/lib.rbuild
lib/newinflib/README.txt
lib/newinflib/builddep.h
lib/newinflib/infcommon.h
lib/newinflib/infcore.c
lib/newinflib/infget.c
lib/newinflib/infhost.h
lib/newinflib/infhostgen.c
lib/newinflib/infhostget.c
lib/newinflib/infhostput.c
lib/newinflib/infhostrtl.c
lib/newinflib/inflib.h
lib/newinflib/inflib.mak
lib/newinflib/inflib.rbuild
lib/newinflib/infpriv.h
lib/newinflib/infput.c
lib/newinflib/infros.h
lib/newinflib/infrosgen.c
lib/newinflib/infrosget.c
lib/newinflib/infrosput.c
lib/rtl/message.c
media/doc/README.WINE
media/drivers/etc/etc.rbuild
media/drivers/etc/hosts
media/inf/cpu.inf
media/inf/display.inf
media/inf/ports.inf
ntoskrnl/config/cmdata.c
ntoskrnl/ex/init.c
ntoskrnl/include/internal/i386/intrin_i.h
ntoskrnl/include/internal/i386/mm.h
ntoskrnl/include/internal/io.h
ntoskrnl/io/iomgr/deviface.c
ntoskrnl/io/pnpmgr/pnpmgr.c
ntoskrnl/io/pnpmgr/pnpnotify.c
ntoskrnl/io/pnpmgr/pnpreport.c
ntoskrnl/io/pnpmgr/pnpres.c
ntoskrnl/io/pnpmgr/pnproot.c
ntoskrnl/kd/kdinit.c
ntoskrnl/kdbg/kdb.c
ntoskrnl/kdbg/kdb_cli.c
ntoskrnl/ke/i386/exp.c
ntoskrnl/ke/i386/irqobj.c
ntoskrnl/ke/i386/traphdlr.c
ntoskrnl/ke/i386/v86vdm.c
ntoskrnl/mm/ARM3/arm/init.c
ntoskrnl/mm/ARM3/contmem.c
ntoskrnl/mm/ARM3/drvmgmt.c
ntoskrnl/mm/ARM3/i386/init.c
ntoskrnl/mm/ARM3/largepag.c
ntoskrnl/mm/ARM3/mdlsup.c
ntoskrnl/mm/ARM3/miarm.h
ntoskrnl/mm/ARM3/mminit.c
ntoskrnl/mm/ARM3/pagfault.c
ntoskrnl/mm/ARM3/pfnlist.c
ntoskrnl/mm/ARM3/pool.c
ntoskrnl/mm/ARM3/procsup.c
ntoskrnl/mm/freelist.c
ntoskrnl/mm/mmfault.c
ntoskrnl/mm/mminit.c
ntoskrnl/mm/pagefile.c
ntoskrnl/mm/section.c
ntoskrnl/mm/sysldr.c
ntoskrnl/ntoskrnl-generic.rbuild
ntoskrnl/rtl/libsupp.c
subsystems/ntvdm/ntvdm.c
subsystems/win32/csrss/include/conio.h
subsystems/win32/csrss/win32csr/conio.c
subsystems/win32/csrss/win32csr/dllmain.c
subsystems/win32/csrss/win32csr/guiconsole.c
subsystems/win32/csrss/win32csr/guiconsole.h
subsystems/win32/csrss/win32csr/harderror.c
subsystems/win32/csrss/win32csr/tuiconsole.c
subsystems/win32/csrss/win32csr/w32csr.h
subsystems/win32/csrss/win32csr/win32csr.rbuild
subsystems/win32/win32k/dib/dib.c
subsystems/win32/win32k/dib/dib16bpp.c
subsystems/win32/win32k/dib/dib1bpp.c
subsystems/win32/win32k/dib/dib24bpp.c
subsystems/win32/win32k/dib/dib24bppc.c
subsystems/win32/win32k/dib/dib32bpp.c
subsystems/win32/win32k/dib/dib32bppc.c
subsystems/win32/win32k/dib/dib4bpp.c
subsystems/win32/win32k/dib/dib8bpp.c
subsystems/win32/win32k/dib/floodfill.c
subsystems/win32/win32k/dib/stretchblt.c
subsystems/win32/win32k/eng/alphablend.c
subsystems/win32/win32k/eng/bitblt.c
subsystems/win32/win32k/eng/clip.c
subsystems/win32/win32k/eng/copybits.c
subsystems/win32/win32k/eng/debug.c
subsystems/win32/win32k/eng/device.c
subsystems/win32/win32k/eng/driverobj.c
subsystems/win32/win32k/eng/engbrush.c
subsystems/win32/win32k/eng/engevent.c
subsystems/win32/win32k/eng/engmisc.c
subsystems/win32/win32k/eng/engwindow.c
subsystems/win32/win32k/eng/error.c
subsystems/win32/win32k/eng/float.c
subsystems/win32/win32k/eng/gradient.c
subsystems/win32/win32k/eng/lineto.c
subsystems/win32/win32k/eng/mapping.c
subsystems/win32/win32k/eng/mem.c
subsystems/win32/win32k/eng/mouse.c
subsystems/win32/win32k/eng/paint.c
subsystems/win32/win32k/eng/perfcnt.c
subsystems/win32/win32k/eng/semaphor.c
subsystems/win32/win32k/eng/sort.c
subsystems/win32/win32k/eng/stretchblt.c
subsystems/win32/win32k/eng/string.c
subsystems/win32/win32k/eng/surface.c
subsystems/win32/win32k/eng/transblt.c
subsystems/win32/win32k/eng/xlate.c
subsystems/win32/win32k/include/desktop.h
subsystems/win32/win32k/include/msgqueue.h
subsystems/win32/win32k/include/rect.h
subsystems/win32/win32k/include/timer.h
subsystems/win32/win32k/include/win32kp.h
subsystems/win32/win32k/include/window.h
subsystems/win32/win32k/ldr/loader.c
subsystems/win32/win32k/main/dllmain.c
subsystems/win32/win32k/misc/copy.c
subsystems/win32/win32k/misc/driver.c
subsystems/win32/win32k/misc/err.c
subsystems/win32/win32k/misc/file.c
subsystems/win32/win32k/misc/math.c
subsystems/win32/win32k/misc/registry.c
subsystems/win32/win32k/misc/rtlstr.c
subsystems/win32/win32k/misc/usrheap.c
subsystems/win32/win32k/ntddraw/d3d.c
subsystems/win32/win32k/ntddraw/dd.c
subsystems/win32/win32k/ntddraw/ddraw.c
subsystems/win32/win32k/ntddraw/ddsurf.c
subsystems/win32/win32k/ntddraw/dvp.c
subsystems/win32/win32k/ntddraw/dxeng.c
subsystems/win32/win32k/ntddraw/eng.c
subsystems/win32/win32k/ntddraw/mocomp.c
subsystems/win32/win32k/ntuser/accelerator.c
subsystems/win32/win32k/ntuser/callback.c
subsystems/win32/win32k/ntuser/callproc.c
subsystems/win32/win32k/ntuser/caret.c
subsystems/win32/win32k/ntuser/class.c
subsystems/win32/win32k/ntuser/clipboard.c
subsystems/win32/win32k/ntuser/csr.c
subsystems/win32/win32k/ntuser/cursoricon.c
subsystems/win32/win32k/ntuser/defwnd.c
subsystems/win32/win32k/ntuser/desktop.c
subsystems/win32/win32k/ntuser/display.c
subsystems/win32/win32k/ntuser/event.c
subsystems/win32/win32k/ntuser/focus.c
subsystems/win32/win32k/ntuser/guicheck.c
subsystems/win32/win32k/ntuser/hook.c
subsystems/win32/win32k/ntuser/hotkey.c
subsystems/win32/win32k/ntuser/input.c
subsystems/win32/win32k/ntuser/kbdlayout.c
subsystems/win32/win32k/ntuser/keyboard.c
subsystems/win32/win32k/ntuser/menu.c
subsystems/win32/win32k/ntuser/message.c
subsystems/win32/win32k/ntuser/metric.c
subsystems/win32/win32k/ntuser/misc.c
subsystems/win32/win32k/ntuser/monitor.c
subsystems/win32/win32k/ntuser/msgqueue.c
subsystems/win32/win32k/ntuser/ntstubs.c
subsystems/win32/win32k/ntuser/ntuser.c
subsystems/win32/win32k/ntuser/object.c
subsystems/win32/win32k/ntuser/painting.c
subsystems/win32/win32k/ntuser/prop.c
subsystems/win32/win32k/ntuser/scrollbar.c
subsystems/win32/win32k/ntuser/session.c
subsystems/win32/win32k/ntuser/simplecall.c
subsystems/win32/win32k/ntuser/sysparams.c
subsystems/win32/win32k/ntuser/timer.c
subsystems/win32/win32k/ntuser/useratom.c
subsystems/win32/win32k/ntuser/vis.c
subsystems/win32/win32k/ntuser/windc.c
subsystems/win32/win32k/ntuser/window.c
subsystems/win32/win32k/ntuser/winpos.c
subsystems/win32/win32k/ntuser/winsta.c
subsystems/win32/win32k/objects/arc.c
subsystems/win32/win32k/objects/bezier.c
subsystems/win32/win32k/objects/bitblt.c
subsystems/win32/win32k/objects/bitmaps.c
subsystems/win32/win32k/objects/brush.c
subsystems/win32/win32k/objects/cliprgn.c
subsystems/win32/win32k/objects/coord.c
subsystems/win32/win32k/objects/dcattr.c
subsystems/win32/win32k/objects/dclife.c
subsystems/win32/win32k/objects/dcobjs.c
subsystems/win32/win32k/objects/dcstate.c
subsystems/win32/win32k/objects/dcutil.c
subsystems/win32/win32k/objects/device.c
subsystems/win32/win32k/objects/dibobj.c
subsystems/win32/win32k/objects/drawing.c
subsystems/win32/win32k/objects/fillshap.c
subsystems/win32/win32k/objects/font.c
subsystems/win32/win32k/objects/freetype.c
subsystems/win32/win32k/objects/gdibatch.c
subsystems/win32/win32k/objects/gdidbg.c
subsystems/win32/win32k/objects/gdiobj.c
subsystems/win32/win32k/objects/icm.c
subsystems/win32/win32k/objects/line.c
subsystems/win32/win32k/objects/metafile.c
subsystems/win32/win32k/objects/palette.c
subsystems/win32/win32k/objects/path.c
subsystems/win32/win32k/objects/pen.c
subsystems/win32/win32k/objects/polyfill.c
subsystems/win32/win32k/objects/print.c
subsystems/win32/win32k/objects/rect.c
subsystems/win32/win32k/objects/region.c
subsystems/win32/win32k/objects/stockobj.c
subsystems/win32/win32k/objects/text.c
subsystems/win32/win32k/objects/wingl.c
subsystems/win32/win32k/objects/xformobj.c
subsystems/win32/win32k/pch.h
subsystems/win32/win32k/stubs/stubs.c
subsystems/win32/win32k/stubs/umpdstubs.c
subsystems/win32/win32k/win32k.h

diff --cc Makefile
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 492e388,b0c5059..b0c5059
Binary files differ
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 9650563,905f5ef..905f5ef
Binary files differ
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 0000000,974bd06..974bd06
mode 000000,100644..100644
--- /dev/null
Simple merge
Simple merge
Simple merge
index 0000000,b5e106b..b5e106b
mode 000000,100644..100644
--- /dev/null
index 0000000,aaac943..aaac943
mode 000000,100644..100644
--- /dev/null
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 0000000,28b5d3e..28b5d3e
mode 000000,100644..100644
--- /dev/null
Simple merge
Simple merge
Simple merge
index 0000000,60e4eff..60e4eff
mode 000000,100644..100644
--- /dev/null
index 1e3d9bc,0000000..e793d0a
mode 100644,000000..100644
--- /dev/null
@@@ -1,336 -1,0 +1,351 @@@
-     IMAGE_NT_HEADERS pehd;
 +/*
 + * Implementation of VERSION.DLL - Resource Access routines
 + *
 + * Copyright 1996,1997 Marcus Meissner
 + * Copyright 1997 David Cuthbert
 + * Copyright 1999 Ulrich Weigand
 + *
 + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 + */
 +
 +#include "config.h"
 +
 +#include <stdarg.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>
 +#include <sys/types.h>
 +#ifdef HAVE_UNISTD_H
 +# include <unistd.h>
 +#endif
 +
 +#define NONAMELESSUNION
 +#define NONAMELESSSTRUCT
 +#include "windef.h"
 +#include "winbase.h"
 +#include "lzexpand.h"
 +#include "winuser.h"
 +#include "winver.h"
 +#undef VS_FILE_INFO
 +#define VS_FILE_INFO 16
 +
 +#include "wine/unicode.h"
 +#include "wine/winbase16.h"
 +
 +#include "wine/debug.h"
 +
 +WINE_DEFAULT_DEBUG_CHANNEL(ver);
 +
 +
 +/**********************************************************************
 + *  find_entry_by_id
 + *
 + * Find an entry by id in a resource directory
 + * Copied from loader/pe_resource.c
 + */
 +static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DIRECTORY *dir,
 +                                                         WORD id, const void *root )
 +{
 +    const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
 +    int min, max, pos;
 +
 +    entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
 +    min = dir->NumberOfNamedEntries;
 +    max = min + dir->NumberOfIdEntries - 1;
 +    while (min <= max)
 +    {
 +        pos = (min + max) / 2;
 +        if (entry[pos].u.Id == id)
 +            return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s.OffsetToDirectory);
 +        if (entry[pos].u.Id > id) max = pos - 1;
 +        else min = pos + 1;
 +    }
 +    return NULL;
 +}
 +
 +
 +/**********************************************************************
 + *  find_entry_default
 + *
 + * Find a default entry in a resource directory
 + * Copied from loader/pe_resource.c
 + */
 +static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_DIRECTORY *dir,
 +                                                           const void *root )
 +{
 +    const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
 +
 +    entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
 +    return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s.OffsetToDirectory);
 +}
 +
 +
 +/***********************************************************************
 + *           read_xx_header         [internal]
 + */
 +static int read_xx_header( HFILE lzfd )
 +{
 +    IMAGE_DOS_HEADER mzh;
 +    char magic[3];
 +
 +    LZSeek( lzfd, 0, SEEK_SET );
 +    if ( sizeof(mzh) != LZRead( lzfd, (LPSTR)&mzh, sizeof(mzh) ) )
 +        return 0;
 +    if ( mzh.e_magic != IMAGE_DOS_SIGNATURE )
 +    {
 +        if (!memcmp( &mzh, "\177ELF", 4 )) return 1;  /* ELF */
 +        if (*(UINT *)&mzh == 0xfeedface || *(UINT *)&mzh == 0xcefaedfe) return 1;  /* Mach-O */
 +        return 0;
 +    }
 +
 +    LZSeek( lzfd, mzh.e_lfanew, SEEK_SET );
 +    if ( 2 != LZRead( lzfd, magic, 2 ) )
 +        return 0;
 +
 +    LZSeek( lzfd, mzh.e_lfanew, SEEK_SET );
 +
 +    if ( magic[0] == 'N' && magic[1] == 'E' )
 +        return IMAGE_OS2_SIGNATURE;
 +    if ( magic[0] == 'P' && magic[1] == 'E' )
 +        return IMAGE_NT_SIGNATURE;
 +
 +    magic[2] = '\0';
 +    WARN("Can't handle %s files.\n", magic );
 +    return 0;
 +}
 +
 +/***********************************************************************
 + *           find_ne_resource         [internal]
 + */
 +static BOOL find_ne_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
 +{
 +    const WORD typeid = VS_FILE_INFO | 0x8000;
 +    const WORD resid = VS_VERSION_INFO | 0x8000;
 +    IMAGE_OS2_HEADER nehd;
 +    NE_TYPEINFO *typeInfo;
 +    NE_NAMEINFO *nameInfo;
 +    DWORD nehdoffset;
 +    LPBYTE resTab;
 +    DWORD resTabSize;
 +    int count;
 +
 +    /* Read in NE header */
 +    nehdoffset = LZSeek( lzfd, 0, SEEK_CUR );
 +    if ( sizeof(nehd) != LZRead( lzfd, (LPSTR)&nehd, sizeof(nehd) ) ) return 0;
 +
 +    resTabSize = nehd.ne_restab - nehd.ne_rsrctab;
 +    if ( !resTabSize )
 +    {
 +        TRACE("No resources in NE dll\n" );
 +        return FALSE;
 +    }
 +
 +    /* Read in resource table */
 +    resTab = HeapAlloc( GetProcessHeap(), 0, resTabSize );
 +    if ( !resTab ) return FALSE;
 +
 +    LZSeek( lzfd, nehd.ne_rsrctab + nehdoffset, SEEK_SET );
 +    if ( resTabSize != LZRead( lzfd, (char*)resTab, resTabSize ) )
 +    {
 +        HeapFree( GetProcessHeap(), 0, resTab );
 +        return FALSE;
 +    }
 +
 +    /* Find resource */
 +    typeInfo = (NE_TYPEINFO *)(resTab + 2);
 +    while (typeInfo->type_id)
 +    {
 +        if (typeInfo->type_id == typeid) goto found_type;
 +        typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) +
 +                                   typeInfo->count * sizeof(NE_NAMEINFO));
 +    }
 +    TRACE("No typeid entry found\n" );
 +    HeapFree( GetProcessHeap(), 0, resTab );
 +    return FALSE;
 +
 + found_type:
 +    nameInfo = (NE_NAMEINFO *)(typeInfo + 1);
 +
 +    for (count = typeInfo->count; count > 0; count--, nameInfo++)
 +        if (nameInfo->id == resid) goto found_name;
 +
 +    TRACE("No resid entry found\n" );
 +    HeapFree( GetProcessHeap(), 0, resTab );
 +    return FALSE;
 +
 + found_name:
 +    /* Return resource data */
 +    if ( resLen ) *resLen = nameInfo->length << *(WORD *)resTab;
 +    if ( resOff ) *resOff = nameInfo->offset << *(WORD *)resTab;
 +
 +    HeapFree( GetProcessHeap(), 0, resTab );
 +    return TRUE;
 +}
 +
 +/***********************************************************************
 + *           find_pe_resource         [internal]
 + */
 +static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
 +{
-     int i, nSections;
++    union
++    {
++        IMAGE_NT_HEADERS32 nt32;
++        IMAGE_NT_HEADERS64 nt64;
++    } pehd;
 +    DWORD pehdoffset;
 +    PIMAGE_DATA_DIRECTORY resDataDir;
 +    PIMAGE_SECTION_HEADER sections;
 +    LPBYTE resSection;
 +    DWORD resSectionSize;
 +    const void *resDir;
 +    const IMAGE_RESOURCE_DIRECTORY *resPtr;
 +    const IMAGE_RESOURCE_DATA_ENTRY *resData;
-     if ( sizeof(pehd) != LZRead( lzfd, (LPSTR)&pehd, sizeof(pehd) ) ) return 0;
++    int i, len, nSections;
 +    BOOL ret = FALSE;
 +
 +    /* Read in PE header */
 +    pehdoffset = LZSeek( lzfd, 0, SEEK_CUR );
-     resDataDir = pehd.OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE;
++    len = LZRead( lzfd, (LPSTR)&pehd, sizeof(pehd) );
++    if (len < sizeof(pehd.nt32.FileHeader)) return 0;
++    if (len < sizeof(pehd)) memset( (char *)&pehd + len, 0, sizeof(pehd) - len );
++
++    switch (pehd.nt32.OptionalHeader.Magic)
++    {
++    case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
++        resDataDir = pehd.nt32.OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_RESOURCE;
++        break;
++    case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
++        resDataDir = pehd.nt64.OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_RESOURCE;
++        break;
++    default:
++        return 0;
++    }
 +
-     nSections = pehd.FileHeader.NumberOfSections;
 +    if ( !resDataDir->Size )
 +    {
 +        TRACE("No resources in PE dll\n" );
 +        return FALSE;
 +    }
 +
 +    /* Read in section table */
-     LZSeek( lzfd, pehdoffset +
-                     sizeof(DWORD) + /* Signature */
-                     sizeof(IMAGE_FILE_HEADER) +
-                     pehd.FileHeader.SizeOfOptionalHeader, SEEK_SET );
++    nSections = pehd.nt32.FileHeader.NumberOfSections;
 +    sections = HeapAlloc( GetProcessHeap(), 0,
 +                          nSections * sizeof(IMAGE_SECTION_HEADER) );
 +    if ( !sections ) return FALSE;
 +
++    len = FIELD_OFFSET( IMAGE_NT_HEADERS32, OptionalHeader ) + pehd.nt32.FileHeader.SizeOfOptionalHeader;
++    LZSeek( lzfd, pehdoffset + len, SEEK_SET );
 +
 +    if ( nSections * sizeof(IMAGE_SECTION_HEADER) !=
 +         LZRead( lzfd, (LPSTR)sections, nSections * sizeof(IMAGE_SECTION_HEADER) ) )
 +    {
 +        HeapFree( GetProcessHeap(), 0, sections );
 +        return FALSE;
 +    }
 +
 +    /* Find resource section */
 +    for ( i = 0; i < nSections; i++ )
 +        if (    resDataDir->VirtualAddress >= sections[i].VirtualAddress
 +             && resDataDir->VirtualAddress <  sections[i].VirtualAddress +
 +                                              sections[i].SizeOfRawData )
 +            break;
 +
 +    if ( i == nSections )
 +    {
 +        HeapFree( GetProcessHeap(), 0, sections );
 +        TRACE("Couldn't find resource section\n" );
 +        return FALSE;
 +    }
 +
 +    /* Read in resource section */
 +    resSectionSize = sections[i].SizeOfRawData;
 +    resSection = HeapAlloc( GetProcessHeap(), 0, resSectionSize );
 +    if ( !resSection )
 +    {
 +        HeapFree( GetProcessHeap(), 0, sections );
 +        return FALSE;
 +    }
 +
 +    LZSeek( lzfd, sections[i].PointerToRawData, SEEK_SET );
 +    if ( resSectionSize != LZRead( lzfd, (char*)resSection, resSectionSize ) ) goto done;
 +
 +    /* Find resource */
 +    resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress);
 +
 +    resPtr = resDir;
 +    resPtr = find_entry_by_id( resPtr, VS_FILE_INFO, resDir );
 +    if ( !resPtr )
 +    {
 +        TRACE("No typeid entry found\n" );
 +        goto done;
 +    }
 +    resPtr = find_entry_by_id( resPtr, VS_VERSION_INFO, resDir );
 +    if ( !resPtr )
 +    {
 +        TRACE("No resid entry found\n" );
 +        goto done;
 +    }
 +    resPtr = find_entry_default( resPtr, resDir );
 +    if ( !resPtr )
 +    {
 +        TRACE("No default language entry found\n" );
 +        goto done;
 +    }
 +
 +    /* Find resource data section */
 +    resData = (const IMAGE_RESOURCE_DATA_ENTRY*)resPtr;
 +    for ( i = 0; i < nSections; i++ )
 +        if (    resData->OffsetToData >= sections[i].VirtualAddress
 +             && resData->OffsetToData <  sections[i].VirtualAddress +
 +                                         sections[i].SizeOfRawData )
 +            break;
 +
 +    if ( i == nSections )
 +    {
 +        TRACE("Couldn't find resource data section\n" );
 +        goto done;
 +    }
 +
 +    /* Return resource data */
 +    if ( resLen ) *resLen = resData->Size;
 +    if ( resOff ) *resOff = resData->OffsetToData - sections[i].VirtualAddress
 +                            + sections[i].PointerToRawData;
 +    ret = TRUE;
 +
 + done:
 +    HeapFree( GetProcessHeap(), 0, resSection );
 +    HeapFree( GetProcessHeap(), 0, sections );
 +    return ret;
 +}
 +
 +
 +/***********************************************************************
 + *           find_version_resource         [internal]
 + */
 +DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset )
 +{
 +    DWORD magic = read_xx_header( lzfd );
 +
 +    switch (magic)
 +    {
 +    case IMAGE_OS2_SIGNATURE:
 +        if (!find_ne_resource( lzfd, reslen, offset )) magic = 0;
 +        break;
 +    case IMAGE_NT_SIGNATURE:
 +        if (!find_pe_resource( lzfd, reslen, offset )) magic = 0;
 +        break;
 +    }
 +    return magic;
 +}
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 8bf88f2,0000000..4c339b6
mode 100644,000000..100644
--- /dev/null
@@@ -1,1540 -1,0 +1,1541 @@@
-    /* Check if NOVESA is present in the start options */
-    if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA"))
 +/*
 + * VideoPort driver
 + *
 + * Copyright (C) 2002-2004, 2007 ReactOS Team
 + *
 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 + *
 + */
 +
 +
 +#include "videoprt.h"
 +#include <wdmguid.h>
 +
 +/* GLOBAL VARIABLES ***********************************************************/
 +
 +ULONG CsrssInitialized = FALSE;
 +PKPROCESS Csrss = NULL;
 +ULONG VideoPortDeviceNumber = 0;
 +
 +/* PRIVATE FUNCTIONS **********************************************************/
 +
 +ULONG NTAPI
 +DriverEntry(
 +   IN PVOID Context1,
 +   IN PVOID Context2)
 +{
 +   return STATUS_SUCCESS;
 +}
 +
 +PVOID NTAPI
 +IntVideoPortImageDirectoryEntryToData(
 +   PVOID BaseAddress,
 +   ULONG Directory)
 +{
 +   PIMAGE_NT_HEADERS NtHeader;
 +   ULONG Va;
 +
 +   NtHeader = RtlImageNtHeader(BaseAddress);
 +   if (NtHeader == NULL)
 +      return NULL;
 +
 +   if (Directory >= NtHeader->OptionalHeader.NumberOfRvaAndSizes)
 +      return NULL;
 +
 +   Va = NtHeader->OptionalHeader.DataDirectory[Directory].VirtualAddress;
 +   if (Va == 0)
 +      return NULL;
 +
 +   return (PVOID)((ULONG_PTR)BaseAddress + Va);
 +}
 +
 +VOID NTAPI
 +IntVideoPortDeferredRoutine(
 +   IN PKDPC Dpc,
 +   IN PVOID DeferredContext,
 +   IN PVOID SystemArgument1,
 +   IN PVOID SystemArgument2)
 +{
 +   PVOID HwDeviceExtension =
 +      &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
 +   ((PMINIPORT_DPC_ROUTINE)SystemArgument1)(HwDeviceExtension, SystemArgument2);
 +}
 +
 +NTSTATUS
 +IntCreateRegistryPath(
 +   IN PCUNICODE_STRING DriverRegistryPath,
 +   OUT PUNICODE_STRING DeviceRegistryPath)
 +{
 +   static WCHAR RegistryMachineSystem[] = L"\\REGISTRY\\MACHINE\\SYSTEM\\";
 +   static WCHAR CurrentControlSet[] = L"CURRENTCONTROLSET\\";
 +   static WCHAR ControlSet[] = L"CONTROLSET";
 +   static WCHAR Insert1[] = L"Hardware Profiles\\Current\\System\\CurrentControlSet\\";
 +   static WCHAR Insert2[] = L"\\Device0";
 +   LPWSTR ProfilePath = NULL;
 +   BOOLEAN Valid;
 +   PWCHAR AfterControlSet;
 +
 +   Valid = (0 == _wcsnicmp(DriverRegistryPath->Buffer, RegistryMachineSystem,
 +                          wcslen(RegistryMachineSystem)));
 +   {
 +      AfterControlSet = DriverRegistryPath->Buffer + wcslen(RegistryMachineSystem);
 +      if (0 == _wcsnicmp(AfterControlSet, CurrentControlSet, wcslen(CurrentControlSet)))
 +      {
 +         AfterControlSet += wcslen(CurrentControlSet);
 +      }
 +      else if (0 == _wcsnicmp(AfterControlSet, ControlSet, wcslen(ControlSet)))
 +      {
 +         AfterControlSet += wcslen(ControlSet);
 +         while (L'0' <= *AfterControlSet && L'9' <= *AfterControlSet)
 +         {
 +            AfterControlSet++;
 +         }
 +         Valid = (L'\\' == *AfterControlSet);
 +         AfterControlSet++;
 +      }
 +      else
 +      {
 +         Valid = FALSE;
 +      }
 +   }
 +
 +   if (Valid)
 +   {
 +      ProfilePath = ExAllocatePoolWithTag(PagedPool,
 +                                          (wcslen(DriverRegistryPath->Buffer) +
 +                                           wcslen(Insert1) + wcslen(Insert2) + 1) * sizeof(WCHAR),
 +                                          TAG_VIDEO_PORT);
 +      if (NULL != ProfilePath)
 +      {
 +         wcsncpy(ProfilePath, DriverRegistryPath->Buffer, AfterControlSet - DriverRegistryPath->Buffer);
 +         wcscpy(ProfilePath + (AfterControlSet - DriverRegistryPath->Buffer), Insert1);
 +         wcscat(ProfilePath, AfterControlSet);
 +         wcscat(ProfilePath, Insert2);
 +
 +         Valid = NT_SUCCESS(RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, ProfilePath));
 +      }
 +      else
 +      {
 +         Valid = FALSE;
 +      }
 +   }
 +   else
 +   {
 +      WARN_(VIDEOPRT, "Unparsable registry path %wZ", DriverRegistryPath);
 +   }
 +
 +   if (Valid)
 +   {
 +      RtlInitUnicodeString(DeviceRegistryPath, ProfilePath);
 +   }
 +   else
 +   {
 +      if (ProfilePath)
 +         ExFreePoolWithTag(ProfilePath, TAG_VIDEO_PORT);
 +
 +      DeviceRegistryPath->Length =
 +      DeviceRegistryPath->MaximumLength =
 +         DriverRegistryPath->Length + (9 * sizeof(WCHAR));
 +      DeviceRegistryPath->Length -= sizeof(WCHAR);
 +      DeviceRegistryPath->Buffer = ExAllocatePoolWithTag(
 +         NonPagedPool,
 +         DeviceRegistryPath->MaximumLength,
 +         TAG_VIDEO_PORT);
 +      if (!DeviceRegistryPath->Buffer)
 +         return STATUS_NO_MEMORY;
 +      swprintf(DeviceRegistryPath->Buffer, L"%s\\Device0",
 +         DriverRegistryPath->Buffer);
 +   }
 +   return STATUS_SUCCESS;
 +}
 +
 +NTSTATUS NTAPI
 +IntVideoPortCreateAdapterDeviceObject(
 +   IN PDRIVER_OBJECT DriverObject,
 +   IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
 +   IN PDEVICE_OBJECT PhysicalDeviceObject,
 +   OUT PDEVICE_OBJECT *DeviceObject  OPTIONAL)
 +{
 +   PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
 +   ULONG DeviceNumber;
 +   ULONG PciSlotNumber;
 +   PCI_SLOT_NUMBER SlotNumber;
 +   ULONG Size;
 +   NTSTATUS Status;
 +   WCHAR DeviceBuffer[20];
 +   UNICODE_STRING DeviceName;
 +   PDEVICE_OBJECT DeviceObject_;
 +
 +   if (DeviceObject == NULL)
 +      DeviceObject = &DeviceObject_;
 +
 +   /*
 +    * Find the first free device number that can be used for video device
 +    * object names and symlinks.
 +    */
 +
 +   DeviceNumber = VideoPortDeviceNumber;
 +   if (DeviceNumber == 0xFFFFFFFF)
 +   {
 +      WARN_(VIDEOPRT, "Can't find free device number\n");
 +      return STATUS_UNSUCCESSFUL;
 +   }
 +
 +   /*
 +    * Create the device object.
 +    */
 +
 +   /* Create a unicode device name. */
 +   swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
 +   RtlInitUnicodeString(&DeviceName, DeviceBuffer);
 +
 +   INFO_(VIDEOPRT, "HwDeviceExtension size is: 0x%x\n",
 +       DriverExtension->InitializationData.HwDeviceExtensionSize);
 +
 +   /* Create the device object. */
 +   Status = IoCreateDevice(
 +      DriverObject,
 +      sizeof(VIDEO_PORT_DEVICE_EXTENSION) +
 +      DriverExtension->InitializationData.HwDeviceExtensionSize,
 +      &DeviceName,
 +      FILE_DEVICE_VIDEO,
 +      0,
 +      TRUE,
 +      DeviceObject);
 +
 +   if (!NT_SUCCESS(Status))
 +   {
 +      WARN_(VIDEOPRT, "IoCreateDevice call failed with status 0x%08x\n", Status);
 +      return Status;
 +   }
 +
 +   /*
 +    * Set the buffering strategy here. If you change this, remember
 +    * to change VidDispatchDeviceControl too.
 +    */
 +
 +   (*DeviceObject)->Flags |= DO_BUFFERED_IO;
 +
 +   /*
 +    * Initialize device extension.
 +    */
 +
 +   DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)((*DeviceObject)->DeviceExtension);
 +   DeviceExtension->DeviceNumber = DeviceNumber;
 +   DeviceExtension->DriverObject = DriverObject;
 +   DeviceExtension->PhysicalDeviceObject = PhysicalDeviceObject;
 +   DeviceExtension->FunctionalDeviceObject = *DeviceObject;
 +   DeviceExtension->DriverExtension = DriverExtension;
 +
 +   /*
 +    * Get the registry path associated with this driver.
 +    */
 +
 +   Status = IntCreateRegistryPath(
 +      &DriverExtension->RegistryPath,
 +      &DeviceExtension->RegistryPath);
 +   if (!NT_SUCCESS(Status))
 +   {
 +      WARN_(VIDEOPRT, "IntCreateRegistryPath() call failed with status 0x%08x\n", Status);
 +      IoDeleteDevice(*DeviceObject);
 +      *DeviceObject = NULL;
 +      return Status;
 +   }
 +
 +   if (PhysicalDeviceObject != NULL)
 +   {
 +      /* Get bus number from the upper level bus driver. */
 +      Size = sizeof(ULONG);
 +      Status = IoGetDeviceProperty(
 +         PhysicalDeviceObject,
 +         DevicePropertyBusNumber,
 +         Size,
 +         &DeviceExtension->SystemIoBusNumber,
 +         &Size);
 +      if (!NT_SUCCESS(Status))
 +      {
 +         WARN_(VIDEOPRT, "Couldn't get an information from bus driver. We will try to\n"
 +                "use legacy detection method, but even that doesn't mean that\n"
 +                "it will work.\n");
 +         DeviceExtension->PhysicalDeviceObject = NULL;
 +      }
 +   }
 +
 +   DeviceExtension->AdapterInterfaceType =
 +      DriverExtension->InitializationData.AdapterInterfaceType;
 +
 +   if (PhysicalDeviceObject != NULL)
 +   {
 +      /* Get bus type from the upper level bus driver. */
 +      Size = sizeof(ULONG);
 +      IoGetDeviceProperty(
 +         PhysicalDeviceObject,
 +         DevicePropertyLegacyBusType,
 +         Size,
 +         &DeviceExtension->AdapterInterfaceType,
 +         &Size);
 +
 +      /* Get bus device address from the upper level bus driver. */
 +      Size = sizeof(ULONG);
 +      IoGetDeviceProperty(
 +         PhysicalDeviceObject,
 +         DevicePropertyAddress,
 +         Size,
 +         &PciSlotNumber,
 +         &Size);
 +
 +        /* Convert slotnumber to PCI_SLOT_NUMBER */
 +        SlotNumber.u.AsULONG = 0;
 +        SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
 +        SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
 +        DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
 +   }
 +
 +   InitializeListHead(&DeviceExtension->AddressMappingListHead);
 +   KeInitializeDpc(
 +      &DeviceExtension->DpcObject,
 +      IntVideoPortDeferredRoutine,
 +      DeviceExtension);
 +
 +   KeInitializeMutex(&DeviceExtension->DeviceLock, 0);
 +
 +   /* Attach the device. */
 +   if (PhysicalDeviceObject != NULL)
 +      DeviceExtension->NextDeviceObject = IoAttachDeviceToDeviceStack(
 +         *DeviceObject, PhysicalDeviceObject);
 +
 +   /* Remove the initailizing flag */
 +   (*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
 +   return STATUS_SUCCESS;
 +}
 +
 +
 +NTSTATUS NTAPI
 +IntVideoPortFindAdapter(
 +   IN PDRIVER_OBJECT DriverObject,
 +   IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
 +   IN PDEVICE_OBJECT DeviceObject)
 +{
 +   WCHAR DeviceVideoBuffer[20];
 +   PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
 +   SIZE_T Size;
 +   NTSTATUS Status;
 +   VIDEO_PORT_CONFIG_INFO ConfigInfo;
 +   SYSTEM_BASIC_INFORMATION SystemBasicInfo;
 +   UCHAR Again = FALSE;
 +   WCHAR DeviceBuffer[20];
 +   UNICODE_STRING DeviceName;
 +   WCHAR SymlinkBuffer[20];
 +   UNICODE_STRING SymlinkName;
 +   BOOL LegacyDetection = FALSE;
 +   ULONG DeviceNumber, DisplayNumber;
 +
 +   DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 +   DeviceNumber = DeviceExtension->DeviceNumber;
 +
 +   /*
 +    * Setup a ConfigInfo structure that we will pass to HwFindAdapter.
 +    */
 +
 +   RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
 +   ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
 +   ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
 +   if (ConfigInfo.AdapterInterfaceType == PCIBus)
 +      ConfigInfo.InterruptMode = LevelSensitive;
 +   else
 +      ConfigInfo.InterruptMode = Latched;
 +   ConfigInfo.DriverRegistryPath = DriverExtension->RegistryPath.Buffer;
 +   ConfigInfo.VideoPortGetProcAddress = IntVideoPortGetProcAddress;
 +   ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
 +   ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
 +   ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
 +
 +   Size = sizeof(SystemBasicInfo);
 +   Status = ZwQuerySystemInformation(
 +      SystemBasicInformation,
 +      &SystemBasicInfo,
 +      Size,
 +      &Size);
 +
 +   if (NT_SUCCESS(Status))
 +   {
 +      ConfigInfo.SystemMemorySize =
 +         SystemBasicInfo.NumberOfPhysicalPages *
 +         SystemBasicInfo.PageSize;
 +   }
 +
 +   /*
 +    * Call miniport HwVidFindAdapter entry point to detect if
 +    * particular device is present. There are two possible code
 +    * paths. The first one is for Legacy drivers (NT4) and cases
 +    * when we don't have information about what bus we're on. The
 +    * second case is the standard one for Plug & Play drivers.
 +    */
 +   if (DeviceExtension->PhysicalDeviceObject == NULL)
 +   {
 +      LegacyDetection = TRUE;
 +   }
 +
 +   if (LegacyDetection)
 +   {
 +      ULONG BusNumber, MaxBuses;
 +
 +      MaxBuses = DeviceExtension->AdapterInterfaceType == PCIBus ? 8 : 1;
 +
 +      for (BusNumber = 0; BusNumber < MaxBuses; BusNumber++)
 +      {
 +         DeviceExtension->SystemIoBusNumber =
 +         ConfigInfo.SystemIoBusNumber = BusNumber;
 +
 +         RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
 +                       DriverExtension->InitializationData.HwDeviceExtensionSize);
 +
 +         /* FIXME: Need to figure out what string to pass as param 3. */
 +         Status = DriverExtension->InitializationData.HwFindAdapter(
 +            &DeviceExtension->MiniPortDeviceExtension,
 +            DriverExtension->HwContext,
 +            NULL,
 +            &ConfigInfo,
 +            &Again);
 +
 +         if (Status == ERROR_DEV_NOT_EXIST)
 +         {
 +            continue;
 +         }
 +         else if (Status == NO_ERROR)
 +         {
 +            break;
 +         }
 +         else
 +         {
 +            WARN_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
 +            RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
 +            if (DeviceExtension->NextDeviceObject)
 +                IoDetachDevice(DeviceExtension->NextDeviceObject);
 +            IoDeleteDevice(DeviceObject);
 +
 +            return Status;
 +         }
 +      }
 +   }
 +   else
 +   {
 +      /* FIXME: Need to figure out what string to pass as param 3. */
 +      Status = DriverExtension->InitializationData.HwFindAdapter(
 +         &DeviceExtension->MiniPortDeviceExtension,
 +         DriverExtension->HwContext,
 +         NULL,
 +         &ConfigInfo,
 +         &Again);
 +   }
 +
 +   if (Status != NO_ERROR)
 +   {
 +      WARN_(VIDEOPRT, "HwFindAdapter call failed with error 0x%X\n", Status);
 +      RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
 +      if (DeviceExtension->NextDeviceObject)
 +          IoDetachDevice(DeviceExtension->NextDeviceObject);
 +      IoDeleteDevice(DeviceObject);
 +      return Status;
 +   }
 +
 +   /*
 +    * Now we know the device is present, so let's do all additional tasks
 +    * such as creating symlinks or setting up interrupts and timer.
 +    */
 +
 +   /* Create a unicode device name. */
 +   swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
 +   RtlInitUnicodeString(&DeviceName, DeviceBuffer);
 +
 +   /* Create symbolic link "\??\DISPLAYx" */
 +
 +   /* HACK: We need this to find the first available display to
 +    * use. We can't use the device number because then we could
 +    * end up with \Device\Video0 being non-functional because
 +    * HwFindAdapter returned an error. \Device\Video1 would be
 +    * the correct primary display but it would be set to DISPLAY2
 +    * so it would never be used and ROS would bugcheck on boot.
 +    * By doing it this way, we ensure that DISPLAY1 is always
 +    * functional. Another idea would be letting the IO manager
 +    * give our video devices names then getting those names
 +    * somehow and creating symbolic links to \Device\VideoX
 +    * and \??\DISPLAYX once we know that HwFindAdapter has succeeded.
 +    */
 +   DisplayNumber = 0;
 +   do
 +   {
 +      DisplayNumber++;
 +      swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DisplayNumber);
 +      RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
 +   }
 +   while (IoCreateSymbolicLink(&SymlinkName, &DeviceName) != STATUS_SUCCESS);
 +
 +   /* Add entry to DEVICEMAP\VIDEO key in registry. */
 +   swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DisplayNumber - 1);
 +   RtlWriteRegistryValue(
 +      RTL_REGISTRY_DEVICEMAP,
 +      L"VIDEO",
 +      DeviceVideoBuffer,
 +      REG_SZ,
 +      DeviceExtension->RegistryPath.Buffer,
 +      DeviceExtension->RegistryPath.MaximumLength);
 +
 +   RtlWriteRegistryValue(
 +       RTL_REGISTRY_DEVICEMAP,
 +       L"VIDEO",
 +       L"MaxObjectNumber",
 +       REG_DWORD,
 +       &DeviceNumber,
 +       sizeof(DeviceNumber));
 +
 +   /* FIXME: Allocate hardware resources for device. */
 +
 +   /*
 +    * Allocate interrupt for device.
 +    */
 +
 +   if (!IntVideoPortSetupInterrupt(DeviceObject, DriverExtension, &ConfigInfo))
 +   {
 +      RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
 +      if (DeviceExtension->NextDeviceObject)
 +          IoDetachDevice(DeviceExtension->NextDeviceObject);
 +      IoDeleteDevice(DeviceObject);
 +      return STATUS_INSUFFICIENT_RESOURCES;
 +   }
 +
 +   /*
 +    * Allocate timer for device.
 +    */
 +
 +   if (!IntVideoPortSetupTimer(DeviceObject, DriverExtension))
 +   {
 +      if (DeviceExtension->InterruptObject != NULL)
 +         IoDisconnectInterrupt(DeviceExtension->InterruptObject);
 +      if (DeviceExtension->NextDeviceObject)
 +          IoDetachDevice(DeviceExtension->NextDeviceObject);
 +      RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
 +      IoDeleteDevice(DeviceObject);
 +      WARN_(VIDEOPRT, "STATUS_INSUFFICIENT_RESOURCES\n");
 +      return STATUS_INSUFFICIENT_RESOURCES;
 +   }
 +
 +   /*
 +    * Query children of the device.
 +    */
 +   VideoPortEnumerateChildren(&DeviceExtension->MiniPortDeviceExtension, NULL);
 +
 +   INFO_(VIDEOPRT, "STATUS_SUCCESS\n");
 +   return STATUS_SUCCESS;
 +}
 +
 +VOID FASTCALL
 +IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
 +{
 +   *CallingProcess = (PKPROCESS)PsGetCurrentProcess();
 +   if (*CallingProcess != Csrss)
 +   {
 +      KeStackAttachProcess(Csrss, ApcState);
 +   }
 +}
 +
 +VOID FASTCALL
 +IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState)
 +{
 +   if (*CallingProcess != Csrss)
 +   {
 +      KeUnstackDetachProcess(ApcState);
 +   }
 +}
 +
 +/* PUBLIC FUNCTIONS ***********************************************************/
 +
 +/*
 + * @implemented
 + */
 +
 +ULONG NTAPI
 +VideoPortInitialize(
 +   IN PVOID Context1,
 +   IN PVOID Context2,
 +   IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
 +   IN PVOID HwContext)
 +{
 +   PDRIVER_OBJECT DriverObject = Context1;
 +   PUNICODE_STRING RegistryPath = Context2;
 +   NTSTATUS Status;
 +   PVIDEO_PORT_DRIVER_EXTENSION DriverExtension;
 +   BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE;
 +
 +   TRACE_(VIDEOPRT, "VideoPortInitialize\n");
 +
 +   /*
 +    * As a first thing do parameter checks.
 +    */
 +
 +   if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
 +   {
 +      return STATUS_REVISION_MISMATCH;
 +   }
 +
 +   if (HwInitializationData->HwFindAdapter == NULL ||
 +       HwInitializationData->HwInitialize == NULL ||
 +       HwInitializationData->HwStartIO == NULL)
 +   {
 +      return STATUS_INVALID_PARAMETER;
 +   }
 +
 +   switch (HwInitializationData->HwInitDataSize)
 +   {
 +      /*
 +       * NT4 drivers are special case, because we must use legacy method
 +       * of detection instead of the Plug & Play one.
 +       */
 +
 +      case SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA:
 +         INFO_(VIDEOPRT, "We were loaded by a Windows NT miniport driver.\n");
 +         break;
 +
 +      case SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA:
 +         INFO_(VIDEOPRT, "We were loaded by a Windows 2000 miniport driver.\n");
 +         break;
 +
 +      case sizeof(VIDEO_HW_INITIALIZATION_DATA):
 +         INFO_(VIDEOPRT, "We were loaded by a Windows XP or later miniport driver.\n");
 +         break;
 +
 +      default:
 +         WARN_(VIDEOPRT, "Invalid HwInitializationData size.\n");
 +         return STATUS_UNSUCCESSFUL;
 +   }
 +
 +   /* Set dispatching routines */
 +   DriverObject->MajorFunction[IRP_MJ_CREATE] = IntVideoPortDispatchOpen;
 +   DriverObject->MajorFunction[IRP_MJ_CLOSE] = IntVideoPortDispatchClose;
 +   DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
 +       IntVideoPortDispatchDeviceControl;
 +   DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] =
 +       IntVideoPortDispatchDeviceControl;
 +   DriverObject->MajorFunction[IRP_MJ_WRITE] =
 +       IntVideoPortDispatchWrite; // ReactOS-specific hack
 +   DriverObject->DriverUnload = IntVideoPortUnload;
 +
 +   /* Determine type of the miniport driver */
 +   if ((HwInitializationData->HwInitDataSize >=
 +        FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwQueryInterface))
 +       && HwInitializationData->HwSetPowerState
 +       && HwInitializationData->HwGetPowerState
 +       && HwInitializationData->HwGetVideoChildDescriptor)
 +   {
 +       INFO_(VIDEOPRT, "The miniport is a PnP miniport driver\n");
 +       PnpDriver = TRUE;
 +   }
 +
 +   /* Check if legacy detection should be applied */
 +   if (!PnpDriver || HwContext)
 +   {
 +       INFO_(VIDEOPRT, "Legacy detection for adapter interface %d\n",
 +           HwInitializationData->AdapterInterfaceType);
 +
 +       /* FIXME: Move the code for legacy detection
 +          to another function and call it here */
 +       LegacyDetection = TRUE;
 +   }
 +
 +   /*
 +    * NOTE:
 +    * The driver extension can be already allocated in case that we were
 +    * called by legacy driver and failed detecting device. Some miniport
 +    * drivers in that case adjust parameters and call VideoPortInitialize
 +    * again.
 +    */
 +
 +   DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
 +   if (DriverExtension == NULL)
 +   {
 +      Status = IoAllocateDriverObjectExtension(
 +         DriverObject,
 +         DriverObject,
 +         sizeof(VIDEO_PORT_DRIVER_EXTENSION),
 +         (PVOID *)&DriverExtension);
 +
 +      if (!NT_SUCCESS(Status))
 +      {
 +         return Status;
 +      }
 +
 +      /*
 +       * Save the registry path. This should be done only once even if
 +       * VideoPortInitialize is called multiple times.
 +       */
 +
 +      if (RegistryPath->Length != 0)
 +      {
 +         DriverExtension->RegistryPath.Length = 0;
 +         DriverExtension->RegistryPath.MaximumLength =
 +            RegistryPath->Length + sizeof(UNICODE_NULL);
 +         DriverExtension->RegistryPath.Buffer =
 +            ExAllocatePoolWithTag(
 +               PagedPool,
 +               DriverExtension->RegistryPath.MaximumLength,
 +               'RTSU');
 +         if (DriverExtension->RegistryPath.Buffer == NULL)
 +         {
 +            RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
 +            return STATUS_INSUFFICIENT_RESOURCES;
 +         }
 +
 +         RtlCopyUnicodeString(&DriverExtension->RegistryPath, RegistryPath);
 +         INFO_(VIDEOPRT, "RegistryPath: %wZ\n", &DriverExtension->RegistryPath);
 +      }
 +      else
 +      {
 +         RtlInitUnicodeString(&DriverExtension->RegistryPath, NULL);
 +      }
 +   }
 +
 +   /*
 +    * Copy the correct miniport initialization data to the device extension.
 +    */
 +
 +   RtlCopyMemory(
 +      &DriverExtension->InitializationData,
 +      HwInitializationData,
 +      HwInitializationData->HwInitDataSize);
 +   if (HwInitializationData->HwInitDataSize <
 +       sizeof(VIDEO_HW_INITIALIZATION_DATA))
 +   {
 +      RtlZeroMemory((PVOID)((ULONG_PTR)&DriverExtension->InitializationData +
 +                                       HwInitializationData->HwInitDataSize),
 +                    sizeof(VIDEO_HW_INITIALIZATION_DATA) -
 +                    HwInitializationData->HwInitDataSize);
 +   }
 +   DriverExtension->HwContext = HwContext;
 +
 +   /*
 +    * Plug & Play drivers registers the device in AddDevice routine. For
 +    * legacy drivers we must do it now.
 +    */
 +
 +   if (LegacyDetection)
 +   {
 +      PDEVICE_OBJECT DeviceObject;
 +
 +      if (HwInitializationData->HwInitDataSize != SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA)
 +      {
 +          /* power management */
 +          DriverObject->MajorFunction[IRP_MJ_POWER] = IntVideoPortDispatchPower;
 +      }
 +      Status = IntVideoPortCreateAdapterDeviceObject(DriverObject, DriverExtension,
 +                                                     NULL, &DeviceObject);
 +      INFO_(VIDEOPRT, "IntVideoPortCreateAdapterDeviceObject returned 0x%x\n", Status);
 +      if (!NT_SUCCESS(Status))
 +         return Status;
 +      Status = IntVideoPortFindAdapter(DriverObject, DriverExtension, DeviceObject);
 +      INFO_(VIDEOPRT, "IntVideoPortFindAdapter returned 0x%x\n", Status);
 +      if (NT_SUCCESS(Status))
 +         VideoPortDeviceNumber++;
 +      return Status;
 +   }
 +   else
 +   {
 +      DriverObject->DriverExtension->AddDevice = IntVideoPortAddDevice;
 +      DriverObject->MajorFunction[IRP_MJ_PNP] = IntVideoPortDispatchPnp;
 +      DriverObject->MajorFunction[IRP_MJ_POWER] = IntVideoPortDispatchPower;
 +      DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IntVideoPortDispatchSystemControl;
 +
 +      return STATUS_SUCCESS;
 +   }
 +}
 +
 +/*
 + * @implemented
 + */
 +
 +VOID
 +VideoPortDebugPrint(
 +   IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
 +   IN PCHAR DebugMessage, ...)
 +{
 +   va_list ap;
 +
 +   va_start(ap, DebugMessage);
 +   vDbgPrintEx(DPFLTR_IHVVIDEO_ID, DebugPrintLevel, DebugMessage, ap);
 +   va_end(ap);
 +}
 +
 +/*
 + * @unimplemented
 + */
 +
 +VOID NTAPI
 +VideoPortLogError(
 +   IN PVOID HwDeviceExtension,
 +   IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL,
 +   IN VP_STATUS ErrorCode,
 +   IN ULONG UniqueId)
 +{
 +    UNIMPLEMENTED;
 +
 +    INFO_(VIDEOPRT, "VideoPortLogError ErrorCode %d (0x%x) UniqueId %lu (0x%lx)\n",
 +          ErrorCode, ErrorCode, UniqueId, UniqueId);
 +    if (Vrp)
 +        INFO_(VIDEOPRT, "Vrp->IoControlCode %lu (0x%lx)\n", Vrp->IoControlCode, Vrp->IoControlCode);
 +}
 +
 +/*
 + * @implemented
 + */
 +
 +UCHAR NTAPI
 +VideoPortGetCurrentIrql(VOID)
 +{
 +   return KeGetCurrentIrql();
 +}
 +
 +typedef struct QueryRegistryCallbackContext
 +{
 +   PVOID HwDevic