sync to trunk head (37853) (except rbuild changes)
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 5 Dec 2008 15:30:17 +0000 (15:30 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 5 Dec 2008 15:30:17 +0000 (15:30 +0000)
This breaks everything. Sorry, but it has to be done.
Will fix ASAP.

svn path=/branches/ros-amd64-bringup/; revision=37867

159 files changed:
1  2 
reactos/base/applications/games/solitaire/solgame.cpp
reactos/base/applications/games/solitaire/solitaire.cpp
reactos/base/applications/network/ftp/cmds.c
reactos/base/applications/network/ftp/ftp.c
reactos/base/setup/usetup/partlist.c
reactos/base/setup/vmwinst/vmwinst.c
reactos/base/shell/explorer/explorer.rbuild
reactos/base/system/smss/client.c
reactos/base/system/smss/initss.c
reactos/boot/bootdata/packages/reactos.dff
reactos/boot/freeldr/freeldr/include/disk.h
reactos/boot/freeldr/freeldr/include/freeldr.h
reactos/boot/freeldr/freeldr/mm/meminit.c
reactos/boot/freeldr/freeldr/reactos/reactos.c
reactos/dll/cpl/main/mouse.c
reactos/dll/cpl/sysdm/hardware.c
reactos/dll/cpl/sysdm/startrec.c
reactos/dll/win32/acledit/acledit.c
reactos/dll/win32/advapi32/advapi32.rbuild
reactos/dll/win32/advapi32/reg/reg.c
reactos/dll/win32/advapi32/sec/misc.c
reactos/dll/win32/advapi32/service/sctrl.c
reactos/dll/win32/gdi32/gdi32.rbuild
reactos/dll/win32/gdi32/misc/stubs.c
reactos/dll/win32/glu32/glu32.rbuild
reactos/dll/win32/kernel32/except/except.c
reactos/dll/win32/kernel32/file/lfile.c
reactos/dll/win32/kernel32/file/rw.c
reactos/dll/win32/kernel32/kernel32.rbuild
reactos/dll/win32/kernel32/misc/dllmain.c
reactos/dll/win32/kernel32/misc/handle.c
reactos/dll/win32/kernel32/misc/stubs.c
reactos/dll/win32/kernel32/misc/toolhelp.c
reactos/dll/win32/kernel32/misc/utils.c
reactos/dll/win32/kernel32/process/proc.c
reactos/dll/win32/kernel32/process/procsup.c
reactos/dll/win32/kernel32/process/session.c
reactos/dll/win32/kernel32/thread/thread.c
reactos/dll/win32/lsasrv/lsasrv.c
reactos/dll/win32/msafd/misc/dllmain.c
reactos/dll/win32/opengl32/gl.c
reactos/dll/win32/opengl32/opengl32.h
reactos/dll/win32/rpcrt4/rpcrt4.rbuild
reactos/dll/win32/secur32/lsa.c
reactos/dll/win32/user32/include/user32.h
reactos/dll/win32/user32/misc/stubs.c
reactos/dll/win32/user32/misc/winhelp.c
reactos/dll/win32/user32/user32.rbuild
reactos/dll/win32/user32/windows/class.c
reactos/dll/win32/user32/windows/draw.c
reactos/drivers/base/bootvid/i386/bootvid.c
reactos/drivers/bus/isapnp/isapnp.c
reactos/drivers/network/afd/afd/info.c
reactos/drivers/network/afd/afd/lock.c
reactos/drivers/network/afd/afd/main.c
reactos/drivers/network/afd/include/afd.h
reactos/drivers/network/dd/ne2000/ne2000/8390.c
reactos/drivers/network/dd/pcnet/pcnet.c
reactos/drivers/network/ndis/ndis/io.c
reactos/drivers/network/tcpip/tcpip/dispatch.c
reactos/drivers/setup/blue/font.c
reactos/drivers/storage/class/cdrom/cdrom.c
reactos/drivers/storage/class/class2/class2.c
reactos/drivers/storage/ide/atapi/atapi.c
reactos/drivers/storage/port/diskdump/diskdump.c
reactos/drivers/storage/scsiport/scsiport.c
reactos/drivers/video/displays/vga/main/enable.c
reactos/drivers/video/videoprt/agp.c
reactos/drivers/video/videoprt/interrupt.c
reactos/drivers/video/videoprt/resource.c
reactos/drivers/video/videoprt/services.c
reactos/drivers/video/videoprt/videoprt.c
reactos/hal/halx86/include/halp.h
reactos/include/crt/_mingw.h
reactos/include/crt/mingw32/intrin_x86.h
reactos/include/ddk/ntdef.h
reactos/include/ddk/wdm.h
reactos/include/ddk/winddk.h
reactos/include/ndk/ketypes.h
reactos/include/ndk/pstypes.h
reactos/include/psdk/commdlg.h
reactos/include/psdk/lmaccess.h
reactos/include/psdk/prsht.h
reactos/include/psdk/shellapi.h
reactos/include/psdk/tlhelp32.h
reactos/include/psdk/winbase.h
reactos/include/psdk/windef.h
reactos/include/psdk/winnt.h
reactos/include/psdk/winsock2.h
reactos/include/psdk/winuser.h
reactos/include/reactos/libs/pseh/pseh2.h
reactos/include/reactos/win32k/ntuser.h
reactos/lib/3rdparty/libwine/debug.c
reactos/lib/pseh/pseh.rbuild
reactos/lib/rtl/rtl.rbuild
reactos/lib/sdk/crt/stdio/file.c
reactos/lib/sdk/crt/stdio/lnx_sprintf.c
reactos/lib/sdk/crt/time/ctime.c
reactos/ntoskrnl/cc/copy.c
reactos/ntoskrnl/config/cmsysini.c
reactos/ntoskrnl/ex/event.c
reactos/ntoskrnl/ex/harderr.c
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ex/mutant.c
reactos/ntoskrnl/ex/resource.c
reactos/ntoskrnl/ex/sem.c
reactos/ntoskrnl/ex/sysinfo.c
reactos/ntoskrnl/ex/timer.c
reactos/ntoskrnl/include/internal/ex.h
reactos/ntoskrnl/include/internal/ke_x.h
reactos/ntoskrnl/include/internal/mm.h
reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/io/iomgr/iocomp.c
reactos/ntoskrnl/io/iomgr/iofunc.c
reactos/ntoskrnl/io/iomgr/irp.c
reactos/ntoskrnl/kd/kdmain.c
reactos/ntoskrnl/kd/wrappers/bochs.c
reactos/ntoskrnl/kdbg/i386/i386-dis.c
reactos/ntoskrnl/kdbg/kdb.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/ke/clock.c
reactos/ntoskrnl/ke/freeldr.c
reactos/ntoskrnl/ke/i386/cpu.c
reactos/ntoskrnl/ke/thrdobj.c
reactos/ntoskrnl/ke/wait.c
reactos/ntoskrnl/mm/anonmem.c
reactos/ntoskrnl/mm/cont.c
reactos/ntoskrnl/mm/i386/page.c
reactos/ntoskrnl/mm/iospace.c
reactos/ntoskrnl/mm/mdlsup.c
reactos/ntoskrnl/mm/ncache.c
reactos/ntoskrnl/mm/pool.c
reactos/ntoskrnl/mm/procsup.c
reactos/ntoskrnl/mm/region.c
reactos/ntoskrnl/mm/section.c
reactos/ntoskrnl/mm/sysldr.c
reactos/ntoskrnl/mm/virtual.c
reactos/ntoskrnl/ntoskrnl-generic.rbuild
reactos/ntoskrnl/ps/kill.c
reactos/ntoskrnl/ps/query.c
reactos/ntoskrnl/ps/security.c
reactos/ntoskrnl/rtl/libsupp.c
reactos/ntoskrnl/se/audit.c
reactos/ntoskrnl/se/lsa.c
reactos/ntoskrnl/se/token.c
reactos/subsystems/win32/csrss/api/handle.c
reactos/subsystems/win32/csrss/api/process.c
reactos/subsystems/win32/csrss/api/wapi.c
reactos/subsystems/win32/win32k/eng/engwindow.c
reactos/subsystems/win32/win32k/ntuser/callback.c
reactos/subsystems/win32/win32k/ntuser/class.c
reactos/subsystems/win32/win32k/ntuser/hook.c
reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
reactos/subsystems/win32/win32k/ntuser/menu.c
reactos/subsystems/win32/win32k/ntuser/misc.c
reactos/subsystems/win32/win32k/ntuser/painting.c
reactos/subsystems/win32/win32k/ntuser/simplecall.c
reactos/tools/widl/typegen.c
reactos/tools/widl/widl.rbuild

Simple merge
Simple merge
                <file>xs-native.cpp</file>
        </directory>
        <file>explorer.cpp</file>
 -      <file>i386-stub-win32.c</file>
 +      <if property="ARCH" value="i386">
 +              <file>i386-stub-win32.c</file>
 +      </if>
        <file>explorer.rc</file>
+       <linkerflag>--enable-stdcall-fixup</linkerflag>
  </module>
  <installfile installbase=".">explorer-cfg-template.xml</installfile>
  <directory name="notifyhook">
Simple merge
Simple merge
@@@ -543,123 -542,121 +543,121 @@@ Signature = "$ReactOS$
  boot\bootdata\bootcdregtest\testboot.bat            7   optional
  
  ; Modules
 -modules\rosapps\applications\screensavers\cylfrac\cylfrac.scr              1   optional
 -modules\rosapps\applications\screensavers\matrix\matrix.scr                1   optional
 -modules\rosapps\applications\screensavers\blankscr\scrnsave.scr            1   optional
 -modules\rosapps\applications\screensavers\starfield\starfield.scr          1   optional
 -modules\rosapps\applications\screensavers\mazescr\mazescr.scr              1   optional
 -modules\rosapps\applications\screensavers\butterflies\butterflies.scr      1   optional
 -modules\rosapps\applications\cmdutils\comp\comp.exe                                     1   optional
 -modules\rosapps\applications\cmdutils\mode\mode.exe                                     1   optional
 -modules\rosapps\applications\cmdutils\sort\sort.exe                                     1   optional
 -modules\rosapps\applications\cmdutils\tee\tee.exe                                       1   optional
 -modules\rosapps\applications\cmdutils\touch\touch.exe                                   1   optional
 -modules\rosapps\applications\cmdutils\uptime\uptime.exe                                 1   optional
 -modules\rosapps\applications\cmdutils\y\y.exe                                           1   optional
 -modules\rosapps\applications\devutils\gdb2\gdb2.exe                                     1   optional
 -modules\rosapps\applications\devutils\gdihv\gdihv.exe                                   1   optional
 -modules\rosapps\applications\devutils\genguid\genguid.exe                               1   optional
 -modules\rosapps\applications\sysutils\gettype\gettype.exe                               1   optional
 -modules\rosapps\applications\devutils\roswebparser\roswebparser.exe                     1   optional
 -modules\rosapps\applications\devutils\zoomin\zoomin.exe                                 1   optional
 -modules\rosapps\applications\downloader\downloader.exe                                  1   optional
 -modules\rosapps\applications\downloader\downloader.xml                                  1   optional
 -modules\rosapps\applications\fontview\fontview.exe                                      1   optional
 -modules\rosapps\applications\imagesoft\imagesoft.exe                                    1   optional
 -modules\rosapps\applications\net\ncftp\ncftp.exe                                        1   optional
 -modules\rosapps\applications\net\netreg\netreg.exe                                      1   optional
 -modules\rosapps\applications\net\niclist\niclist.exe                                    1   optional
 -modules\rosapps\applications\net\roshttpd\roshttpd.exe                                  1   optional
 -modules\rosapps\applications\notevil\notevil.exe                                        1   optional
 -modules\rosapps\applications\magnify\magnify.exe                                        1   optional
 -modules\rosapps\applications\packmgr\cmd-line\rosget.exe                                1   optional
 -modules\rosapps\applications\packmgr\gui\packmgr.exe                                    1   optional
 -modules\rosapps\applications\packmgr\lib\package.dll                                    1   optional
 -modules\rosapps\applications\sysutils\chkdsk\chkdsk.exe                                 1   optional
 -modules\rosapps\applications\sysutils\systeminfo\systeminfo.exe                         1   optional
 -modules\rosapps\applications\sysutils\chklib\chklib.exe                                 1   optional
 -modules\rosapps\applications\sysutils\ctm\ctm.exe                                       1   optional
 -modules\rosapps\applications\sysutils\kill\kill.exe                                     1   optional
 -modules\rosapps\applications\sysutils\lsdd\lsdd.exe                                     1   optional
 -modules\rosapps\applications\sysutils\man\man.exe                                       1   optional
 -modules\rosapps\applications\sysutils\pedump\pedump.exe                                 1   optional
 -modules\rosapps\applications\sysutils\regexpl\regexpl.exe                               1   optional
 -modules\rosapps\applications\sysutils\tcat\tcat.exe                                     1   optional
 -modules\rosapps\applications\sysutils\tlist\tlist.exe                                   1   optional
 -modules\rosapps\applications\sysutils\screenshot\screenshot.exe                         1   optional
 -modules\rosapps\applications\sysutils\utils\binpatch\binpatch.exe                       1   optional
 -modules\rosapps\applications\sysutils\utils\cat\cat.exe                                 1   optional
 -modules\rosapps\applications\sysutils\utils\driver\load\load.exe                        1   optional
 -modules\rosapps\applications\sysutils\utils\driver\unload\unload.exe                    1   optional
 -modules\rosapps\applications\sysutils\utils\infinst\infinst.exe                         1   optional
 -modules\rosapps\applications\sysutils\utils\nts2w32err\nts2w32err.exe                   1   optional
 -modules\rosapps\applications\sysutils\utils\objdir\objdir.exe                           1   optional
 -modules\rosapps\applications\sysutils\utils\partinfo\partinfo.exe                       1   optional
 -modules\rosapps\applications\sysutils\utils\ps\ps.exe                                   1   optional
 -modules\rosapps\applications\sysutils\utils\rosperf\rosperf.exe                         1   optional
 -modules\rosapps\applications\sysutils\utils\stats\stats.exe                             1   optional
 -modules\rosapps\applications\sysutils\utils\tickcount\tickcount.exe                     1   optional
 -modules\rosapps\applications\winfile\winfile.exe                                        1   optional
 -modules\rosapps\applications\winver\winver.exe                                          1   optional
 -modules\rosapps\applications\write\write.exe                                            1   optional
 -modules\rosapps\demos\ddraw\ddraw_demo.exe                                 1   optional
 -modules\rosapps\demos\maze\maze.exe                                        1   optional
 -modules\rosapps\dflat32\edit.exe                                           1   optional
 -modules\rosapps\drivers\avtest\avtest.sys                                  1   optional
 -modules\rosapps\drivers\green\green.sys                                    1   optional
 -modules\rosapps\templates\dialog\dialog.exe                                       1   optional
 -modules\rostests\winetests\advapi32\advapi32_winetest.exe                  7   optional
 -modules\rostests\winetests\advpack\advpack_winetest.exe                    7   optional
 -modules\rostests\winetests\browseui\browseui_winetest.exe                  7   optional
 -modules\rostests\winetests\cabinet\cabinet_winetest.exe                    7   optional
 -modules\rostests\winetests\comcat\comcat_winetest.exe                      7   optional
 -modules\rostests\winetests\comctl32\comctl32_winetest.exe                  7   optional
 -modules\rostests\winetests\comdlg32\comdlg32_winetest.exe                  7   optional
 -modules\rostests\winetests\gdi32\gdi32_winetest.exe                        7   optional
 -modules\rostests\winetests\gdiplus\gdiplus_winetest.exe                    7   optional
 -modules\rostests\winetests\hlink\hlink_winetest.exe                        7   optional
 -modules\rostests\winetests\icmp\icmp_winetest.exe                          7   optional
 -modules\rostests\winetests\kernel32\kernel32_winetest.exe                  7   optional
 -modules\rostests\winetests\lz32\lz32_winetest.exe                          7   optional
 -modules\rostests\winetests\mapi32\mapi32_winetest.exe                      7   optional
 -modules\rostests\winetests\mlang\mlang_winetest.exe                        7   optional
 -modules\rostests\winetests\mshtml\mshtml_winetest.exe                      7   optional
 -modules\rostests\winetests\msi\msi_winetest.exe                            7   optional
 -modules\rostests\winetests\mstask\mstask_winetest.exe                      7   optional
 -modules\rostests\winetests\msvcrt\msvcrt_winetest.exe                      7   optional
 -modules\rostests\winetests\netapi32\netapi32_winetest.exe                  7   optional
 -modules\rostests\winetests\ntdll\ntdll_winetest.exe                        7   optional
 -modules\rostests\winetests\odbccp32\odbccp32_winetest.exe                  7   optional
 -modules\rostests\winetests\ole32\ole32_winetest.exe                        7   optional
 -modules\rostests\winetests\oleaut32\oleaut32_winetest.exe                  7   optional
 -modules\rostests\winetests\powrprof\powrprof_winetest.exe                  7   optional
 -modules\rostests\winetests\psapi\psapi_winetest.exe                        7   optional
 -modules\rostests\winetests\riched20\riched20_winetest.exe                  7   optional
 -modules\rostests\winetests\rpcrt4\rpcrt4_winetest.exe                      7   optional
 -modules\rostests\winetests\rsabase\rsabase_winetest.exe                    7   optional
 -modules\rostests\winetests\rsaenh\rsaenh_winetest.exe                      7   optional
 -modules\rostests\winetests\schannel\schannel_winetest.exe                  7   optional
 -modules\rostests\winetests\secur32\secur32_winetest.exe                    7   optional
 -modules\rostests\winetests\setupapi\setupapi_winetest.exe                  7   optional
 -modules\rostests\winetests\shdocvw\shdocvw_winetest.exe                    7   optional
 -modules\rostests\winetests\shell32\shell32_winetest.exe                    7   optional
 -modules\rostests\winetests\shlwapi\shlwapi_winetest.exe                    7   optional
 -modules\rostests\winetests\urlmon\urlmon_winetest.exe                      7   optional
 -modules\rostests\winetests\user32\user32_winetest.exe                      7   optional
 -modules\rostests\winetests\usp10\usp10_winetest.exe                        7   optional
 -modules\rostests\winetests\uxtheme\uxtheme_winetest.exe                    7   optional
 -modules\rostests\winetests\version\version_winetest.exe                    7   optional
 -modules\rostests\winetests\winhttp\winhttp_winetest.exe                    7   optional
 -modules\rostests\winetests\wininet\wininet_winetest.exe                    7   optional
 -modules\wallpaper\lake.bmp                                                 4   optional
 +;modules\rosapps\applications\screensavers\cylfrac\cylfrac.scr              1   optional
 +;modules\rosapps\applications\screensavers\matrix\matrix.scr                1   optional
 +;modules\rosapps\applications\screensavers\blankscr\scrnsave.scr            1   optional
 +;modules\rosapps\applications\screensavers\starfield\starfield.scr          1   optional
 +;modules\rosapps\applications\screensavers\mazescr\mazescr.scr              1   optional
 +;modules\rosapps\applications\screensavers\butterflies\butterflies.scr      1   optional
 +;modules\rosapps\applications\cmdutils\comp\comp.exe                                     1   optional
 +;modules\rosapps\applications\cmdutils\mode\mode.exe                                     1   optional
 +;modules\rosapps\applications\cmdutils\sort\sort.exe                                     1   optional
 +;modules\rosapps\applications\cmdutils\tee\tee.exe                                       1   optional
 +;modules\rosapps\applications\cmdutils\touch\touch.exe                                   1   optional
 +;modules\rosapps\applications\cmdutils\uptime\uptime.exe                                 1   optional
 +;modules\rosapps\applications\cmdutils\y\y.exe                                           1   optional
 +;modules\rosapps\applications\devutils\gdb2\gdb2.exe                                     1   optional
 +;modules\rosapps\applications\devutils\gdihv\gdihv.exe                                   1   optional
 +;modules\rosapps\applications\devutils\genguid\genguid.exe                               1   optional
 +;modules\rosapps\applications\devutils\gettype\gettype.exe                               1   optional
 +;modules\rosapps\applications\devutils\roswebparser\roswebparser.exe                     1   optional
 +;modules\rosapps\applications\devutils\zoomin\zoomin.exe                                 1   optional
 +;modules\rosapps\applications\downloader\downloader.exe                                  1   optional
 +;modules\rosapps\applications\downloader\downloader.xml                                  1   optional
 +;modules\rosapps\applications\fontview\fontview.exe                                      1   optional
 +;modules\rosapps\applications\imagesoft\imagesoft.exe                                    1   optional
 +;modules\rosapps\applications\net\ncftp\ncftp.exe                                        1   optional
 +;modules\rosapps\applications\net\netreg\netreg.exe                                      1   optional
 +;modules\rosapps\applications\net\niclist\niclist.exe                                    1   optional
 +;modules\rosapps\applications\net\roshttpd\roshttpd.exe                                      1   optional
 +;modules\rosapps\applications\notevil\notevil.exe                                        1   optional
 +;modules\rosapps\applications\magnify\magnify.exe                                        1   optional
 +;modules\rosapps\applications\packmgr\cmd-line\rosget.exe                                1   optional
 +;modules\rosapps\applications\packmgr\gui\packmgr.exe                                    1   optional
 +;modules\rosapps\applications\packmgr\lib\package.dll                                    1   optional
 +;modules\rosapps\applications\sysutils\chkdsk\chkdsk.exe                                 1   optional
 +;modules\rosapps\applications\sysutils\systeminfo\systeminfo.exe                         1   optional
 +;modules\rosapps\applications\sysutils\chklib\chklib.exe                                 1   optional
 +;modules\rosapps\applications\sysutils\ctm\ctm.exe                                       1   optional
- ;modules\rosapps\applications\sysutils\dosfsck\dosfsck.exe                                       1   optional
 +;modules\rosapps\applications\sysutils\kill\kill.exe                                     1   optional
 +;modules\rosapps\applications\sysutils\lsdd\lsdd.exe                                     1   optional
 +;modules\rosapps\applications\sysutils\man\man.exe                                       1   optional
 +;modules\rosapps\applications\sysutils\pedump\pedump.exe                                 1   optional
 +;modules\rosapps\applications\sysutils\regexpl\regexpl.exe                               1   optional
 +;modules\rosapps\applications\sysutils\tcat\tcat.exe                                     1   optional
 +;modules\rosapps\applications\sysutils\tlist\tlist.exe                                   1   optional
 +;modules\rosapps\applications\sysutils\screenshot\screenshot.exe                                  1   optional
 +;modules\rosapps\applications\sysutils\utils\binpatch\binpatch.exe                       1   optional
 +;modules\rosapps\applications\sysutils\utils\cat\cat.exe                                 1   optional
 +;modules\rosapps\applications\sysutils\utils\driver\load\load.exe                        1   optional
 +;modules\rosapps\applications\sysutils\utils\driver\unload\unload.exe                    1   optional
 +;modules\rosapps\applications\sysutils\utils\infinst\infinst.exe                         1   optional
 +;modules\rosapps\applications\sysutils\utils\nts2w32err\nts2w32err.exe                   1   optional
 +;modules\rosapps\applications\sysutils\utils\objdir\objdir.exe                           1   optional
 +;modules\rosapps\applications\sysutils\utils\partinfo\partinfo.exe                       1   optional
 +;modules\rosapps\applications\sysutils\utils\ps\ps.exe                                   1   optional
 +;modules\rosapps\applications\sysutils\utils\rosperf\rosperf.exe                         1   optional
 +;modules\rosapps\applications\sysutils\utils\stats\stats.exe                             1   optional
 +;modules\rosapps\applications\sysutils\utils\tickcount\tickcount.exe                     1   optional
 +;modules\rosapps\applications\winfile\winfile.exe                                        1   optional
 +;modules\rosapps\applications\winver\winver.exe                                          1   optional
 +;modules\rosapps\applications\write\write.exe                                            1   optional
 +;modules\rosapps\demos\ddraw\ddraw_demo.exe                                 1   optional
 +;modules\rosapps\demos\maze\maze.exe                                        1   optional
 +;modules\rosapps\dflat32\edit.exe                                           1   optional
 +;modules\rosapps\drivers\avtest\avtest.sys                                  1   optional
- ;modules\rosapps\drivers\ramdrv\ramdrv.sys                                  1   optional
 +;modules\rosapps\drivers\green\green.sys                                    1   optional
 +;modules\rosapps\templates\dialog\dialog.exe                                       1   optional
 +;modules\rostests\winetests\advapi32\advapi32_winetest.exe                  7   optional
 +;modules\rostests\winetests\advpack\advpack_winetest.exe                    7   optional
 +;modules\rostests\winetests\browseui\browseui_winetest.exe                  7   optional
 +;modules\rostests\winetests\cabinet\cabinet_winetest.exe                    7   optional
 +;modules\rostests\winetests\comcat\comcat_winetest.exe                      7   optional
 +;modules\rostests\winetests\comctl32\comctl32_winetest.exe                  7   optional
 +;modules\rostests\winetests\comdlg32\comdlg32_winetest.exe                  7   optional
 +;modules\rostests\winetests\gdi32\gdi32_winetest.exe                        7   optional
 +;modules\rostests\winetests\gdiplus\gdiplus_winetest.exe                    7   optional
 +;modules\rostests\winetests\hlink\hlink_winetest.exe                        7   optional
 +;modules\rostests\winetests\icmp\icmp_winetest.exe                          7   optional
 +;modules\rostests\winetests\kernel32\kernel32_winetest.exe                  7   optional
 +;modules\rostests\winetests\lz32\lz32_winetest.exe                          7   optional
 +;modules\rostests\winetests\mapi32\mapi32_winetest.exe                      7   optional
 +;modules\rostests\winetests\mlang\mlang_winetest.exe                        7   optional
 +;modules\rostests\winetests\mshtml\mshtml_winetest.exe                      7   optional
 +;modules\rostests\winetests\msi\msi_winetest.exe                            7   optional
 +;modules\rostests\winetests\mstask\mstask_winetest.exe                      7   optional
 +;modules\rostests\winetests\msvcrt\msvcrt_winetest.exe                      7   optional
 +;modules\rostests\winetests\netapi32\netapi32_winetest.exe                  7   optional
 +;modules\rostests\winetests\ntdll\ntdll_winetest.exe                        7   optional
 +;modules\rostests\winetests\odbccp32\odbccp32_winetest.exe                  7   optional
 +;modules\rostests\winetests\ole32\ole32_winetest.exe                        7   optional
 +;modules\rostests\winetests\oleaut32\oleaut32_winetest.exe                  7   optional
 +;modules\rostests\winetests\powrprof\powrprof_winetest.exe                  7   optional
 +;modules\rostests\winetests\psapi\psapi_winetest.exe                        7   optional
 +;modules\rostests\winetests\riched20\riched20_winetest.exe                  7   optional
 +;modules\rostests\winetests\rpcrt4\rpcrt4_winetest.exe                      7   optional
 +;modules\rostests\winetests\rsabase\rsabase_winetest.exe                    7   optional
 +;modules\rostests\winetests\rsaenh\rsaenh_winetest.exe                      7   optional
 +;modules\rostests\winetests\schannel\schannel_winetest.exe                  7   optional
 +;modules\rostests\winetests\secur32\secur32_winetest.exe                    7   optional
 +;modules\rostests\winetests\setupapi\setupapi_winetest.exe                  7   optional
 +;modules\rostests\winetests\shdocvw\shdocvw_winetest.exe                    7   optional
 +;modules\rostests\winetests\shell32\shell32_winetest.exe                    7   optional
 +;modules\rostests\winetests\shlwapi\shlwapi_winetest.exe                    7   optional
 +;modules\rostests\winetests\urlmon\urlmon_winetest.exe                      7   optional
 +;modules\rostests\winetests\user32\user32_winetest.exe                      7   optional
 +;modules\rostests\winetests\usp10\usp10_winetest.exe                        7   optional
 +;modules\rostests\winetests\uxtheme\uxtheme_winetest.exe                    7   optional
 +;modules\rostests\winetests\version\version_winetest.exe                    7   optional
 +;modules\rostests\winetests\winhttp\winhttp_winetest.exe                    7   optional
 +;modules\rostests\winetests\wininet\wininet_winetest.exe                    7   optional
 +;modules\wallpaper\lake.bmp                                                 4   optional
  
  ; Native libraries
 -modules\windows\mfc42.dll                                                  1   optional
 -modules\windows\vmx_fb.dll                                                 1   optional
 -modules\windows\vmx_mode.dll                                               1   optional
 -modules\windows\vmx_svga.sys                                               2   optional
 -modules\windows\vmx_svga.inf                                               6   optional
 -modules\windows\kvmnet.sys                                                 2   optional
 -modules\windows\kvmnet.inf                                                 6   optional
 +;modules\windows\mfc42.dll                                                  1   optional
 +;modules\windows\vmx_fb.dll                                                 1   optional
 +;modules\windows\vmx_mode.dll                                               1   optional
 +;modules\windows\vmx_svga.sys                                               2   optional
 +;modules\windows\vmx_svga.inf                                               6   optional
 +;modules\windows\kvmnet.sys                                                 2   optional
 +;modules\windows\kvmnet.inf                                                 6   optional
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -394,21 -397,21 +397,21 @@@ RegOverridePredefKey(IN HKEY hKey
   *
   * @implemented
   */
- LONG STDCALL
- RegCloseKey (HKEY hKey)
+ LONG WINAPI
+ RegCloseKey(HKEY hKey)
  {
-   NTSTATUS Status;
+     NTSTATUS Status;
  
-   /* don't close null handle or a pseudo handle */
-   if ((!hKey) || (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000))
+     /* don't close null handle or a pseudo handle */
 -    if ((!hKey) || (((ULONG)hKey & 0xF0000000) == 0x80000000))
++    if ((!hKey) || (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000))
      {
-       return ERROR_INVALID_HANDLE;
+         return ERROR_INVALID_HANDLE;
      }
  
-   Status = NtClose (hKey);
-   if (!NT_SUCCESS(Status))
+     Status = NtClose(hKey);
+     if (!NT_SUCCESS(Status))
      {
-       return RtlNtStatusToDosError (Status);
+         return RtlNtStatusToDosError(Status);
      }
  
    return ERROR_SUCCESS;
@@@ -992,71 -1001,72 +1001,71 @@@ CreateNestedKey(PHKEY KeyHandle
   *
   * @implemented
   */
- LONG STDCALL
- RegCreateKeyExA (HKEY hKey,
-                LPCSTR lpSubKey,
-                DWORD Reserved,
-                LPSTR lpClass,
-                DWORD dwOptions,
-                REGSAM samDesired,
-                LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-                PHKEY phkResult,
-                LPDWORD lpdwDisposition)
+ LONG WINAPI
+ RegCreateKeyExA(HKEY hKey,
+                 LPCSTR lpSubKey,
+                 DWORD Reserved,
+                 LPSTR lpClass,
+                 DWORD dwOptions,
+                 REGSAM samDesired,
+                 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+                 PHKEY phkResult,
+                 LPDWORD lpdwDisposition)
  {
-   UNICODE_STRING SubKeyString;
-   UNICODE_STRING ClassString;
-   OBJECT_ATTRIBUTES Attributes;
-   HANDLE ParentKey;
-   NTSTATUS Status;
+     UNICODE_STRING SubKeyString;
+     UNICODE_STRING ClassString;
+     OBJECT_ATTRIBUTES Attributes;
+     HANDLE ParentKey;
+     NTSTATUS Status;
  
-   TRACE("RegCreateKeyExA() called\n");
+     TRACE("RegCreateKeyExA() called\n");
  
-   if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
-     return ERROR_INVALID_USER_BUFFER;
+     if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
+         return ERROR_INVALID_USER_BUFFER;
  
-   /* get the real parent key */
-   Status = MapDefaultKey (&ParentKey,
-                           hKey);
-   if (!NT_SUCCESS(Status))
+     /* get the real parent key */
+     Status = MapDefaultKey(&ParentKey,
+                            hKey);
+     if (!NT_SUCCESS(Status))
      {
-       return RtlNtStatusToDosError (Status);
+         return RtlNtStatusToDosError(Status);
      }
-   TRACE("ParentKey %p\n", ParentKey);
 -
 -    TRACE("ParentKey %x\n", (ULONG)ParentKey);
++    TRACE("ParentKey %p\n", ParentKey);
  
-   if (lpClass != NULL)
+     if (lpClass != NULL)
      {
-       RtlCreateUnicodeStringFromAsciiz (&ClassString,
-                                       lpClass);
+         RtlCreateUnicodeStringFromAsciiz(&ClassString,
+                                          lpClass);
      }
  
-   RtlCreateUnicodeStringFromAsciiz(&SubKeyString,
-                                  (LPSTR)lpSubKey);
-   InitializeObjectAttributes (&Attributes,
-                             &SubKeyString,
-                             OBJ_CASE_INSENSITIVE,
-                             (HANDLE)ParentKey,
-                             lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
-   Status = CreateNestedKey(phkResult,
-                          &Attributes,
-                          (lpClass == NULL)? NULL : &ClassString,
-                          dwOptions,
-                          samDesired,
-                          lpdwDisposition);
-   RtlFreeUnicodeString (&SubKeyString);
-   if (lpClass != NULL)
+     RtlCreateUnicodeStringFromAsciiz(&SubKeyString,
+                                      (LPSTR)lpSubKey);
+     InitializeObjectAttributes(&Attributes,
+                                &SubKeyString,
+                                OBJ_CASE_INSENSITIVE,
+                                (HANDLE)ParentKey,
+                                lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
+     Status = CreateNestedKey(phkResult,
+                              &Attributes,
+                              (lpClass == NULL)? NULL : &ClassString,
+                              dwOptions,
+                              samDesired,
+                              lpdwDisposition);
+     RtlFreeUnicodeString(&SubKeyString);
+     if (lpClass != NULL)
      {
-       RtlFreeUnicodeString (&ClassString);
+         RtlFreeUnicodeString(&ClassString);
      }
  
-   ClosePredefKey(ParentKey);
+     ClosePredefKey(ParentKey);
  
-   TRACE("Status %x\n", Status);
-   if (!NT_SUCCESS(Status))
+     TRACE("Status %x\n", Status);
+     if (!NT_SUCCESS(Status))
      {
-       return RtlNtStatusToDosError (Status);
+         return RtlNtStatusToDosError(Status);
      }
  
-   return ERROR_SUCCESS;
+     return ERROR_SUCCESS;
  }
  
  
   *
   * @implemented
   */
- LONG STDCALL
- RegCreateKeyExW (HKEY hKey,
-                LPCWSTR lpSubKey,
-                DWORD Reserved,
-                LPWSTR lpClass,
-                DWORD dwOptions,
-                REGSAM samDesired,
-                LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-                PHKEY phkResult,
-                LPDWORD lpdwDisposition)
+ LONG WINAPI
+ RegCreateKeyExW(HKEY hKey,
+                 LPCWSTR lpSubKey,
+                 DWORD Reserved,
+                 LPWSTR lpClass,
+                 DWORD dwOptions,
+                 REGSAM samDesired,
+                 LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+                 PHKEY phkResult,
+                 LPDWORD lpdwDisposition)
  {
-   UNICODE_STRING SubKeyString;
-   UNICODE_STRING ClassString;
-   OBJECT_ATTRIBUTES Attributes;
-   HANDLE ParentKey;
-   NTSTATUS Status;
+     UNICODE_STRING SubKeyString;
+     UNICODE_STRING ClassString;
+     OBJECT_ATTRIBUTES Attributes;
+     HANDLE ParentKey;
+     NTSTATUS Status;
  
-   TRACE("RegCreateKeyExW() called\n");
+     TRACE("RegCreateKeyExW() called\n");
  
-   if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
-     return ERROR_INVALID_USER_BUFFER;
+     if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
+         return ERROR_INVALID_USER_BUFFER;
  
-   /* get the real parent key */
-   Status = MapDefaultKey (&ParentKey,
-                           hKey);
-   if (!NT_SUCCESS(Status))
+     /* get the real parent key */
+     Status = MapDefaultKey(&ParentKey,
+                            hKey);
+     if (!NT_SUCCESS(Status))
      {
-       return RtlNtStatusToDosError(Status);
+         return RtlNtStatusToDosError(Status);
      }
-   TRACE("ParentKey %p\n", ParentKey);
-   RtlInitUnicodeString (&ClassString,
-                       lpClass);
-   RtlInitUnicodeString (&SubKeyString,
-                       lpSubKey);
-   InitializeObjectAttributes (&Attributes,
-                             &SubKeyString,
-                             OBJ_CASE_INSENSITIVE,
-                             (HANDLE)ParentKey,
-                             lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
-   Status = CreateNestedKey(phkResult,
-                          &Attributes,
-                            (lpClass == NULL)? NULL : &ClassString,
-                            dwOptions,
-                            samDesired,
-                            lpdwDisposition);
-   ClosePredefKey(ParentKey);
--
-   TRACE("Status %x\n", Status);
-   if (!NT_SUCCESS(Status))
 -    TRACE("ParentKey %x\n", (ULONG)ParentKey);
++    TRACE("ParentKey %p\n", ParentKey);
+     RtlInitUnicodeString(&ClassString,
+                          lpClass);
+     RtlInitUnicodeString(&SubKeyString,
+                          lpSubKey);
+     InitializeObjectAttributes(&Attributes,
+                                &SubKeyString,
+                                OBJ_CASE_INSENSITIVE,
+                                (HANDLE)ParentKey,
+                                lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
+     Status = CreateNestedKey(phkResult,
+                              &Attributes,
+                              (lpClass == NULL)? NULL : &ClassString,
+                              dwOptions,
+                              samDesired,
+                              lpdwDisposition);
+     ClosePredefKey(ParentKey);
+     TRACE("Status %x\n", Status);
+     if (!NT_SUCCESS(Status))
      {
-       return RtlNtStatusToDosError (Status);
+         return RtlNtStatusToDosError(Status);
      }
  
-   return ERROR_SUCCESS;
+     return ERROR_SUCCESS;
  }
  
  
Simple merge
@@@ -10,6 -10,8 +10,7 @@@
        <library>pseh</library>
        <library>dxguid</library>
        <library>ntdll</library>
 -
+       <!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38269
        <directory name="include">
                <pch>precomp.h</pch>
        </directory>
@@@ -964,8 -939,8 +939,8 @@@ GetGlyphOutlineWow
   * @unimplemented
   */
  DWORD
- STDCALL
+ WINAPI
 -gdiPlaySpoolStream(
 +GdiPlaySpoolStream(
        DWORD   a0,
        DWORD   a1,
        DWORD   a2,
Simple merge
@@@ -284,9 -278,9 +284,9 @@@ UnhandledExceptionFilter(struct _EXCEPT
           ExceptionInfo->ExceptionRecord->ExceptionAddress,
           _module_name_from_addr(ExceptionInfo->ExceptionRecord->ExceptionAddress, &StartAddr, szMod, sizeof(szMod)));
        _dump_context ( ExceptionInfo->ContextRecord );
 -#ifdef _X86_
 +#ifdef __i386__
        DbgPrint("Frames:\n");
-       _SEH_TRY
+       _SEH2_TRY
        {
           Frame = (PULONG)ExceptionInfo->ContextRecord->Ebp;
           while (Frame[1] != 0 && Frame[1] != 0xdeadbeef)
Simple merge
@@@ -1231,9 -1231,9 +1231,9 @@@ Thread32Next(HANDLE hSnapshot, LPTHREAD
   * @implemented
   */
  BOOL
- STDCALL
+ WINAPI
  Toolhelp32ReadProcessMemory(DWORD th32ProcessID,  LPCVOID lpBaseAddress,
 -                            LPVOID lpBuffer, DWORD cbRead, LPDWORD lpNumberOfBytesRead)
 +                            LPVOID lpBuffer, SIZE_T cbRead, SIZE_T* lpNumberOfBytesRead)
  {
    HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, th32ProcessID);
    if(hProcess != NULL)
@@@ -33,10 -33,10 +33,10 @@@ RegisterWaitForInputIdle(WaitForInputId
  /*
   * @implemented
   */
- BOOL STDCALL
+ BOOL WINAPI
  GetProcessAffinityMask (HANDLE hProcess,
 -                      LPDWORD lpProcessAffinityMask,
 -                      LPDWORD lpSystemAffinityMask)
 +                      PDWORD_PTR lpProcessAffinityMask,
 +                      PDWORD_PTR lpSystemAffinityMask)
  {
    PROCESS_BASIC_INFORMATION ProcessInfo;
    SYSTEM_BASIC_INFORMATION SystemInfo;
@@@ -73,9 -73,9 +73,9 @@@
  /*
   * @implemented
   */
- BOOL STDCALL
+ BOOL WINAPI
  SetProcessAffinityMask (HANDLE hProcess,
 -                      DWORD dwProcessAffinityMask)
 +                      DWORD_PTR dwProcessAffinityMask)
  {
    NTSTATUS Status;
  
@@@ -288,14 -288,14 +288,14 @@@ BasepDuplicateAndWriteHandle(IN HANDLE 
  {
      NTSTATUS Status;
      HANDLE DuplicatedHandle;
 -    ULONG Dummy;
 +    SIZE_T Dummy;
-     
      DPRINT("BasepDuplicateAndWriteHandle. hProcess: %lx, Handle: %lx,"
             "Address: %p\n", ProcessHandle, StandardHandle, Address);
-             
      /* Don't touch Console Handles */
      if (IsConsoleHandle(StandardHandle)) return;
-     
      /* Duplicate the handle */
      Status = NtDuplicateObject(NtCurrentProcess(),
                                 StandardHandle,
Simple merge
   
  #include "opengl32.h"
  
 +#if defined(_M_IX86)
  C_ASSERT(FIELD_OFFSET(TEB, glTable) == 0xbe8);
 +#endif
  
- int STDCALL glEmptyFunc0() { return 0; }
- int STDCALL glEmptyFunc4( long l1 ) { return 0; }
- int STDCALL glEmptyFunc8( long l1, long l2 ) { return 0; }
- int STDCALL glEmptyFunc12( long l1, long l2, long l3 ) { return 0; }
- int STDCALL glEmptyFunc16( long l1, long l2, long l3, long l4 ) { return 0; }
- int STDCALL glEmptyFunc20( long l1, long l2, long l3, long l4, long l5 )
+ int WINAPI glEmptyFunc0() { return 0; }
+ int WINAPI glEmptyFunc4( long l1 ) { return 0; }
+ int WINAPI glEmptyFunc8( long l1, long l2 ) { return 0; }
+ int WINAPI glEmptyFunc12( long l1, long l2, long l3 ) { return 0; }
+ int WINAPI glEmptyFunc16( long l1, long l2, long l3, long l4 ) { return 0; }
+ int WINAPI glEmptyFunc20( long l1, long l2, long l3, long l4, long l5 )
                             { return 0; }
- int STDCALL glEmptyFunc24( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc24( long l1, long l2, long l3, long l4, long l5,
                             long l6 ) { return 0; }
- int STDCALL glEmptyFunc28( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc28( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7 ) { return 0; }
- int STDCALL glEmptyFunc32( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc32( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8 ) { return 0; }
- int STDCALL glEmptyFunc36( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc36( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8, long l9 ) { return 0; }
- int STDCALL glEmptyFunc40( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc40( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8, long l9, long l10 )
                             { return 0; }
- int STDCALL glEmptyFunc44( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc44( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8, long l9, long l10,
                             long l11 ) { return 0; }
- int STDCALL glEmptyFunc48( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc48( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8, long l9, long l10,
                             long l11, long l12 ) { return 0; }
- int STDCALL glEmptyFunc52( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc52( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8, long l9, long l10,
                             long l11, long l12, long l13 ) { return 0; }
- int STDCALL glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
+ int WINAPI glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
                             long l6, long l7, long l8, long l9, long l10,
                             long l11, long l12, long l13, long l14 )
                             { return 0; }
Simple merge
Simple merge
Simple merge
@@@ -50,8 -50,8 +50,8 @@@ typedef struc
   * @unimplemented
   */
  BOOL
- STDCALL
+ WINAPI
 -WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData)
 +WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, ULONG_PTR dwData)
  {
        static WORD WM_WINHELP = 0;
        HWND hDest;
   * @unimplemented
   */
  BOOL
- STDCALL
+ WINAPI
 -WinHelpW(HWND hWnd, LPCWSTR lpszHelp, UINT uCommand, DWORD dwData)
 +WinHelpW(HWND hWnd, LPCWSTR lpszHelp, UINT uCommand, ULONG_PTR dwData)
  {
      INT len;
      LPSTR file;
@@@ -355,9 -355,9 +355,9 @@@ BOOLEA
  NTAPI
  VidInitialize(IN BOOLEAN SetMode)
  {
 -    ULONG Context = 0;
 +    ULONG_PTR Context = 0;
      PHYSICAL_ADDRESS TranslatedAddress;
-     PHYSICAL_ADDRESS NullAddress = {{0}};
+     PHYSICAL_ADDRESS NullAddress = {{0, 0}};
      ULONG AddressSpace = 1;
      BOOLEAN Result;
      ULONG_PTR Base;
Simple merge
@@@ -78,6 -78,10 +78,10 @@@ AfdGetSockOrPeerName( PDEVICE_OBJECT De
      PMDL Mdl = NULL, SysMdl = NULL;
      PTDI_CONNECTION_INFORMATION ConnInfo = NULL;
      PTRANSPORT_ADDRESS TransAddr = NULL;
 -    ULONG Length, InOutLength;
+     HANDLE ProcHandle = NULL;
+     BOOLEAN UnlockSysMdl = FALSE;
+     PVOID UserSpace = NULL;
++    SIZE_T Length, InOutLength;
  
      AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
  
@@@ -68,7 -68,7 +68,7 @@@ NTSTATUS ExtractFont(UINT32 CodePage, P
      CFFILE             CabFile;
      ULONG              CabFileOffset = 0;
      LARGE_INTEGER      ByteOffset;
--    WCHAR              SourceBuffer[MAX_PATH] = {L'\0'};
++    WCHAR              SourceBuffer[_MAX_PATH] = {L'\0'};
  
      if(KeGetCurrentIrql() != PASSIVE_LEVEL)
          return STATUS_INVALID_DEVICE_STATE;
@@@ -90,7 -90,7 +90,7 @@@
          return(Status);
  
      SourceName.Length = 0;
--    SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
++    SourceName.MaximumLength = _MAX_PATH * sizeof(WCHAR);
      SourceName.Buffer = SourceBuffer;
  
      Status = ZwQuerySymbolicLinkObject(Handle,
@@@ -2972,10 -2972,10 +2972,9 @@@ CdRomDeviceControlCompletion
  
          }
  
-               if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (ULONG_PTR*)realIrpNextStack->Parameters.Others.Argument1-1)) {
 -        if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG)realIrpNextStack->Parameters.Others.Argument1-1))) {
++        if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1-1))) {
  
 -
 -            if (((ULONG)realIrpNextStack->Parameters.Others.Argument1)) {
 +            if (((ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
  
                  //
                  // Retry request.
@@@ -3497,9 -3499,9 +3498,9 @@@ CdRomSetVolumeIntermediateCompletion
              retry = TRUE;
          }
  
-         if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PULONG)realIrpNextStack->Parameters.Others.Argument1-1)) {
 -        if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG)realIrpNextStack->Parameters.Others.Argument1-1))) {
++        if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1-1))) {
  
 -            if (((ULONG)realIrpNextStack->Parameters.Others.Argument1)) {
 +            if (((ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
  
                  //
                  // Retry request.
@@@ -3823,9 -3825,9 +3824,9 @@@ CdRomSwitchModeCompletion
              retry = TRUE;
          }
  
-         if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PULONG)realIrpNextStack->Parameters.Others.Argument1-1)) {
 -        if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG)realIrpNextStack->Parameters.Others.Argument1-1))) {
++        if (retry && (realIrpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1-1))) {
  
 -            if (((ULONG)realIrpNextStack->Parameters.Others.Argument1)) {
 +            if (((ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
  
                  //
                  // Retry request.
@@@ -4199,9 -4201,9 +4200,9 @@@ Return Value
              retry = TRUE;
          }
  
-         if (retry && (irpNextStack->Parameters.Others.Argument1 = (PULONG)irpNextStack->Parameters.Others.Argument1-1)) {
 -        if (retry && (irpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG)irpNextStack->Parameters.Others.Argument1-1))) {
++        if (retry && (irpNextStack->Parameters.Others.Argument1 = (PVOID)((ULONG_PTR)irpNextStack->Parameters.Others.Argument1-1))) {
  
 -            if (((ULONG)irpNextStack->Parameters.Others.Argument1)) {
 +            if (((ULONG_PTR)irpNextStack->Parameters.Others.Argument1)) {
  
                  //
                  // Retry request.
Simple merge
@@@ -124,12 -123,7 +124,12 @@@ VideoPortEnableInterrupt(IN PVOID HwDev
        0,
        DeviceExtension->InterruptLevel);
  
-    return Status ? NO_ERROR : ERROR_INVALID_ACCESS;
+    return Status ? NO_ERROR : ERROR_INVALID_PARAMETER;
 +#else
 +    /* FIXME: Function still present? If so what to use instead of HalEnableSystemInterrupt? */
 +    UNIMPLEMENTED;
 +    return ERROR_INVALID_ACCESS;
 +#endif
  }
  
  /*
@@@ -151,10 -144,5 +151,10 @@@ VideoPortDisableInterrupt(IN PVOID HwDe
        DeviceExtension->InterruptVector,
        0);
  
-    return Status ? NO_ERROR : ERROR_INVALID_ACCESS;
+    return Status ? NO_ERROR : ERROR_INVALID_PARAMETER;
 +#else
 +    /* FIXME: Function still present? If so what to use instead of HalDisableSystemInterrupt? */
 +    UNIMPLEMENTED;
 +    return ERROR_INVALID_ACCESS;
 +#endif
  }
Simple merge
@@@ -175,391 -243,11 +175,391 @@@ allow GCC to optimize away some EH unwi
  
  #ifndef __MSVCRT_VERSION__
  /*  High byte is the major version, low byte is the minor. */
 -# define __MSVCRT_VERSION__ 0x0600
 +# define __MSVCRT_VERSION__ 0x0700
  #endif
  
 -#define __MINGW32_VERSION 3.13
 -#define __MINGW32_MAJOR_VERSION 3
 -#define __MINGW32_MINOR_VERSION 13
 +#if defined(__GNUC__)
 +#define __mingw_va_start(v,l) __builtin_va_start(v,l)
 +#define __mingw_va_end(v) __builtin_va_end(v)
 +#define __mingw_va_arg(v,l)     __builtin_va_arg(v,l)
 +#define __mingw_va_copy(d,s) __builtin_va_copy(d,s)
 +#elif defined(_MSC_VER)
 +#define __mingw_va_start(v,l) __msc_va_start(v,l)
 +#define __mingw_va_end(v) __msc_va_end(v)
 +#define __mingw_va_arg(v,l)     __msc_va_arg(v,l)
 +#define __mingw_va_copy(d,s) __msc_va_copy(d,s)
 +#endif
 +
 +//#ifndef WINVER
 +//#define WINVER 0x0502
 +//#endif
 +
 +#ifndef _WIN32_WINNT
 +#define _WIN32_WINNT 0x502
 +#endif
 +
 +#ifndef _INT128_DEFINED
 +#define _INT128_DEFINED
 +#ifdef __GNUC__
 +#define __int8 char
 +#define __int16 short
 +#define __int32 int
 +#define __int64 long long
 +#ifdef _WIN64
 +
 +typedef int __int128 __attribute__ ((mode (TI)));
 +
 +#endif
 +
 +#define __ptr32
 +#define __ptr64
 +#define __unaligned __attribute ((packed))
 +#define __forceinline extern __inline
 +#endif
 +#endif
 +
 +#ifndef _WIN32
 +#error Only Win32 target is supported!
 +#endif
 +
 +#ifdef __cplusplus
 +#ifndef __nothrow
 +#define __nothrow __declspec(nothrow)
 +#endif
 +#else
 +#ifndef __nothrow
 +#define __nothrow
 +#endif
 +#endif
 +
 +#undef _CRT_PACKING
 +#define _CRT_PACKING 8
 +
 +#ifdef _WIN64
 +#undef USE_MINGW_SETJMP_TWO_ARGS
 +#define USE_MINGW_SETJMP_TWO_ARGS
 +#endif
 +
 +#pragma pack(push,_CRT_PACKING)
 +
 +#include <vadefs.h>
 +
 +#ifdef __cplusplus
 +extern "C" {
 +#endif
 +
 +#ifndef _CRT_STRINGIZE
 +#define __CRT_STRINGIZE(_Value) #_Value
 +#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
 +#endif
 +
 +#ifndef _CRT_WIDE
 +#define __CRT_WIDE(_String) L ## _String
 +#define _CRT_WIDE(_String) __CRT_WIDE(_String)
 +#endif
 +#ifndef _W64
 +#define _W64
 +#endif
 +
 +#ifndef _CRTIMP_NOIA64
 +#ifdef __ia64__
 +#define _CRTIMP_NOIA64
 +#else
 +#define _CRTIMP_NOIA64 _CRTIMP
 +#endif
 +#endif
 +
 +#ifndef _CRTIMP2
 +#define _CRTIMP2 _CRTIMP
 +#endif
 +
 +#ifndef _CRTIMP_ALTERNATIVE
 +#define _CRTIMP_ALTERNATIVE _CRTIMP
 +#define _CRT_ALTERNATIVE_IMPORTED
 +#endif
 +
 +#ifndef _MRTIMP2
 +#define _MRTIMP2  _CRTIMP
 +#endif
 +
 +#ifndef _DLL
 +#define _DLL
 +#endif
 +
 +#ifndef _MT
 +#define _MT
 +#endif
 +
 +#ifndef _MCRTIMP
 +#define _MCRTIMP _CRTIMP
 +#endif
 +
 +#ifndef _CRTIMP_PURE
 +#define _CRTIMP_PURE _CRTIMP
 +#endif
 +
 +#ifndef _PGLOBAL
 +#define _PGLOBAL
 +#endif
 +
 +#ifndef _AGLOBAL
 +#define _AGLOBAL
 +#endif
 +
 +#define __STDC_SECURE_LIB__ 200411L
 +#define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
 +#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
 +#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
 +
 +#ifndef _CRT_INSECURE_DEPRECATE_MEMORY
 +#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
 +#endif
 +#ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
 +#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
 +#endif
 +#ifndef _CRT_MANAGED_HEAP_DEPRECATE
 +#define _CRT_MANAGED_HEAP_DEPRECATE
 +#endif
 +
 +#ifndef _CRT_OBSOLETE
 +#define _CRT_OBSOLETE(_NewItem)
 +#endif
 +
 +#ifndef _SIZE_T_DEFINED
 +#define _SIZE_T_DEFINED
 +#undef size_t
 +#ifdef _WIN64
 +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
 +  typedef unsigned int size_t __attribute__ ((mode (DI)));
 +#else
 +  typedef unsigned __int64 size_t;
 +#endif
 +#else
 +  typedef unsigned int size_t;
 +#endif
 +#endif
 +
 +#ifndef _SSIZE_T_DEFINED
 +#define _SSIZE_T_DEFINED
 +#undef ssize_t
 +#ifdef _WIN64
 +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
 +  typedef int ssize_t __attribute__ ((mode (DI)));
 +#else
 +  typedef __int64 ssize_t;
 +#endif
 +#else
 +  typedef int ssize_t;
 +#endif
 +#endif
 +
 +#ifndef _INTPTR_T_DEFINED
 +#define _INTPTR_T_DEFINED
 +#ifndef __intptr_t_defined
 +#define __intptr_t_defined
 +#undef intptr_t
 +#ifdef _WIN64
 +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
 +  typedef int intptr_t __attribute__ ((mode (DI)));
 +#else
 +  typedef __int64 intptr_t;
 +#endif
 +#else
 +  typedef int intptr_t;
 +#endif
 +#endif
 +#endif
 +
 +#ifndef _UINTPTR_T_DEFINED
 +#define _UINTPTR_T_DEFINED
 +#ifndef __uintptr_t_defined
 +#define __uintptr_t_defined
 +#undef uintptr_t
 +#ifdef _WIN64
 +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
 +  typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
 +#else
 +  typedef unsigned __int64 uintptr_t;
 +#endif
 +#else
 +  typedef unsigned int uintptr_t;
 +#endif
 +#endif
 +#endif
 +
 +#ifndef _PTRDIFF_T_DEFINED
 +#define _PTRDIFF_T_DEFINED
 +#ifndef _PTRDIFF_T_
 +#undef ptrdiff_t
 +#ifdef _WIN64
 +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
 +  typedef int ptrdiff_t __attribute__ ((mode (DI)));
 +#else
 +  typedef __int64 ptrdiff_t;
 +#endif
 +#else
 +  typedef int ptrdiff_t;
 +#endif
 +#endif
 +#endif
 +
 +#ifndef _WCHAR_T_DEFINED
 +#define _WCHAR_T_DEFINED
 +#ifndef __cplusplus
 +  typedef unsigned short wchar_t;
 +#endif
 +#endif
 +
 +#ifndef _WCTYPE_T_DEFINED
 +#define _WCTYPE_T_DEFINED
 +  typedef unsigned short wint_t;
 +  typedef unsigned short wctype_t;
 +#endif
 +
 +#ifndef __GNUC_VA_LIST
 +#define __GNUC_VA_LIST
 +  typedef __builtin_va_list __gnuc_va_list;
 +#endif
 +
 +#ifndef _VA_LIST_DEFINED
 +#define _VA_LIST_DEFINED
 +  typedef __gnuc_va_list va_list;
 +#endif
 +
 +#ifdef _USE_32BIT_TIME_T
 +#ifdef _WIN64
 +#error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
 +#undef _USE_32BIT_TIME_T
 +#endif
 +#else
 +#if _INTEGRAL_MAX_BITS < 64
 +#define _USE_32BIT_TIME_T
 +#endif
 +#endif
 +
 +#ifndef _ERRCODE_DEFINED
 +#define _ERRCODE_DEFINED
 +  typedef int errcode;
 +  typedef int errno_t;
 +#endif
 +
 +#ifndef _TIME32_T_DEFINED
 +#define _TIME32_T_DEFINED
 +  typedef long __time32_t;
 +#endif
 +
 +#ifndef _TIME64_T_DEFINED
 +#define _TIME64_T_DEFINED
 +//#if _INTEGRAL_MAX_BITS >= 64
 +  typedef __int64 __time64_t;
 +#endif
 +//#endif
 +
 +#ifndef _TIME_T_DEFINED
 +#define _TIME_T_DEFINED
 +#ifdef _USE_32BIT_TIME_T
 +  typedef __time32_t time_t;
 +#else
 +  typedef __time64_t time_t;
 +#endif
 +#endif
 +
 +#ifndef _CONST_RETURN
 +#define _CONST_RETURN
 +#endif
 +
 +#ifndef __CRT_UNALIGNED
 +#define __CRT_UNALIGNED
 +#endif
 +
 +#ifndef UNALIGNED
 +#if defined(__ia64__) || defined(__x86_64)
- #define UNALIGNED __CRT_UNALIGNED
++//#define UNALIGNED __CRT_UNALIGNED
 +#else
 +#define UNALIGNED
 +#endif
 +#endif
 +
 +#ifndef _CRT_ALIGN
 +#define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
 +#endif
 +
 +#ifndef _CRTNOALIAS
 +#define _CRTNOALIAS
 +#endif
 +
 +#ifndef _CRTRESTRICT
 +#define _CRTRESTRICT
 +#endif
 +
 +#ifndef __CRTDECL
 +#define __CRTDECL __cdecl
 +#endif
 +
 +#define _ARGMAX 100
 +
 +#ifndef _TRUNCATE
 +#define _TRUNCATE ((size_t)-1)
 +#endif
 +  struct threadlocaleinfostruct;
 +  struct threadmbcinfostruct;
 +  typedef struct threadlocaleinfostruct *pthreadlocinfo;
 +  typedef struct threadmbcinfostruct *pthreadmbcinfo;
 +  struct __lc_time_data;
 +
 +  typedef struct localeinfo_struct {
 +    pthreadlocinfo locinfo;
 +    pthreadmbcinfo mbcinfo;
 +  } _locale_tstruct,*_locale_t;
 +
 +#ifndef _TAGLC_ID_DEFINED
 +#define _TAGLC_ID_DEFINED
 +  typedef struct tagLC_ID {
 +    unsigned short wLanguage;
 +    unsigned short wCountry;
 +    unsigned short wCodePage;
 +  } LC_ID,*LPLC_ID;
 +#endif
 +
 +#ifndef _THREADLOCALEINFO
 +#define _THREADLOCALEINFO
 +  typedef struct threadlocaleinfostruct {
 +    int refcount;
 +    unsigned int lc_codepage;
 +    unsigned int lc_collate_cp;
 +    unsigned long lc_handle[6];
 +    LC_ID lc_id[6];
 +    struct {
 +      char *locale;
 +      wchar_t *wlocale;
 +      int *refcount;
 +      int *wrefcount;
 +    } lc_category[6];
 +    int lc_clike;
 +    int mb_cur_max;
 +    int *lconv_intl_refcount;
 +    int *lconv_num_refcount;
 +    int *lconv_mon_refcount;
 +    struct lconv *lconv;
 +    int *ctype1_refcount;
 +    unsigned short *ctype1;
 +    const unsigned short *pctype;
 +    const unsigned char *pclmap;
 +    const unsigned char *pcumap;
 +    struct __lc_time_data *lc_time_curr;
 +  } threadlocinfo;
 +#endif
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +#define __crt_typefix(ctype)
 +
 +#ifndef _CRT_UNUSED
 +#define _CRT_UNUSED(x) (void)x
 +#endif
 +
 +#pragma pack(pop)
 +#endif
  
 -#endif /* __MINGW_H */
@@@ -1244,7 -1233,7 +1233,7 @@@ static __inline__ __attribute__((always
  #ifdef _M_AMD64
        unsigned long low, high;
        __asm__ __volatile__("rdmsr" : "=a" (low), "=d" (high) : "c" (reg));
--      return (high << 32) | low;
++      return ((unsigned long long)high << 32) | low;
  #else
        unsigned long long retval;
        __asm__ __volatile__("rdmsr" : "=A" (retval) : "c" (reg));
index 0000000,13c9eaa..b17afaf
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,832 +1,832 @@@
 -  ((LONG) (&(((Type *) 0)->Field)))
+ #ifndef _NTDEF_H
+ #define _NTDEF_H
+ //
+ // Dependencies
+ //
+ #include <ctype.h>
+ #include <basetsd.h>
+ #include <excpt.h>
+ #include <sdkddkver.h>
+ // FIXME: Should we include these here?
+ #include <stdarg.h>
+ #include <string.h> 
+ typedef unsigned long POINTER_64; // FIXME! HACK!!!
+ //
+ // Pseudo Modifiers for Input Parameters
+ //
+ #ifndef IN
+ #define IN
+ #endif
+ #ifndef OUT
+ #define OUT
+ #endif
+ #ifndef OPTIONAL
+ #define OPTIONAL
+ #endif
+ #ifndef NOTHING
+ #define NOTHING
+ #endif
+ #ifndef CRITICAL
+ #define CRITICAL
+ #endif
+ #ifndef FAR
+ #define FAR
+ #endif
+ //
+ // Defines the "size" of an any-size array
+ //
+ #ifndef ANYSIZE_ARRAY
+ #define ANYSIZE_ARRAY 1
+ #endif
+ //
+ // Constant modifier
+ //
+ #ifndef CONST
+ #define CONST const
+ #endif
+ //
+ // FIXME: Non standard, should be deprecated
+ //
+ #ifndef STATIC
+ #define STATIC static
+ #endif
+ //
+ // TRUE/FALSE
+ //
+ #define FALSE   0
+ #define TRUE    1
+ //
+ // NULL/NULL64
+ //
+ #ifndef NULL
+ #ifdef __cplusplus
+ #define NULL    0
+ #define NULL64  0
+ #else
+ #define NULL    ((void *)0)
+ #define NULL64  ((void * POINTER_64)0)
+ #endif
+ #endif // NULL
+ //
+ // FIXME
+ // We should use the -fms-extensions compiler flag for gcc,
+ // and clean up the mess.
+ //
+ #ifdef __GNUC__
+ #ifndef NONAMELESSUNION
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+ #define _ANONYMOUS_UNION __extension__
+ #define _ANONYMOUS_STRUCT __extension__
+ #else
+ #if defined(__cplusplus)
+ #define _ANONYMOUS_UNION __extension__
+ #endif /* __cplusplus */
+ #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
+ #endif /* NONAMELESSUNION */
+ #elif defined(__WATCOMC__) || defined(_MSC_VER)
+ #define _ANONYMOUS_UNION
+ #define _ANONYMOUS_STRUCT
+ #endif /* __GNUC__/__WATCOMC__ */
+ #ifndef _ANONYMOUS_UNION
+ #define _ANONYMOUS_UNION
+ #define _UNION_NAME(x) x
+ #define DUMMYUNIONNAME  u
+ #define DUMMYUNIONNAME2 u2
+ #define DUMMYUNIONNAME3 u3
+ #define DUMMYUNIONNAME4 u4
+ #define DUMMYUNIONNAME5 u5
+ #define DUMMYUNIONNAME6 u6
+ #define DUMMYUNIONNAME7 u7
+ #define DUMMYUNIONNAME8 u8
+ #else
+ #define _UNION_NAME(x)
+ #define DUMMYUNIONNAME
+ #define DUMMYUNIONNAME2
+ #define DUMMYUNIONNAME3
+ #define DUMMYUNIONNAME4
+ #define DUMMYUNIONNAME5
+ #define DUMMYUNIONNAME6
+ #define DUMMYUNIONNAME7
+ #define DUMMYUNIONNAME8
+ #endif
+ #ifndef _ANONYMOUS_STRUCT
+ #define _ANONYMOUS_STRUCT
+ #define _STRUCT_NAME(x) x
+ #define DUMMYSTRUCTNAME s
+ #define DUMMYSTRUCTNAME2 s2
+ #define DUMMYSTRUCTNAME3 s3
+ #else
+ #define _STRUCT_NAME(x)
+ #define DUMMYSTRUCTNAME
+ #define DUMMYSTRUCTNAME2
+ #define DUMMYSTRUCTNAME3
+ #endif
+ // FIXME
+ #define UNALIGNED
+ #define RESTRICTED_POINTER
+ //
+ // Returns the base address of a structure from a structure member
+ //
+ #ifndef CONTAINING_RECORD
+ #define CONTAINING_RECORD(address, type, field) \
+   ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
+ #endif
+ //
+ // Returns the byte offset of the specified structure's member
+ //
+ #ifndef FIELD_OFFSET
+ #define FIELD_OFFSET(Type, Field) \
++  ((LONG_PTR) (&(((Type *) 0)->Field)))
+ #endif
+ //
+ // Returns the type's alignment
+ //
+ #define TYPE_ALIGNMENT(t) FIELD_OFFSET( struct { char x; t test; }, test )
+ //
+ // Calling Conventions
+ //
+ #if defined(_M_IX86)
+ #define FASTCALL __fastcall
+ #else
+ #define FASTCALL
+ #endif
+ #define NTAPI __stdcall
+ //
+ // Used by the DDK exclusively , don't put in drivers
+ //
+ #define DDKAPI __stdcall // Use NTAPI instead
+ #define DDKCDECLAPI __cdecl // Just use __cdecl
+ //
+ // Import and Export Specifiers
+ //
+ #ifndef DECL_IMPORT
+ #define DECL_IMPORT DECLSPEC_IMPORT //FIXME: DECL_IMPORT -> DECLSPEC_IMPORT
+ #endif
+ #ifndef DECL_EXPORT
+ #define DECL_EXPORT DECLSPEC_EXPORT //FIXME: DECL_EXPORT -> DECLSPEC_EXPORT
+ #endif
+ // Done the same way as in windef.h (for now *cough*)
+ #define DECLSPEC_IMPORT __declspec(dllimport)
+ #define DECLSPEC_EXPORT __declspec(dllexport)
+ #define DECLSPEC_NORETURN __declspec(noreturn)
+ #ifndef DECLSPEC_ADDRSAFE
+ #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
+ #define DECLSPEC_ADDRSAFE  __declspec(address_safe)
+ #else
+ #define DECLSPEC_ADDRSAFE
+ #endif
+ #endif
+ #if !defined(_NTSYSTEM_)
+ #define NTSYSAPI     DECLSPEC_IMPORT
+ #define NTSYSCALLAPI DECLSPEC_IMPORT
+ #else
+ #define NTSYSAPI
+ #if defined(_NTDLLBUILD_)
+ #define NTSYSCALLAPI
+ #else
+ #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
+ #endif
+ #endif
+ //
+ // Inlines
+ //
+ #ifndef FORCEINLINE
+ #if (_MSC_VER >= 1200)
+ #define FORCEINLINE __forceinline
+ #elif (_MSC_VER)
+ #define FORCEINLINE __inline
+ #else
+ #define FORCEINLINE static __inline__ __attribute__((always_inline))
+ #endif
+ #endif
+ #if (_MSC_VER >= 1300)
+ #define DECLSPEC_NOINLINE  __declspec(noinline)
+ #elif defined(__GNUC__)
+ #define DECLSPEC_NOINLINE __attribute__((noinline))
+ #else
+ #define DECLSPEC_NOINLINE
+ #endif
+ #if !defined(_M_CEE_PURE)
+ #define NTAPI_INLINE    NTAPI
+ #else
+ #define NTAPI_INLINE
+ #endif
+ //
+ // Use to specify structure alignment
+ //
+ #ifndef DECLSPEC_ALIGN
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
+ #define DECLSPEC_ALIGN(x) __declspec(align(x))
+ #elif defined(__GNUC__)
+ #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
+ #else
+ #define DECLSPEC_ALIGN(x)
+ #endif
+ #endif
+ //
+ // Use to silence unused variable warnings when it is intentional 
+ //
+ #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
+ #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
+ #define DBG_UNREFERENCED_PARAMETER(P)
+ #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
+ //
+ // min/max helper macros
+ //
+ #ifndef NOMINMAX
+ #ifndef min
+ #define min(a,b) (((a) < (b)) ? (a) : (b))
+ #endif
+ #ifndef max
+ #define max(a,b) (((a) > (b)) ? (a) : (b))
+ #endif
+ #endif // NOMINMAX
+ //
+ // Tell windef.h that we have defined some basic types
+ //
+ #define BASETYPES
+ //
+ // Void Pointers
+ //
+ typedef void *PVOID;
+ //typedef void * POINTER_64 PVOID64; 
+ typedef PVOID PVOID64; // FIXME!
+ //
+ // Handle Type
+ //
+ #ifdef STRICT
+ typedef void *HANDLE;
+ #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
+ #else
+ typedef PVOID HANDLE;
+ #define DECLARE_HANDLE(n) typedef HANDLE n
+ #endif
+ typedef HANDLE *PHANDLE;
+ //
+ // Upper-Case Versions of Some Standard C Types
+ //
+ #ifndef VOID
+ #define VOID void
+ typedef char CHAR;
+ typedef short SHORT;
+ typedef long LONG;
+ #if !defined(MIDL_PASS)
+ typedef int INT;
+ #endif
+ #endif
+ typedef double DOUBLE;
+ //
+ // Used to store a non-float 8 byte aligned structure
+ //
+ typedef struct _QUAD
+ {
+     _ANONYMOUS_UNION union
+     {
+         __int64 UseThisFieldToCopy;
+         double DoNotUseThisField;
+     };
+ } QUAD, *PQUAD, UQUAD, *PUQUAD;
+ //
+ // Unsigned Types
+ //
+ typedef unsigned char UCHAR, *PUCHAR;
+ typedef unsigned short USHORT, *PUSHORT;
+ typedef unsigned long ULONG, *PULONG;
+ typedef CONST UCHAR *PCUCHAR;
+ typedef CONST USHORT *PCUSHORT;
+ typedef CONST ULONG *PCULONG;
+ typedef UCHAR FCHAR;
+ typedef USHORT FSHORT;
+ typedef ULONG FLONG;
+ typedef UCHAR BOOLEAN;
+ typedef BOOLEAN *PBOOLEAN;
+ //
+ // Signed Types
+ //
+ typedef SHORT *PSHORT;
+ typedef LONG *PLONG;
+ typedef LONG NTSTATUS;
+ typedef NTSTATUS *PNTSTATUS;
+ typedef signed char SCHAR;
+ typedef SCHAR *PSCHAR;
+ #ifndef _HRESULT_DEFINED
+ #define _HRESULT_DEFINED
+ typedef LONG HRESULT;
+ #endif
+ //
+ // 64-bit types
+ //
+ typedef __int64 LONGLONG, *PLONGLONG;
+ typedef unsigned __int64 ULONGLONG, *PULONGLONG;
+ typedef ULONGLONG DWORDLONG, *PDWORDLONG;
+ //
+ // Update Sequence Number
+ //
+ typedef LONGLONG USN;
+ //
+ // ANSI (Multi-byte Character) types
+ //
+ typedef CHAR *PCHAR, *LPCH, *PCH;
+ typedef CONST CHAR *LPCCH, *PCCH;
+ typedef CHAR *NPSTR, *LPSTR, *PSTR;
+ typedef PSTR *PZPSTR;
+ typedef CONST PSTR *PCZPSTR;
+ typedef CONST CHAR *LPCSTR, *PCSTR;
+ typedef PCSTR *PZPCSTR;
+ //
+ // Pointer to an Asciiz string
+ //
+ typedef CHAR *PSZ;
+ typedef CONST char *PCSZ;
+ //
+ // UNICODE (Wide Character) types
+ //
+ typedef wchar_t WCHAR;
+ typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
+ typedef CONST WCHAR *LPCWCH, *PCWCH;
+ typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR;
+ typedef PWSTR *PZPWSTR;
+ typedef CONST PWSTR *PCZPWSTR;
+ typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
+ typedef CONST WCHAR *LPCWSTR, *PCWSTR;
+ typedef PCWSTR *PZPCWSTR;
+ typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
+ //
+ // Cardinal Data Types
+ //
+ typedef char CCHAR, *PCCHAR;
+ typedef short CSHORT, *PCSHORT;
+ typedef ULONG CLONG, *PCLONG;
+ //
+ // NLS basics (Locale and Language Ids)
+ //
+ typedef ULONG LCID;
+ typedef PULONG PLCID;
+ typedef USHORT LANGID;
+ //
+ // Large Integer Unions
+ //
+ #if defined(MIDL_PASS)
+ typedef struct _LARGE_INTEGER {
+ #else
+ typedef union _LARGE_INTEGER {
+     _ANONYMOUS_STRUCT struct
+     {
+         ULONG LowPart;
+         LONG HighPart;
+     } DUMMYSTRUCTNAME;
+     struct
+     {
+         ULONG LowPart;
+         LONG HighPart;
+     } u;
+ #endif //MIDL_PASS
+     LONGLONG QuadPart;
+ } LARGE_INTEGER, *PLARGE_INTEGER;
+ #if defined(MIDL_PASS)
+ typedef struct _ULARGE_INTEGER {
+ #else
+ typedef union _ULARGE_INTEGER {
+     _ANONYMOUS_STRUCT struct
+     {
+         ULONG LowPart;
+         ULONG HighPart;
+     } DUMMYSTRUCTNAME;
+     struct
+     {
+         ULONG LowPart;
+         ULONG HighPart;
+     } u;
+ #endif //MIDL_PASS
+     ULONGLONG QuadPart;
+ } ULARGE_INTEGER, *PULARGE_INTEGER;
+ //
+ // Physical Addresses are always treated as 64-bit wide
+ //
+ typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
+ //
+ // Locally Unique Identifier
+ //
+ typedef struct _LUID {
+     ULONG LowPart;
+     LONG HighPart;
+ } LUID, *PLUID;
+ //
+ // Native API Return Value Macros
+ //
+ #define NT_SUCCESS(Status)              (((NTSTATUS)(Status)) >= 0)
+ #define NT_INFORMATION(Status)          ((((ULONG)(Status)) >> 30) == 1)
+ #define NT_WARNING(Status)              ((((ULONG)(Status)) >> 30) == 2)
+ #define NT_ERROR(Status)                ((((ULONG)(Status)) >> 30) == 3)
+ //
+ // String Types
+ //
+ typedef struct _UNICODE_STRING {
+   USHORT Length;
+   USHORT MaximumLength;
+   PWSTR  Buffer;
+ } UNICODE_STRING, *PUNICODE_STRING;
+ typedef const UNICODE_STRING* PCUNICODE_STRING;
+ #define UNICODE_NULL ((WCHAR)0)
+ typedef struct _CSTRING {
+   USHORT Length;
+   USHORT MaximumLength;
+   CONST CHAR *Buffer;
+ } CSTRING, *PCSTRING;
+ #define ANSI_NULL ((CHAR)0)
+ typedef struct _STRING {
+   USHORT Length;
+   USHORT MaximumLength;
+   PCHAR  Buffer;
+ } STRING, *PSTRING;
+ typedef STRING ANSI_STRING;
+ typedef PSTRING PANSI_STRING;
+ typedef STRING OEM_STRING;
+ typedef PSTRING POEM_STRING;
+ typedef CONST STRING* PCOEM_STRING;
+ typedef STRING CANSI_STRING;
+ typedef PSTRING PCANSI_STRING;
+ //
+ // LangID and NLS
+ //
+ #define MAKELANGID(p, s)       ((((USHORT)(s)) << 10) | (USHORT)(p))
+ #define PRIMARYLANGID(lgid)    ((USHORT)(lgid) & 0x3ff)
+ #define SUBLANGID(lgid)        ((USHORT)(lgid) >> 10)
+ #define NLS_VALID_LOCALE_MASK  0x000fffff
+ #define MAKELCID(lgid, srtid)  ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) |  \
+                                          ((ULONG)((USHORT)(lgid)))))
+ #define MAKESORTLCID(lgid, srtid, ver)                                            \
+                                ((ULONG)((MAKELCID(lgid, srtid)) |             \
+                                     (((ULONG)((USHORT)(ver))) << 20)))
+ #define LANGIDFROMLCID(lcid)   ((USHORT)(lcid))
+ #define SORTIDFROMLCID(lcid)   ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
+ #define SORTVERSIONFROMLCID(lcid)  ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
+ //
+ // Object Attributes
+ //
+ typedef struct _OBJECT_ATTRIBUTES {
+   ULONG Length;
+   HANDLE RootDirectory;
+   PUNICODE_STRING ObjectName;
+   ULONG Attributes;
+   PVOID SecurityDescriptor;
+   PVOID SecurityQualityOfService;
+ } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
+ typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
+ //
+ // Values for the Attributes member
+ //
+ #define OBJ_INHERIT             0x00000002
+ #define OBJ_PERMANENT           0x00000010
+ #define OBJ_EXCLUSIVE           0x00000020
+ #define OBJ_CASE_INSENSITIVE    0x00000040
+ #define OBJ_OPENIF              0x00000080
+ #define OBJ_OPENLINK            0x00000100
+ #define OBJ_KERNEL_HANDLE       0x00000200
+ #define OBJ_FORCE_ACCESS_CHECK  0x00000400
+ #define OBJ_VALID_ATTRIBUTES    0x000007F2
+ //
+ // Helper Macro
+ //
+ #define InitializeObjectAttributes(p,n,a,r,s) { \
+   (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
+   (p)->RootDirectory = (r); \
+   (p)->Attributes = (a); \
+   (p)->ObjectName = (n); \
+   (p)->SecurityDescriptor = (s); \
+   (p)->SecurityQualityOfService = NULL; \
+ }
+ //
+ // Product Types
+ //
+ typedef enum _NT_PRODUCT_TYPE {
+       NtProductWinNt = 1,
+       NtProductLanManNt,
+       NtProductServer
+ } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
+ //
+ // Doubly Linked Lists
+ //
+ typedef struct _LIST_ENTRY {
+    struct _LIST_ENTRY *Flink;
+    struct _LIST_ENTRY *Blink;
+ } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
+ typedef struct LIST_ENTRY32
+ {
+     ULONG Flink;
+     ULONG Blink;
+ } LIST_ENTRY32, *PLIST_ENTRY32;
+ typedef struct LIST_ENTRY64
+ {
+     ULONGLONG Flink;
+     ULONGLONG Blink;
+ } LIST_ENTRY64, *PLIST_ENTRY64;
+ //
+ // Singly Linked Lists
+ //
+ typedef struct _SINGLE_LIST_ENTRY {
+     struct _SINGLE_LIST_ENTRY *Next;
+ } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
+ //
+ // Helper Macros
+ //
+ #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
+ #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
+ #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
+ #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
+ #ifdef ENABLE_RTL_NUMBER_OF_V2
+ #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
+ #else
+ #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
+ #endif
+ #define ARRAYSIZE(A)    RTL_NUMBER_OF_V2(A)
+ //
+ // Type Limits
+ //
+ #define MINCHAR   0x80
+ #define MAXCHAR   0x7f
+ #define MINSHORT  0x8000
+ #define MAXSHORT  0x7fff
+ #define MINLONG   0x80000000
+ #define MAXLONG   0x7fffffff
+ #define MAXUCHAR  0xff
+ #define MAXUSHORT 0xffff
+ #define MAXULONG  0xffffffff
+ #define MAXLONGLONG (0x7fffffffffffffffLL)
+ //
+ // Multiplication and Shift Operations
+ //
+ #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
+ #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
+ #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
+ #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
+ #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
+ //
+ // C_ASSERT Definition
+ //
+ #define __C_ASSERT_JOIN(X, Y) __C_ASSERT_DO_JOIN(X, Y)
+ #define __C_ASSERT_DO_JOIN(X, Y) __C_ASSERT_DO_JOIN2(X, Y)
+ #define __C_ASSERT_DO_JOIN2(X, Y) X##Y
+ #define C_ASSERT(e) typedef char __C_ASSERT_JOIN(__C_ASSERT__, __LINE__)[(e) ? 1 : -1]
+ //
+ //  Primary language IDs.
+ //
+ #define LANG_NEUTRAL                     0x00
+ #define LANG_INVARIANT                   0x7f
+ #define LANG_AFRIKAANS                   0x36
+ #define LANG_ALBANIAN                    0x1c
+ #define LANG_ALSATIAN                    0x84
+ #define LANG_AMHARIC                     0x5e
+ #define LANG_ARABIC                      0x01
+ #define LANG_ARMENIAN                    0x2b
+ #define LANG_ASSAMESE                    0x4d
+ #define LANG_AZERI                       0x2c
+ #define LANG_BASHKIR                     0x6d
+ #define LANG_BASQUE                      0x2d
+ #define LANG_BELARUSIAN                  0x23
+ #define LANG_BENGALI                     0x45
+ #define LANG_BRETON                      0x7e
+ #define LANG_BOSNIAN                     0x1a
+ #define LANG_BOSNIAN_NEUTRAL           0x781a
+ #define LANG_BULGARIAN                   0x02
+ #define LANG_CATALAN                     0x03
+ #define LANG_CHINESE                     0x04
+ #define LANG_CHINESE_SIMPLIFIED          0x04
+ #define LANG_CHINESE_TRADITIONAL       0x7c04
+ #define LANG_CORSICAN                    0x83
+ #define LANG_CROATIAN                    0x1a
+ #define LANG_CZECH                       0x05
+ #define LANG_DANISH                      0x06
+ #define LANG_DARI                        0x8c
+ #define LANG_DIVEHI                      0x65
+ #define LANG_DUTCH                       0x13
+ #define LANG_ENGLISH                     0x09
+ #define LANG_ESTONIAN                    0x25
+ #define LANG_FAEROESE                    0x38
+ #define LANG_FARSI                       0x29
+ #define LANG_FILIPINO                    0x64
+ #define LANG_FINNISH                     0x0b
+ #define LANG_FRENCH                      0x0c
+ #define LANG_FRISIAN                     0x62
+ #define LANG_GALICIAN                    0x56
+ #define LANG_GEORGIAN                    0x37
+ #define LANG_GERMAN                      0x07
+ #define LANG_GREEK                       0x08
+ #define LANG_GREENLANDIC                 0x6f
+ #define LANG_GUJARATI                    0x47
+ #define LANG_HAUSA                       0x68
+ #define LANG_HEBREW                      0x0d
+ #define LANG_HINDI                       0x39
+ #define LANG_HUNGARIAN                   0x0e
+ #define LANG_ICELANDIC                   0x0f
+ #define LANG_IGBO                        0x70
+ #define LANG_INDONESIAN                  0x21
+ #define LANG_INUKTITUT                   0x5d
+ #define LANG_IRISH                       0x3c
+ #define LANG_ITALIAN                     0x10
+ #define LANG_JAPANESE                    0x11
+ #define LANG_KANNADA                     0x4b
+ #define LANG_KASHMIRI                    0x60
+ #define LANG_KAZAK                       0x3f
+ #define LANG_KHMER                       0x53
+ #define LANG_KICHE                       0x86
+ #define LANG_KINYARWANDA                 0x87
+ #define LANG_KONKANI                     0x57
+ #define LANG_KOREAN                      0x12
+ #define LANG_KYRGYZ                      0x40
+ #define LANG_LAO                         0x54
+ #define LANG_LATVIAN                     0x26
+ #define LANG_LITHUANIAN                  0x27
+ #define LANG_LOWER_SORBIAN               0x2e
+ #define LANG_LUXEMBOURGISH               0x6e
+ #define LANG_MACEDONIAN                  0x2f
+ #define LANG_MALAY                       0x3e
+ #define LANG_MALAYALAM                   0x4c
+ #define LANG_MALTESE                     0x3a
+ #define LANG_MANIPURI                    0x58
+ #define LANG_MAORI                       0x81
+ #define LANG_MAPUDUNGUN                  0x7a
+ #define LANG_MARATHI                     0x4e
+ #define LANG_MOHAWK                      0x7c
+ #define LANG_MONGOLIAN                   0x50
+ #define LANG_NEPALI                      0x61
+ #define LANG_NORWEGIAN                   0x14
+ #define LANG_OCCITAN                     0x82
+ #define LANG_ORIYA                       0x48
+ #define LANG_PASHTO                      0x63
+ #define LANG_PERSIAN                     0x29
+ #define LANG_POLISH                      0x15
+ #define LANG_PORTUGUESE                  0x16
+ #define LANG_PUNJABI                     0x46
+ #define LANG_QUECHUA                     0x6b
+ #define LANG_ROMANIAN                    0x18
+ #define LANG_ROMANSH                     0x17
+ #define LANG_RUSSIAN                     0x19
+ #define LANG_SAMI                        0x3b
+ #define LANG_SANSKRIT                    0x4f
+ #define LANG_SERBIAN                     0x1a
+ #define LANG_SERBIAN_NEUTRAL           0x7c1a
+ #define LANG_SINDHI                      0x59
+ #define LANG_SINHALESE                   0x5b
+ #define LANG_SLOVAK                      0x1b
+ #define LANG_SLOVENIAN                   0x24
+ #define LANG_SOTHO                       0x6c
+ #define LANG_SPANISH                     0x0a
+ #define LANG_SWAHILI                     0x41
+ #define LANG_SWEDISH                     0x1d
+ #define LANG_SYRIAC                      0x5a
+ #define LANG_TAJIK                       0x28
+ #define LANG_TAMAZIGHT                   0x5f
+ #define LANG_TAMIL                       0x49
+ #define LANG_TATAR                       0x44
+ #define LANG_TELUGU                      0x4a
+ #define LANG_THAI                        0x1e
+ #define LANG_TIBETAN                     0x51
+ #define LANG_TIGRIGNA                    0x73
+ #define LANG_TSWANA                      0x32
+ #define LANG_TURKISH                     0x1f
+ #define LANG_TURKMEN                     0x42
+ #define LANG_UIGHUR                      0x80
+ #define LANG_UKRAINIAN                   0x22
+ #define LANG_UPPER_SORBIAN               0x2e
+ #define LANG_URDU                        0x20
+ #define LANG_UZBEK                       0x43
+ #define LANG_VIETNAMESE                  0x2a
+ #define LANG_WELSH                       0x52
+ #define LANG_WOLOF                       0x88
+ #define LANG_XHOSA                       0x34
+ #define LANG_YAKUT                       0x85
+ #define LANG_YI                          0x78
+ #define LANG_YORUBA                      0x6a
+ #define LANG_ZULU                        0x35
+ #endif /* _NTDEF_H */
- /*\r
-       WDM (far from finished!)\r
- */\r
+ #ifndef _WDMDDK_\r
+ #define _WDMDDK_\r
  \r
- #ifndef WDM_H\r
- #define WDM_H\r
+ //\r
+ // Dependencies\r
+ //\r
+ #define NT_INCLUDED\r
+ #include <excpt.h>\r
+ #include <ntdef.h>\r
+ #include <ntstatus.h>\r
  \r
++#ifdef __GNUC__\r
++#include "intrin.h"\r
++#endif\r
\r
++typedef struct _CONTEXT *PCONTEXT;\r
\r
+ //\r
+ // Resource list definitions\r
+ //\r
  typedef int CM_RESOURCE_TYPE;\r
  \r
- #define CmResourceTypeNull            0\r
- #define CmResourceTypePort            1\r
- #define CmResourceTypeInterrupt               2\r
- #define CmResourceTypeMemory          3\r
- #define CmResourceTypeDma             4\r
- #define CmResourceTypeDeviceSpecific  5\r
- #define CmResourceTypeBusNumber               6\r
- #define CmResourceTypeNonArbitrated   128\r
- #define CmResourceTypeConfigData      128\r
- #define CmResourceTypeDevicePrivate   129\r
- #define CmResourceTypePcCardConfig    130\r
- #define CmResourceTypeMfCardConfig    131\r
+ #define CmResourceTypeNull              0\r
+ #define CmResourceTypePort              1\r
+ #define CmResourceTypeInterrupt         2\r
+ #define CmResourceTypeMemory            3\r
+ #define CmResourceTypeDma               4\r
+ #define CmResourceTypeDeviceSpecific    5\r
+ #define CmResourceTypeBusNumber         6\r
+ #define CmResourceTypeNonArbitrated     128\r
+ #define CmResourceTypeConfigData        128\r
+ #define CmResourceTypeDevicePrivate     129\r
+ #define CmResourceTypePcCardConfig      130\r
+ #define CmResourceTypeMfCardConfig      131\r
\r
\r
  \r
+ //\r
+ // Global debug flag\r
+ //\r
  extern ULONG NtGlobalFlag;\r
  \r
\r
\r
+ //\r
+ // Section map options\r
+ //\r
+ typedef enum _SECTION_INHERIT {\r
+     ViewShare = 1,\r
+     ViewUnmap = 2\r
+ } SECTION_INHERIT;\r
\r
+ //\r
+ // Section access rights\r
+ //\r
+ #define SECTION_QUERY                0x0001\r
+ #define SECTION_MAP_WRITE            0x0002\r
+ #define SECTION_MAP_READ             0x0004\r
+ #define SECTION_MAP_EXECUTE          0x0008\r
+ #define SECTION_EXTEND_SIZE          0x0010\r
+ #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020\r
\r
+ #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\\r
+                             SECTION_MAP_WRITE |      \\r
+                             SECTION_MAP_READ |       \\r
+                             SECTION_MAP_EXECUTE |    \\r
+                             SECTION_EXTEND_SIZE)\r
\r
+ #define SESSION_QUERY_ACCESS  0x0001\r
+ #define SESSION_MODIFY_ACCESS 0x0002\r
\r
+ #define SESSION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |  \\r
+                             SESSION_QUERY_ACCESS |             \\r
+                             SESSION_MODIFY_ACCESS)\r
\r
\r
\r
+ #define SEGMENT_ALL_ACCESS SECTION_ALL_ACCESS\r
\r
+ #define PAGE_NOACCESS          0x01\r
+ #define PAGE_READONLY          0x02\r
+ #define PAGE_READWRITE         0x04\r
+ #define PAGE_WRITECOPY         0x08\r
+ #define PAGE_EXECUTE           0x10\r
+ #define PAGE_EXECUTE_READ      0x20\r
+ #define PAGE_EXECUTE_READWRITE 0x40\r
+ #define PAGE_EXECUTE_WRITECOPY 0x80\r
+ #define PAGE_GUARD            0x100\r
+ #define PAGE_NOCACHE          0x200\r
+ #define PAGE_WRITECOMBINE     0x400\r
\r
+ #define MEM_COMMIT           0x1000\r
+ #define MEM_RESERVE          0x2000\r
+ #define MEM_DECOMMIT         0x4000\r
+ #define MEM_RELEASE          0x8000\r
+ #define MEM_FREE            0x10000\r
+ #define MEM_PRIVATE         0x20000\r
+ #define MEM_MAPPED          0x40000\r
+ #define MEM_RESET           0x80000\r
+ #define MEM_TOP_DOWN       0x100000\r
+ #define MEM_LARGE_PAGES  0x20000000\r
+ #define MEM_4MB_PAGES    0x80000000\r
\r
+ #define SEC_RESERVE       0x4000000     \r
+ #define SEC_LARGE_PAGES  0x80000000\r
\r
+ #define PROCESS_DUP_HANDLE                 (0x0040)\r
\r
+ #if (NTDDI_VERSION >= NTDDI_VISTA)\r
+ #define PROCESS_ALL_ACCESS        (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \\r
+                                    0xFFFF)\r
+ #else\r
+ #define PROCESS_ALL_ACCESS        (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \\r
+                                    0xFFF)\r
+ #endif\r
\r
\r
\r
+ //\r
+ // Processor features\r
+ //\r
+ #define PF_FLOATING_POINT_PRECISION_ERRATA  0   \r
+ #define PF_FLOATING_POINT_EMULATED          1   \r
+ #define PF_COMPARE_EXCHANGE_DOUBLE          2   \r
+ #define PF_MMX_INSTRUCTIONS_AVAILABLE       3   \r
+ #define PF_PPC_MOVEMEM_64BIT_OK             4   \r
+ #define PF_ALPHA_BYTE_INSTRUCTIONS          5   \r
+ #define PF_XMMI_INSTRUCTIONS_AVAILABLE      6   \r
+ #define PF_3DNOW_INSTRUCTIONS_AVAILABLE     7   \r
+ #define PF_RDTSC_INSTRUCTION_AVAILABLE      8   \r
+ #define PF_PAE_ENABLED                      9   \r
+ #define PF_XMMI64_INSTRUCTIONS_AVAILABLE   10   \r
+ #define PF_SSE_DAZ_MODE_AVAILABLE          11   \r
+ #define PF_NX_ENABLED                      12   \r
+ #define PF_SSE3_INSTRUCTIONS_AVAILABLE     13   \r
+ #define PF_COMPARE_EXCHANGE128             14   \r
+ #define PF_COMPARE64_EXCHANGE128           15   \r
+ #define PF_CHANNELS_ENABLED                16   \r
\r
\r
\r
+ //\r
+ // Intrinsics (note: taken from our winnt.h)\r
+ // FIXME: 64-bit\r
+ //\r
+ #if defined(__GNUC__)\r
\r
+ static __inline__ BOOLEAN\r
+ InterlockedBitTestAndSet(IN LONG volatile *Base,\r
+                          IN LONG Bit)\r
+ {\r
+ #if defined(_M_IX86)\r
+       LONG OldBit;\r
+       __asm__ __volatile__("lock "\r
+                            "btsl %2,%1\n\t"\r
+                            "sbbl %0,%0\n\t"\r
+                            :"=r" (OldBit),"+m" (*Base)\r
+                            :"Ir" (Bit)\r
+                            : "memory");\r
+       return OldBit;\r
+ #else\r
+       return (_InterlockedOr(Base, 1 << Bit) >> Bit) & 1;\r
+ #endif\r
+ }\r
\r
+ static __inline__ BOOLEAN\r
+ InterlockedBitTestAndReset(IN LONG volatile *Base,\r
+                            IN LONG Bit)\r
+ {\r
+ #if defined(_M_IX86)\r
+       LONG OldBit;\r
+       __asm__ __volatile__("lock "\r
+                            "btrl %2,%1\n\t"\r
+                            "sbbl %0,%0\n\t"\r
+                            :"=r" (OldBit),"+m" (*Base)\r
+                            :"Ir" (Bit)\r
+                            : "memory");\r
+       return OldBit;\r
+ #else\r
+       return (_InterlockedAnd(Base, ~(1 << Bit)) >> Bit) & 1;\r
  #endif\r
 -static __inline__ BOOLEAN\r
 -BitScanReverse(OUT ULONG *Index,\r
 -               IN ULONG Mask)\r
 -{\r
 -      BOOLEAN BitPosition = 0;\r
 -#if defined(_M_IX86)\r
 -      __asm__ __volatile__("bsrl %2,%0\n\t"\r
 -                           "setnz %1\n\t"\r
 -                           :"=&r" (*Index), "=q" (BitPosition)\r
 -                           :"rm" (Mask)\r
 -                           :"memory");\r
 -      return BitPosition;\r
 -#else\r
 -      /* Slow implementation for now */\r
 -      for( *Index = 31; *Index; (*Index)-- ) {\r
 -              if( (1<<*Index) & Mask ) {\r
 -                      return TRUE;\r
 -              }\r
 -      }\r
 -\r
 -      return FALSE;\r
 -#endif\r
 -}\r
+ }\r
\r
 -} CONTEXT, *PCONTEXT;\r
++#define BitScanForward _BitScanForward\r
++#define BitScanReverse _BitScanReverse\r
\r
+ #endif\r
\r
\r
+ #if defined(_M_IX86)\r
+ #define YieldProcessor() __asm__ __volatile__("pause");\r
+ #elif defined (_M_AMD64)\r
+ #define YieldProcessor() __asm__ __volatile__("pause");\r
+ #elif defined(_M_PPC)\r
+ #define YieldProcessor() __asm__ __volatile__("nop");\r
+ #elif defined(_M_MIPS)\r
+ #define YieldProcessor() __asm__ __volatile__("nop");\r
+ #elif defined(_M_ARM)\r
+ #define YieldProcessor()\r
+ #else\r
+ #error Unknown architecture\r
+ #endif\r
\r
\r
\r
+ //\r
+ // Slist Header\r
+ //\r
+ #ifndef _SLIST_HEADER_\r
+ #define _SLIST_HEADER_\r
\r
+ #define SLIST_ENTRY SINGLE_LIST_ENTRY\r
+ #define _SLIST_ENTRY _SINGLE_LIST_ENTRY\r
+ #define PSLIST_ENTRY PSINGLE_LIST_ENTRY\r
\r
+ typedef union _SLIST_HEADER {\r
+     ULONGLONG Alignment;\r
+     struct {\r
+         SLIST_ENTRY Next;\r
+         USHORT Depth;\r
+         USHORT Sequence;\r
+     } DUMMYSTRUCTNAME;\r
+ } SLIST_HEADER, *PSLIST_HEADER;\r
\r
+ #endif /* _SLIST_HEADER_ */\r
\r
\r
\r
+ //\r
+ // Power States/Levels\r
+ //\r
+ typedef enum _SYSTEM_POWER_STATE {\r
+     PowerSystemUnspecified,\r
+     PowerSystemWorking,\r
+     PowerSystemSleeping1,\r
+     PowerSystemSleeping2,\r
+     PowerSystemSleeping3,\r
+     PowerSystemHibernate,\r
+     PowerSystemShutdown,\r
+     PowerSystemMaximum\r
+ } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;\r
\r
+ #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum\r
\r
+ typedef enum _POWER_INFORMATION_LEVEL {\r
+     SystemPowerPolicyAc,\r
+     SystemPowerPolicyDc,\r
+     VerifySystemPolicyAc,\r
+     VerifySystemPolicyDc,\r
+     SystemPowerCapabilities,\r
+     SystemBatteryState,\r
+     SystemPowerStateHandler,\r
+     ProcessorStateHandler,\r
+     SystemPowerPolicyCurrent,\r
+     AdministratorPowerPolicy,\r
+     SystemReserveHiberFile,\r
+     ProcessorInformation,\r
+     SystemPowerInformation,\r
+     ProcessorStateHandler2,\r
+     LastWakeTime,\r
+     LastSleepTime,\r
+     SystemExecutionState,\r
+     SystemPowerStateNotifyHandler,\r
+     ProcessorPowerPolicyAc,\r
+     ProcessorPowerPolicyDc,\r
+     VerifyProcessorPowerPolicyAc,\r
+     VerifyProcessorPowerPolicyDc,\r
+     ProcessorPowerPolicyCurrent\r
+ } POWER_INFORMATION_LEVEL;\r
\r
+ typedef enum {\r
+     PowerActionNone,\r
+     PowerActionReserved,\r
+     PowerActionSleep,\r
+     PowerActionHibernate,\r
+     PowerActionShutdown,\r
+     PowerActionShutdownReset,\r
+     PowerActionShutdownOff,\r
+     PowerActionWarmEject\r
+ } POWER_ACTION, *PPOWER_ACTION;\r
\r
+ typedef enum _DEVICE_POWER_STATE {\r
+     PowerDeviceUnspecified,\r
+     PowerDeviceD0,\r
+     PowerDeviceD1,\r
+     PowerDeviceD2,\r
+     PowerDeviceD3,\r
+     PowerDeviceMaximum\r
+ } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;\r
\r
+ #define ES_SYSTEM_REQUIRED                0x00000001\r
+ #define ES_DISPLAY_REQUIRED               0x00000002\r
+ #define ES_USER_PRESENT                   0x00000004\r
+ #define ES_CONTINUOUS                     0x80000000\r
\r
+ typedef ULONG EXECUTION_STATE;\r
\r
+ typedef enum {\r
+     LT_DONT_CARE,\r
+     LT_LOWEST_LATENCY\r
+ } LATENCY_TIME;\r
\r
\r
\r
+ //\r
+ // Access/Security Stuff\r
+ //\r
+ typedef ULONG ACCESS_MASK, *PACCESS_MASK;\r
+ typedef PVOID PACCESS_TOKEN;\r
\r
+ #define DELETE                           0x00010000L\r
+ #define READ_CONTROL                     0x00020000L\r
+ #define WRITE_DAC                        0x00040000L\r
+ #define WRITE_OWNER                      0x00080000L\r
+ #define SYNCHRONIZE                      0x00100000L\r
+ #define STANDARD_RIGHTS_REQUIRED         0x000F0000L\r
+ #define STANDARD_RIGHTS_READ             READ_CONTROL\r
+ #define STANDARD_RIGHTS_WRITE            READ_CONTROL\r
+ #define STANDARD_RIGHTS_EXECUTE          READ_CONTROL\r
+ #define STANDARD_RIGHTS_ALL              0x001F0000L\r
+ #define SPECIFIC_RIGHTS_ALL              0x0000FFFFL\r
+ #define ACCESS_SYSTEM_SECURITY           0x01000000L\r
+ #define MAXIMUM_ALLOWED                  0x02000000L\r
+ #define GENERIC_READ                     0x80000000L\r
+ #define GENERIC_WRITE                    0x40000000L\r
+ #define GENERIC_EXECUTE                  0x20000000L\r
+ #define GENERIC_ALL                      0x10000000L\r
\r
+ typedef struct _GENERIC_MAPPING {\r
+     ACCESS_MASK GenericRead;\r
+     ACCESS_MASK GenericWrite;\r
+     ACCESS_MASK GenericExecute;\r
+     ACCESS_MASK GenericAll;\r
+ } GENERIC_MAPPING, *PGENERIC_MAPPING;\r
\r
+ #define ACL_REVISION                      2\r
+ #define ACL_REVISION_DS                   4\r
\r
+ #define ACL_REVISION1                     1\r
+ #define ACL_REVISION2                     2\r
+ #define ACL_REVISION3                     3\r
+ #define ACL_REVISION4                     4\r
+ #define MIN_ACL_REVISION                  ACL_REVISION2\r
+ #define MAX_ACL_REVISION                  ACL_REVISION4\r
\r
+ typedef struct _ACL {\r
+     UCHAR AclRevision;\r
+     UCHAR Sbz1;\r
+     USHORT AclSize;\r
+     USHORT AceCount;\r
+     USHORT Sbz2;\r
+ } ACL, *PACL;\r
\r
\r
\r
+ //\r
+ // Current security descriptor revision value\r
+ //\r
+ #define SECURITY_DESCRIPTOR_REVISION     (1)\r
+ #define SECURITY_DESCRIPTOR_REVISION1    (1)\r
\r
+ //\r
+ // Privilege attributes\r
+ //\r
+ #define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L)\r
+ #define SE_PRIVILEGE_ENABLED            (0x00000002L)\r
+ #define SE_PRIVILEGE_REMOVED            (0X00000004L)\r
+ #define SE_PRIVILEGE_USED_FOR_ACCESS    (0x80000000L)\r
\r
+ #define SE_PRIVILEGE_VALID_ATTRIBUTES   (SE_PRIVILEGE_ENABLED_BY_DEFAULT | \\r
+                                          SE_PRIVILEGE_ENABLED            | \\r
+                                          SE_PRIVILEGE_REMOVED            | \\r
+                                          SE_PRIVILEGE_USED_FOR_ACCESS)\r
\r
+ #include <pshpack4.h>\r
+ typedef struct _LUID_AND_ATTRIBUTES {\r
+     LUID Luid;\r
+     ULONG Attributes;\r
+ } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;\r
+ #include <poppack.h>\r
+ typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];\r
+ typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;\r
\r
\r
\r
+ //\r
+ // Privilege sets\r
+ //\r
+ #define PRIVILEGE_SET_ALL_NECESSARY (1)\r
\r
+ typedef struct _PRIVILEGE_SET {\r
+     ULONG PrivilegeCount;\r
+     ULONG Control;\r
+     LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];\r
+ } PRIVILEGE_SET,*PPRIVILEGE_SET;\r
\r
+ typedef enum _SECURITY_IMPERSONATION_LEVEL {\r
+     SecurityAnonymous,\r
+     SecurityIdentification,\r
+     SecurityImpersonation,\r
+     SecurityDelegation\r
+ } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL;\r
\r
+ #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation\r
+ #define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous\r
+ #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation\r
+ #define VALID_IMPERSONATION_LEVEL(Level) (((Level) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((Level) <= SECURITY_MAX_IMPERSONATION_LEVEL))\r
\r
+ #define SECURITY_DYNAMIC_TRACKING (TRUE)\r
+ #define SECURITY_STATIC_TRACKING (FALSE)\r
\r
+ typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, *PSECURITY_CONTEXT_TRACKING_MODE;\r
\r
+ typedef struct _SECURITY_QUALITY_OF_SERVICE {\r
+     ULONG Length;\r
+     SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;\r
+     SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;\r
+     BOOLEAN EffectiveOnly;\r
+ } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;\r
\r
+ typedef struct _SE_IMPERSONATION_STATE {\r
+     PACCESS_TOKEN Token;\r
+     BOOLEAN CopyOnOpen;\r
+     BOOLEAN EffectiveOnly;\r
+     SECURITY_IMPERSONATION_LEVEL Level;\r
+ } SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE;\r
\r
+ #define OWNER_SECURITY_INFORMATION       (0x00000001L)\r
+ #define GROUP_SECURITY_INFORMATION       (0x00000002L)\r
+ #define DACL_SECURITY_INFORMATION        (0x00000004L)\r
+ #define SACL_SECURITY_INFORMATION        (0x00000008L)\r
+ #define LABEL_SECURITY_INFORMATION       (0x00000010L)\r
\r
+ #define PROTECTED_DACL_SECURITY_INFORMATION     (0x80000000L)\r
+ #define PROTECTED_SACL_SECURITY_INFORMATION     (0x40000000L)\r
+ #define UNPROTECTED_DACL_SECURITY_INFORMATION   (0x20000000L)\r
+ #define UNPROTECTED_SACL_SECURITY_INFORMATION   (0x10000000L)\r
\r
\r
\r
+ //\r
+ // Registry Access Rights\r
+ //\r
+ #define KEY_QUERY_VALUE         (0x0001)\r
+ #define KEY_SET_VALUE           (0x0002)\r
+ #define KEY_CREATE_SUB_KEY      (0x0004)\r
+ #define KEY_ENUMERATE_SUB_KEYS  (0x0008)\r
+ #define KEY_NOTIFY              (0x0010)\r
+ #define KEY_CREATE_LINK         (0x0020)\r
+ #define KEY_WOW64_32KEY         (0x0200)\r
+ #define KEY_WOW64_64KEY         (0x0100)\r
+ #define KEY_WOW64_RES           (0x0300)\r
\r
+ #define KEY_READ                ((STANDARD_RIGHTS_READ       |\\r
+                                   KEY_QUERY_VALUE            |\\r
+                                   KEY_ENUMERATE_SUB_KEYS     |\\r
+                                   KEY_NOTIFY)                 \\r
+                                   &                           \\r
+                                  (~SYNCHRONIZE))\r
\r
+ #define KEY_WRITE               ((STANDARD_RIGHTS_WRITE      |\\r
+                                   KEY_SET_VALUE              |\\r
+                                   KEY_CREATE_SUB_KEY)         \\r
+                                   &                           \\r
+                                  (~SYNCHRONIZE))\r
\r
+ #define KEY_EXECUTE             ((KEY_READ)                   \\r
+                                   &                           \\r
+                                  (~SYNCHRONIZE))\r
\r
+ #define KEY_ALL_ACCESS          ((STANDARD_RIGHTS_ALL        |\\r
+                                   KEY_QUERY_VALUE            |\\r
+                                   KEY_SET_VALUE              |\\r
+                                   KEY_CREATE_SUB_KEY         |\\r
+                                   KEY_ENUMERATE_SUB_KEYS     |\\r
+                                   KEY_NOTIFY                 |\\r
+                                   KEY_CREATE_LINK)            \\r
+                                   &                           \\r
+                                  (~SYNCHRONIZE))\r
\r
+ //\r
+ // Registry Open/Create Options\r
+ //\r
+ #define REG_OPTION_RESERVED         (0x00000000L)\r
+ #define REG_OPTION_NON_VOLATILE     (0x00000000L)\r
+ #define REG_OPTION_VOLATILE         (0x00000001L)\r
+ #define REG_OPTION_CREATE_LINK      (0x00000002L)\r
+ #define REG_OPTION_BACKUP_RESTORE   (0x00000004L)\r
+ #define REG_OPTION_OPEN_LINK        (0x00000008L)\r
\r
+ #define REG_LEGAL_OPTION            \\r
+                 (REG_OPTION_RESERVED            |\\r
+                  REG_OPTION_NON_VOLATILE        |\\r
+                  REG_OPTION_VOLATILE            |\\r
+                  REG_OPTION_CREATE_LINK         |\\r
+                  REG_OPTION_BACKUP_RESTORE      |\\r
+                  REG_OPTION_OPEN_LINK)\r
\r
+ //\r
+ // Key creation/open disposition\r
+ //\r
+ #define REG_CREATED_NEW_KEY         (0x00000001L)\r
+ #define REG_OPENED_EXISTING_KEY     (0x00000002L)\r
\r
+ //\r
+ // Key restore & hive load flags\r
+ //\r
+ #define REG_WHOLE_HIVE_VOLATILE         (0x00000001L)\r
+ #define REG_REFRESH_HIVE                (0x00000002L)\r
+ #define REG_NO_LAZY_FLUSH               (0x00000004L)\r
+ #define REG_FORCE_RESTORE               (0x00000008L)\r
+ #define REG_APP_HIVE                    (0x00000010L)\r
+ #define REG_PROCESS_PRIVATE             (0x00000020L)\r
+ #define REG_START_JOURNAL               (0x00000040L)\r
+ #define REG_HIVE_EXACT_FILE_GROWTH      (0x00000080L)\r
+ #define REG_HIVE_NO_RM                  (0x00000100L)\r
+ #define REG_HIVE_SINGLE_LOG             (0x00000200L)\r
\r
+ //\r
+ // Unload Flags\r
+ //\r
+ #define REG_FORCE_UNLOAD            1\r
\r
+ //\r
+ // Notify Filter Values\r
+ //\r
+ #define REG_NOTIFY_CHANGE_NAME          (0x00000001L)\r
+ #define REG_NOTIFY_CHANGE_ATTRIBUTES    (0x00000002L)\r
+ #define REG_NOTIFY_CHANGE_LAST_SET      (0x00000004L)\r
+ #define REG_NOTIFY_CHANGE_SECURITY      (0x00000008L)\r
\r
+ #define REG_LEGAL_CHANGE_FILTER                 \\r
+                 (REG_NOTIFY_CHANGE_NAME          |\\r
+                  REG_NOTIFY_CHANGE_ATTRIBUTES    |\\r
+                  REG_NOTIFY_CHANGE_LAST_SET      |\\r
+                  REG_NOTIFY_CHANGE_SECURITY)\r
\r
\r
\r
+ //\r
+ // Thread Access Rights\r
+ //\r
+ #define THREAD_TERMINATE                 (0x0001)  \r
+ #define THREAD_SUSPEND_RESUME            (0x0002)  \r
+ #define THREAD_ALERT                     (0x0004)\r
+ #define THREAD_GET_CONTEXT               (0x0008)  \r
+ #define THREAD_SET_CONTEXT               (0x0010)  \r
+ #define THREAD_SET_INFORMATION           (0x0020)  \r
+ #define THREAD_SET_LIMITED_INFORMATION   (0x0400)  \r
+ #define THREAD_QUERY_LIMITED_INFORMATION (0x0800)  \r
+ #if (NTDDI_VERSION >= NTDDI_VISTA)\r
+ #define THREAD_ALL_ACCESS         (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \\r
+                                    0xFFFF)\r
+ #else\r
+ #define THREAD_ALL_ACCESS         (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \\r
+                                    0x3FF)\r
+ #endif\r
\r
+ //\r
+ // Service Start Types\r
+ //\r
+ #define SERVICE_BOOT_START             0x00000000\r
+ #define SERVICE_SYSTEM_START           0x00000001\r
+ #define SERVICE_AUTO_START             0x00000002\r
+ #define SERVICE_DEMAND_START           0x00000003\r
+ #define SERVICE_DISABLED               0x00000004\r
\r
\r
\r
+ //\r
+ // Architecture Defined Contexts\r
+ //\r
+ #if defined(_M_IX86)\r
+ #define SIZE_OF_80387_REGISTERS       80\r
+ #define CONTEXT_i386  0x10000\r
+ #define CONTEXT_i486  0x10000\r
+ #define CONTEXT_CONTROL       (CONTEXT_i386|0x00000001L)\r
+ #define CONTEXT_INTEGER       (CONTEXT_i386|0x00000002L)\r
+ #define CONTEXT_SEGMENTS      (CONTEXT_i386|0x00000004L)\r
+ #define CONTEXT_FLOATING_POINT        (CONTEXT_i386|0x00000008L)\r
+ #define CONTEXT_DEBUG_REGISTERS       (CONTEXT_i386|0x00000010L)\r
+ #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)\r
+ #define CONTEXT_FULL  (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)\r
+ #define MAXIMUM_SUPPORTED_EXTENSION  512\r
\r
+ #define EXCEPTION_READ_FAULT    0\r
+ #define EXCEPTION_WRITE_FAULT   1\r
+ #define EXCEPTION_EXECUTE_FAULT 8\r
\r
+ typedef struct _FLOATING_SAVE_AREA {\r
+     ULONG ControlWord;\r
+     ULONG StatusWord;\r
+     ULONG TagWord;\r
+     ULONG ErrorOffset;\r
+     ULONG ErrorSelector;\r
+     ULONG DataOffset;\r
+     ULONG DataSelector;\r
+     UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];\r
+     ULONG Cr0NpxState;\r
+ } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;\r
\r
+ typedef struct _CONTEXT {\r
+     ULONG ContextFlags;\r
+     ULONG Dr0;\r
+     ULONG Dr1;\r
+     ULONG Dr2;\r
+     ULONG Dr3;\r
+     ULONG Dr6;\r
+     ULONG Dr7;\r
+     FLOATING_SAVE_AREA FloatSave;\r
+     ULONG SegGs;\r
+     ULONG SegFs;\r
+     ULONG SegEs;\r
+     ULONG SegDs;\r
+     ULONG Edi;\r
+     ULONG Esi;\r
+     ULONG Ebx;\r
+     ULONG Edx;\r
+     ULONG Ecx;\r
+     ULONG Eax;\r
+     ULONG Ebp;\r
+     ULONG Eip;\r
+     ULONG SegCs;\r
+     ULONG EFlags;\r
+     ULONG Esp;\r
+     ULONG SegSs;\r
+     UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];\r
 -#error FIXME-TODO: 64-bit\r
++} CONTEXT;\r
\r
+ #elif defined(_M_AMD64)\r
 -} CONTEXT, *PCONTEXT;\r
++//#error FIXME-TODO: 64-bit\r
+ #elif defined(_M_ARM)\r
\r
+ //\r
+ // FIXME: Move to armddk.h?\r
+ //\r
\r
+ /* The following flags control the contents of the CONTEXT structure. */\r
\r
+ #define CONTEXT_ARM    0x0000040\r
+ #define CONTEXT_CONTROL         (CONTEXT_ARM | 0x00000001L)\r
+ #define CONTEXT_INTEGER         (CONTEXT_ARM | 0x00000002L)\r
\r
+ #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)\r
\r
+ typedef struct _CONTEXT {\r
+       /* The flags values within this flag control the contents of\r
+          a CONTEXT record.\r
\r
+          If the context record is used as an input parameter, then\r
+          for each portion of the context record controlled by a flag\r
+          whose value is set, it is assumed that that portion of the\r
+          context record contains valid context. If the context record\r
+          is being used to modify a thread's context, then only that\r
+          portion of the threads context will be modified.\r
\r
+          If the context record is used as an IN OUT parameter to capture\r
+          the context of a thread, then only those portions of the thread's\r
+          context corresponding to set flags will be returned.\r
\r
+          The context record is never used as an OUT only parameter. */\r
\r
+       ULONG ContextFlags;\r
\r
+       /* This section is specified/returned if the ContextFlags word contains\r
+          the flag CONTEXT_INTEGER. */\r
+       ULONG R0;\r
+       ULONG R1;\r
+       ULONG R2;\r
+       ULONG R3;\r
+       ULONG R4;\r
+       ULONG R5;\r
+       ULONG R6;\r
+       ULONG R7;\r
+       ULONG R8;\r
+       ULONG R9;\r
+       ULONG R10;\r
+       ULONG R11;\r
+       ULONG R12;\r
\r
+       ULONG Sp;\r
+       ULONG Lr;\r
+       ULONG Pc;\r
+       ULONG Psr;\r
++} CONTEXT;\r
\r
+ #else\r
+ #error "Undefined processor architecture"\r
+ #endif\r
\r
\r
\r
+ //\r
+ // Exception Records\r
+ //\r
+ #define EXCEPTION_NONCONTINUABLE 1\r
+ #define EXCEPTION_MAXIMUM_PARAMETERS 15\r
\r
+ typedef struct _EXCEPTION_RECORD {\r
+     NTSTATUS ExceptionCode;\r
+     ULONG ExceptionFlags;\r
+     struct _EXCEPTION_RECORD *ExceptionRecord;\r
+     PVOID ExceptionAddress;\r
+     ULONG NumberParameters;\r
+     ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];\r
+ } EXCEPTION_RECORD, *PEXCEPTION_RECORD;\r
\r
+ typedef struct _EXCEPTION_RECORD32 {\r
+     NTSTATUS ExceptionCode;\r
+     ULONG ExceptionFlags;\r
+     ULONG ExceptionRecord;\r
+     ULONG ExceptionAddress;\r
+     ULONG NumberParameters;\r
+     ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];\r
+ } EXCEPTION_RECORD32, *PEXCEPTION_RECORD32;\r
\r
+ typedef struct _EXCEPTION_RECORD64 {\r
+     NTSTATUS ExceptionCode;\r
+     ULONG ExceptionFlags;\r
+     ULONG64 ExceptionRecord;\r
+     ULONG64 ExceptionAddress;\r
+     ULONG NumberParameters;\r
+     ULONG __unusedAlignment;\r
+     ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];\r
+ } EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;\r
\r
+ typedef struct _EXCEPTION_POINTERS {\r
+     PEXCEPTION_RECORD ExceptionRecord;\r
+     PCONTEXT ContextRecord;\r
+ } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;\r
\r
\r
\r
+ //\r
+ // Process Qoutas\r
+ //\r
+ typedef struct _QUOTA_LIMITS {\r
+     SIZE_T PagedPoolLimit;\r
+     SIZE_T NonPagedPoolLimit;\r
+     SIZE_T MinimumWorkingSetSize;\r
+     SIZE_T MaximumWorkingSetSize;\r
+     SIZE_T PagefileLimit;\r
+     LARGE_INTEGER TimeLimit;\r
+ } QUOTA_LIMITS, *PQUOTA_LIMITS;\r
\r
+ #define QUOTA_LIMITS_HARDWS_MIN_ENABLE  0x00000001\r
+ #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002\r
+ #define QUOTA_LIMITS_HARDWS_MAX_ENABLE  0x00000004\r
+ #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008\r
+ #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010\r
\r
\r
  \r
+ #endif // _WDMDDK_\r
@@@ -5523,11 -5556,14 +5556,143 @@@ KeGetCurrentThread
  
  #define KI_USER_SHARED_DATA               0xffdf0000
  
++#define PAGE_SIZE                         0x1000
++#define PAGE_SHIFT                        12L
++
++#define SharedUserData                    ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
++
++extern NTKERNELAPI PVOID MmHighestUserAddress;
++extern NTKERNELAPI PVOID MmSystemRangeStart;
++extern NTKERNELAPI ULONG_PTR MmUserProbeAddress;
++
++#define MM_HIGHEST_USER_ADDRESS           MmHighestUserAddress
++#define MM_SYSTEM_RANGE_START             MmSystemRangeStart
++#define MM_USER_PROBE_ADDRESS             MmUserProbeAddress
++#define MM_LOWEST_USER_ADDRESS            (PVOID)0x10000
++#define MM_LOWEST_SYSTEM_ADDRESS          (PVOID)0xC0C00000
++
++#define MM_KSEG0_BASE       MM_SYSTEM_RANGE_START
++#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
++
  #elif defined(__x86_64__)
  
++typedef struct DECLSPEC_ALIGN(16) _M128A {
++    ULONGLONG Low;
++    LONGLONG High;
++} M128A, *PM128A;
++
++typedef struct _XMM_SAVE_AREA32 {
++    USHORT ControlWord;
++    USHORT StatusWord;
++    UCHAR TagWord;
++    UCHAR Reserved1;
++    USHORT ErrorOpcode;
++    ULONG ErrorOffset;
++    USHORT ErrorSelector;
++    USHORT Reserved2;
++    ULONG DataOffset;
++    USHORT DataSelector;
++    USHORT Reserved3;
++    ULONG MxCsr;
++    ULONG MxCsr_Mask;
++    M128A FloatRegisters[8];
++    M128A XmmRegisters[16];
++    UCHAR Reserved4[96];
++} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
++
++typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
++    ULONG64 P1Home;
++    ULONG64 P2Home;
++    ULONG64 P3Home;
++    ULONG64 P4Home;
++    ULONG64 P5Home;
++    ULONG64 P6Home;
++
++    /* Control flags */
++    ULONG ContextFlags;
++    ULONG MxCsr;
++
++    /* Segment */
++    USHORT SegCs;
++    USHORT SegDs;
++    USHORT SegEs;
++    USHORT SegFs;
++    USHORT SegGs;
++    USHORT SegSs;
++    USHORT EFlags;
++
++    /* Debug */
++    ULONG64 Dr0;
++    ULONG64 Dr1;
++    ULONG64 Dr2;
++    ULONG64 Dr3;
++    ULONG64 Dr6;
++    ULONG64 Dr7;
++
++    /* Integer */
++    ULONG64 Rax;
++    ULONG64 Rcx;
++    ULONG64 Rdx;
++    ULONG64 Rbx;
++    ULONG64 Rsp;
++    ULONG64 Rbp;
++    ULONG64 Rsi;
++    ULONG64 Rdi;
++    ULONG64 R8;
++    ULONG64 R9;
++    ULONG64 R10;
++    ULONG64 R11;
++    ULONG64 R12;
++    ULONG64 R13;
++    ULONG64 R14;
++    ULONG64 R15;
++
++    /* Counter */
++    ULONG64 Rip;
++
++   /* Floating point */
++   union {
++       XMM_SAVE_AREA32 FltSave;
++       struct {
++           M128A Header[2];
++           M128A Legacy[8];
++           M128A Xmm0;
++           M128A Xmm1;
++           M128A Xmm2;
++           M128A Xmm3;
++           M128A Xmm4;
++           M128A Xmm5;
++           M128A Xmm6;
++           M128A Xmm7;
++           M128A Xmm8;
++           M128A Xmm9;
++           M128A Xmm10;
++           M128A Xmm11;
++           M128A Xmm12;
++           M128A Xmm13;
++           M128A Xmm14;
++           M128A Xmm15;
++      } DUMMYSTRUCTNAME;
++    } DUMMYUNIONNAME;
++
++     /* Vector */
++    M128A VectorRegister[26];
++    ULONG64 VectorControl;
++
++    /* Debug control */
++    ULONG64 DebugControl;
++    ULONG64 LastBranchToRip;
++    ULONG64 LastBranchFromRip;
++    ULONG64 LastExceptionToRip;
++    ULONG64 LastExceptionFromRip;
++} CONTEXT;
++
+ //
+ // Types to use to contain PFNs and their counts.
+ //
  typedef ULONG PFN_COUNT;
- typedef LONG64 SPFN_NUMBER, *PSPFN_NUMBER;
  typedef ULONG64 PFN_NUMBER, *PPFN_NUMBER;
+ typedef LONG64 SPFN_NUMBER, *PSPFN_NUMBER;
  
  #define PASSIVE_LEVEL                      0
  #define LOW_LEVEL                          0
@@@ -5759,25 -5801,25 +5930,6 @@@ KeGetCurrentProcessorNumber(VOID
  #error Unknown architecture
  #endif
  
--#define PAGE_SIZE                         0x1000
--#define PAGE_SHIFT                        12L
--
--#define SharedUserData                    ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
--
--extern NTKERNELAPI PVOID MmHighestUserAddress;
--extern NTKERNELAPI PVOID MmSystemRangeStart;
--extern NTKERNELAPI ULONG_PTR MmUserProbeAddress;
--
--#define MM_HIGHEST_USER_ADDRESS           MmHighestUserAddress
--#define MM_SYSTEM_RANGE_START             MmSystemRangeStart
--#define MM_USER_PROBE_ADDRESS             MmUserProbeAddress
--#define MM_LOWEST_USER_ADDRESS            (PVOID)0x10000
--#define MM_LOWEST_SYSTEM_ADDRESS          (PVOID)0xC0C00000
--
--#define MM_KSEG0_BASE       MM_SYSTEM_RANGE_START
--#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
--
--
  #define EFLAG_SIGN                        0x8000
  #define EFLAG_ZERO                        0x4000
  #define EFLAG_SELECT                      (EFLAG_SIGN | EFLAG_ZERO)
@@@ -5942,15 -5984,15 +6094,15 @@@ InterlockedExchangeAdd
  #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
  #define InterlockedExchangePointer _InterlockedExchangePointer
  
--#define ExInterlockedPopEntrySList(Head, Lock) ExpInterlockedPopEntrySList(Head)
--#define ExInterlockedPushEntrySList(Head, Entry, Lock) ExpInterlockedPushEntrySList(Head, Entry)
--#define ExInterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
++//#define ExInterlockedPopEntrySList(Head, Lock) ExpInterlockedPopEntrySList(Head)
++//#define ExInterlockedPushEntrySList(Head, Entry, Lock) ExpInterlockedPushEntrySList(Head, Entry)
++//#define ExInterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
  
  #if !defined(_WINBASE_)
--#define InterlockedPopEntrySList(Head) ExpInterlockedPopEntrySList(Head)
--#define InterlockedPushEntrySList(Head, Entry) ExpInterlockedPushEntrySList(Head, Entry)
--#define InterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
--#define QueryDepthSList(Head) ExQueryDepthSList(Head)
++//#define InterlockedPopEntrySList(Head) ExpInterlockedPopEntrySList(Head)
++//#define InterlockedPushEntrySList(Head, Entry) ExpInterlockedPushEntrySList(Head, Entry)
++//#define InterlockedFlushSList(Head) ExpInterlockedFlushSList(Head)
++//#define QueryDepthSList(Head) ExQueryDepthSList(Head)
  #endif // !defined(_WINBASE_)
  
  #endif // _M_AMD64
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -146,39 -131,41 +131,39 @@@ typedef WCHAR *PWCHAR,*LPWCH,*PWCH,*NWP
  typedef CONST WCHAR *LPCWCH,*PCWCH,*LPCWSTR,*PCWSTR;
  typedef CHAR *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR;
  typedef CONST CHAR *LPCCH,*PCCH,*PCSTR,*LPCSTR;
 +typedef PWSTR *PZPWSTR;
 +typedef CONST PWSTR *PCZPWSTR;
 +typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR;
 +typedef PCWSTR *PZPCWSTR;
 +typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR;
 +typedef PSTR *PZPSTR;
 +typedef CONST PSTR *PCZPSTR;
 +typedef PCSTR *PZPCSTR;
 +
 +#ifdef UNICODE
  #ifndef _TCHAR_DEFINED
  #define _TCHAR_DEFINED
 -#ifdef UNICODE
 -/*
 - * NOTE: This tests UNICODE, which is different from the _UNICODE define
 - *       used to differentiate standard C runtime calls.
 - */
 -typedef WCHAR TCHAR;
 -typedef WCHAR _TCHAR;
 -#else
 -typedef CHAR TCHAR;
 -typedef CHAR _TCHAR;
 +  typedef WCHAR TCHAR,*PTCHAR;
 +  typedef WCHAR TBYTE ,*PTBYTE;
  #endif
-   typedef LPWSTR LPTCH,PTCH,PTSTR,LPTSTR,LP,PTCHAR;
 -#endif
 -typedef TCHAR TBYTE,*PTCH,*PTBYTE;
 -typedef TCHAR *LPTCH,*PTSTR,*LPTSTR,*LP,*PTCHAR;
 -typedef const TCHAR *LPCTSTR;
 -#ifdef UNICODE
 -/*
 - * __TEXT is a private macro whose specific use is to force the expansion of a
 - * macro passed as an argument to the macro TEXT.  DO NOT use this
 - * macro within your programs.  It's name and function could change without
 - * notice.
 - */
 -#define __TEXT(q) L##q
++  typedef LPWSTR LPTCH,PTCH,PTSTR,LPTSTR,LP;
 +  typedef LPCWSTR PCTSTR,LPCTSTR;
 +  typedef LPUWSTR PUTSTR,LPUTSTR;
 +  typedef LPCUWSTR PCUTSTR,LPCUTSTR;
 +#define __TEXT(quote) L##quote
  #else
 -#define __TEXT(q) q
 +#ifndef _TCHAR_DEFINED
 +#define _TCHAR_DEFINED
 +  typedef char TCHAR,*PTCHAR;
 +  typedef unsigned char TBYTE ,*PTBYTE;
  #endif
-   typedef LPSTR LPTCH,PTCH,PTSTR,LPTSTR,PUTSTR,LPUTSTR,PTCHAR;
 -/*
 - * UNICODE a constant string when UNICODE is defined, else returns the string
 - * unmodified.
 - * The corresponding macros  _TEXT() and _T() for mapping _UNICODE strings
 - * passed to C runtime functions are defined in mingw/tchar.h
 - */
 -#define TEXT(q) __TEXT(q)
++  typedef LPSTR LPTCH,PTCH,PTSTR,LPTSTR,PUTSTR,LPUTSTR;
 +  typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR;
 +#define __TEXT(quote) quote
 +#endif
 +
 +#define TEXT(quote) __TEXT(quote)
 +
  typedef SHORT *PSHORT;
  typedef LONG *PLONG;
  #ifdef STRICT
@@@ -2245,7 -2229,7 +2230,7 @@@ typedef struct DECLSPEC_ALIGN(16) _CONT
      DWORD64 LastBranchFromRip;
      DWORD64 LastExceptionToRip;
      DWORD64 LastExceptionFromRip;
--} CONTEXT, *PCONTEXT;
++} CONTEXT;
  
  
  typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
@@@ -2332,7 -2299,7 +2317,7 @@@ typedef DWORD (*POUT_OF_PROCESS_FUNCTIO
  NTSYSAPI
  VOID
  __cdecl
--RtlRestoreContext(PCONTEXT ContextRecord,
++RtlRestoreContext(struct _CONTEXT *ContextRecord,
                    struct _EXCEPTION_RECORD *ExceptionRecord);
  
  NTSYSAPI
@@@ -4837,29 -4796,29 +4818,8 @@@ InterlockedBitTestAndReset(IN LONG vola
  #endif
  }
  
--static __inline__ BOOLEAN
--BitScanReverse(OUT ULONG *Index,
--               IN ULONG Mask)
--{
--      BOOLEAN BitPosition = 0;
--#if defined(_M_IX86)
--      __asm__ __volatile__("bsrl %2,%0\n\t"
--                           "setnz %1\n\t"
-                            :"=&r" (*Index), "=r" (BitPosition)
 -                           :"=&r" (*Index), "=q" (BitPosition)
--                           :"rm" (Mask)
--                           :"memory");
--      return BitPosition;
--#else
--      /* Slow implementation for now */
--      for( *Index = 31; *Index; (*Index)-- ) {
--              if( (1<<*Index) & Mask ) {
--                      return TRUE;
--              }
--      }
--
--      return FALSE;
--#endif
--}
++#define BitScanForward _BitScanForward
++#define BitScanReverse _BitScanReverse
  
  #endif
  
Simple merge
Simple merge
index 0000000,367c633..aa5a6d7
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,396 +1,400 @@@
+ /*
+       Copyright (c) 2008 KJK::Hyperion
+       Permission is hereby granted, free of charge, to any person obtaining a
+       copy of this software and associated documentation files (the "Software"),
+       to deal in the Software without restriction, including without limitation
+       the rights to use, copy, modify, merge, publish, distribute, sublicense,
+       and/or sell copies of the Software, and to permit persons to whom the
+       Software is furnished to do so, subject to the following conditions:
+       The above copyright notice and this permission notice shall be included in
+       all copies or substantial portions of the Software.
+       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+       FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+       AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+       FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+       DEALINGS IN THE SOFTWARE.
+ */
++#ifdef _M_AMD64
++#include "pseh2_64.h"
++#else
+ #ifndef KJK_PSEH2_H_
+ #define KJK_PSEH2_H_
+ struct _EXCEPTION_RECORD;
+ struct _EXCEPTION_POINTERS;
+ struct _CONTEXT;
+ typedef int (__cdecl * _SEH2FrameHandler_t)
+ (
+       struct _EXCEPTION_RECORD *,
+       void *,
+       struct _CONTEXT *,
+       void *
+ );
+ typedef struct __SEH2Registration
+ {
+       struct __SEH2Registration * SER_Prev;
+       _SEH2FrameHandler_t SER_Handler;
+ }
+ _SEH2Registration_t;
+ typedef struct __SEH2Frame
+ {
+       _SEH2Registration_t SF_Registration;
+       volatile struct __SEH2TryLevel * volatile SF_TopTryLevel;
+       void * volatile SF_FramePointer;
+       void * volatile SF_StackPointer;
+       volatile unsigned long SF_Code;
+ }
+ _SEH2Frame_t;
+ typedef struct __SEH2TryLevel
+ {
+       volatile struct __SEH2TryLevel * ST_Next;
+       void * ST_FramePointer;
+       void * ST_Filter;
+       void * ST_Body;
+ }
+ _SEH2TryLevel_t;
+ #ifdef __cplusplus
+ extern "C"
+ {
+ #endif
+ extern void __cdecl _SEH2EnterFrame(_SEH2Frame_t *);
+ extern void __cdecl _SEH2LeaveFrame(void);
+ extern void __cdecl _SEH2Return(void);
+ #ifdef __cplusplus
+ }
+ #endif
+ #if defined(__GNUC__)
+ #if defined(__i386__)
+ typedef struct __SEHTrampoline
+ {
+       unsigned char STR_MovEcx;
+       unsigned char STR_Closure[4];
+       unsigned char STR_Jmp;
+       unsigned char STR_Function[4];
+ }
+ _SEHTrampoline_t;
+ static
+ __inline__
+ __attribute__((always_inline))
+ int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)
+ {
+       return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;
+ }
+ static
+ __inline__
+ __attribute__((always_inline))
+ void * _SEHFunctionFromTrampoline(_SEHTrampoline_t * trampoline_)
+ {
+       return (void *)(*(int *)(&trampoline_->STR_Function[0]) + (int)(trampoline_ + 1));
+ }
+ static
+ __inline__
+ __attribute__((always_inline))
+ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
+ {
+       return (void *)*(int *)(&trampoline_->STR_Closure[0]);
+ }
+ #else
+ #error TODO
+ #endif
+ /* A no-op side effect that scares GCC */
+ #define __SEH_SIDE_EFFECT __asm__ __volatile__("#")
+ /* A no-op without any real side effects, but silences warnings */
+ #define __SEH_PRETEND_SIDE_EFFECT (void)0
+ /* Forces GCC to consider the specified label reachable */
+ #define __SEH_USE_LABEL(L_) __asm__ __volatile__("# %0\n" : : "i" (&&L_))
+ /* Makes GCC pretend the specified label is reachable, to silence warnings */
+ #define __SEH_PRETEND_USE_LABEL(L_) (void)(&&L_)
+ /* Forces GCC to emit the specified nested function as a function */
+ #define __SEH_USE_NESTED_FUNCTION(F_) (void)(&F_) /* __attribute__((noinline)) seems to do the trick */
+ /* Soft memory barrier */
+ #define __SEH_BARRIER __asm__ __volatile__("#":::"memory")
+ /* GCC doesn't know that this equals zero */
+ #define __SEH_ZERO ({ int zero = 0; __asm__ __volatile__("#" : "+g" (zero)); zero; })
+ #define __SEH_FALSE __builtin_expect(__SEH_ZERO, 0)
+ #define __SEH_TRUE  __builtin_expect(!__SEH_ZERO, 1)
+ #define __SEH_FORCE_NEST \
+       __asm__ __volatile__("#%0" : : "r" (&_SEHFrame))
+ #define __SEH_NESTED_PROLOG \
+       __SEH_FORCE_NEST;
+ #define __SEH_DECLARE_EXCEPT_PFN(NAME_) int (__cdecl * NAME_)(void *)
+ #define __SEH_DECLARE_EXCEPT(NAME_) int __cdecl NAME_(void *)
+ #define __SEH_DEFINE_EXCEPT(NAME_) int __cdecl NAME_(void * _SEHExceptionPointers)
+ #define __SEH_DECLARE_FINALLY_PFN(NAME_) void (__cdecl * NAME_)(void)
+ #define __SEH_DECLARE_FINALLY(NAME_) void __cdecl NAME_(void)
+ #define __SEH_DEFINE_FINALLY(NAME_) void __cdecl NAME_(void)
+ #define __SEH_RETURN_EXCEPT(R_) return (int)(R_)
+ #define __SEH_RETURN_FINALLY() return
+ #define __SEH_BEGIN_TRY \
+       { \
+               __label__ _SEHBeginTry; \
+               __label__ _SEHEndTry; \
+        \
+               __SEH_USE_LABEL(_SEHBeginTry); \
+               __SEH_USE_LABEL(_SEHEndTry); \
+        \
+               _SEHBeginTry: __SEH_SIDE_EFFECT; \
+               { \
+                       __SEH_BARRIER;
+ #define __SEH_END_TRY \
+                       __SEH_BARRIER; \
+               } \
+               _SEHEndTry: __SEH_SIDE_EFFECT; \
+       }
+ #define __SEH_SET_TRYLEVEL(TRYLEVEL_) \
+       { \
+               __SEH_BARRIER; _SEH2FrameP->SF_TopTryLevel = (TRYLEVEL_); __SEH_BARRIER; \
+       }
+ #define __SEH_ENTER_TRYLEVEL() __SEH_SET_TRYLEVEL(&_SEHTryLevel)
+ #define __SEH_LEAVE_TRYLEVEL() __SEH_SET_TRYLEVEL(_SEHPrevTryLevelP)
+ #define __SEH_END_SCOPE_CHAIN \
+       static const int _SEH2ScopeKind = 1; \
+       static _SEH2Frame_t * const _SEH2FrameP = 0; \
+       static _SEH2TryLevel_t * const _SEH2TryLevelP = 0;
+ #define __SEH_BEGIN_SCOPE \
+       for(;;) \
+       { \
+               __label__ _SEHBeginScope; \
+               __label__ _SEHEndScope; \
+  \
+               _SEHBeginScope: __SEH_SIDE_EFFECT; \
+  \
+               const int _SEHTopTryLevel = (_SEH2ScopeKind != 0); \
+               _SEH2Frame_t * const _SEHCurFrameP = _SEH2FrameP; \
+               volatile _SEH2TryLevel_t * const _SEHPrevTryLevelP = _SEH2TryLevelP; \
+  \
+         (void)_SEHTopTryLevel; \
+         (void)_SEHCurFrameP; \
+         (void)_SEHPrevTryLevelP; \
+  \
+               __SEH_USE_LABEL(_SEHBeginScope); \
+               __SEH_USE_LABEL(_SEHEndScope); \
+  \
+               { \
+                       __label__ _SEHBeforeTry; \
+                       __label__ _SEHDoTry; \
+                       __label__ _SEHAfterTry; \
+                       static const int _SEH2ScopeKind = 0; \
+                       _SEH2Frame_t _SEHFrame; \
+                       volatile _SEH2TryLevel_t _SEHTryLevel; \
+                       _SEH2Frame_t * const _SEH2FrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
+                       volatile _SEH2TryLevel_t * const _SEH2TryLevelP = &_SEHTryLevel; \
+  \
+                       (void)_SEH2ScopeKind; \
+                       (void)_SEHFrame; \
+                       (void)_SEHTryLevel; \
+                       (void)_SEH2FrameP; \
+                       (void)_SEH2TryLevelP; \
+  \
+                       _SEHTryLevel.ST_Next = _SEHPrevTryLevelP; \
+                       goto _SEHBeforeTry; \
+  \
+                       _SEHDoTry:; \
+                       __SEH_ENTER_TRYLEVEL(); \
+  \
+                       if(_SEHTopTryLevel) \
+                       { \
+                               __SEH_BARRIER; __asm__ __volatile__("mov %%ebp, %0\n#%1" : "=m" (_SEHFrame.SF_FramePointer) : "r" (__builtin_frame_address(0))); __SEH_BARRIER; \
+                               _SEH2EnterFrame(&_SEHFrame); \
+                       } \
+ #define __SEH_END_SCOPE \
+               } \
+  \
+               _SEHEndScope: __SEH_SIDE_EFFECT; \
+  \
+               break; \
+       }
+ #define __SEH_SCOPE_LOCALS \
+       __label__ _SEHBeginExcept; \
+       __label__ _SEHEndExcept; \
+  \
+       auto __SEH_DECLARE_EXCEPT(_SEHExcept); \
+       auto __SEH_DECLARE_FINALLY(_SEHFinally);
+ #define _SEH2_TRY \
+       __SEH_BEGIN_SCOPE \
+       { \
+               __SEH_SCOPE_LOCALS; \
+ \
+               __SEH_BEGIN_TRY \
+               {
+ #define _SEH2_FINALLY \
+               } \
+               __SEH_END_TRY; \
+  \
+               goto _SEHAfterTry; \
+               _SEHBeforeTry:; \
+  \
+               __SEH_PRETEND_USE_LABEL(_SEHBeginExcept); \
+               __SEH_PRETEND_USE_LABEL(_SEHEndExcept); \
+  \
+               __SEH_USE_NESTED_FUNCTION(_SEHFinally); \
+  \
+               _SEHTryLevel.ST_FramePointer = _SEHClosureFromTrampoline((_SEHTrampoline_t *)&_SEHFinally); \
+               _SEHTryLevel.ST_Filter = 0; \
+               _SEHTryLevel.ST_Body = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)&_SEHFinally); \
+  \
+               goto _SEHDoTry; \
+               _SEHAfterTry:; \
+  \
+               if(_SEHTopTryLevel) \
+                       _SEH2LeaveFrame(); \
+               else \
+               { \
+                       __SEH_LEAVE_TRYLEVEL(); \
+               } \
+  \
+               _SEHFinally(); \
+               goto _SEHEndExcept; \
+  \
+               _SEHBeginExcept: __SEH_PRETEND_SIDE_EFFECT; \
+               __attribute__((unused)) __SEH_DEFINE_EXCEPT(_SEHExcept) { __SEH_RETURN_EXCEPT(0); } \
+  \
+               __attribute__((noinline)) __attribute__((used)) __SEH_DEFINE_FINALLY(_SEHFinally) \
+               { \
+                       __SEH_END_SCOPE_CHAIN; \
+  \
+                       (void)_SEH2ScopeKind; \
+                       (void)_SEH2FrameP; \
+                       (void)_SEH2TryLevelP; \
+  \
+                       __SEH_NESTED_PROLOG; \
+  \
+                       for(;; ({ __SEH_RETURN_FINALLY(); })) \
+                       {
+ #define _SEH2_EXCEPT(E_) \
+               } \
+               __SEH_END_TRY; \
+  \
+               goto _SEHAfterTry; \
+  \
+               _SEHBeforeTry:; \
+ \
+               __SEH_USE_LABEL(_SEHBeginExcept); \
+               __SEH_USE_LABEL(_SEHEndExcept); \
+ \
+               __SEH_USE_NESTED_FUNCTION(_SEHExcept); \
+  \
+               _SEHTryLevel.ST_FramePointer = _SEHClosureFromTrampoline((_SEHTrampoline_t *)&_SEHExcept); \
+               _SEHTryLevel.ST_Filter = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)&_SEHExcept); \
+               _SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
+               __SEH_BARRIER; __asm__ __volatile__("mov %%esp, %0" : "=m" (_SEH2FrameP->SF_StackPointer)); __SEH_BARRIER; \
+ \
+               goto _SEHDoTry; \
+ \
+               __attribute__((noinline)) __attribute__((used)) __SEH_DEFINE_EXCEPT(_SEHExcept) \
+               { \
+                       __SEH_NESTED_PROLOG; \
+                       __SEH_RETURN_EXCEPT(E_); \
+               } \
+ \
+               __attribute__((unused)) __SEH_DEFINE_FINALLY(_SEHFinally) { __SEH_RETURN_FINALLY(); } \
+ \
+               _SEHAfterTry:; \
+               if(_SEHTopTryLevel) \
+                       _SEH2LeaveFrame(); \
+               else \
+               { \
+                       __SEH_LEAVE_TRYLEVEL(); \
+               } \
+  \
+               if(__SEH_FALSE) \
+                       goto _SEHBeginExcept; \
+               else \
+                       goto _SEHEndExcept; \
+ \
+               _SEHBeginExcept: __SEH_SIDE_EFFECT; \
+               { \
+                       { \
+                               _SEH2Frame_t * const _SEH2FrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
+                               (void)_SEH2FrameP; \
+                               __SEH_BARRIER;
+ #define _SEH2_END \
+                               __SEH_BARRIER; \
+                       } \
+               } \
+               _SEHEndExcept: __SEH_SIDE_EFFECT; \
+       } \
+       __SEH_END_SCOPE;
+ #define _SEH2_GetExceptionInformation() ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers)
+ #define _SEH2_GetExceptionCode() ((_SEH2FrameP)->SF_Code)
+ #define _SEH2_AbnormalTermination() (!!_SEH2_GetExceptionCode())
+ #define _SEH2_YIELD(STMT_) \
+       for(;;) \
+       { \
+               if(!_SEH2ScopeKind) \
+                       _SEH2Return(); \
+  \
+               STMT_; \
+       }
+ #define _SEH2_LEAVE goto _SEHEndTry
+ __SEH_END_SCOPE_CHAIN;
+ #else
+ #include <excpt.h>
+ #define _SEH2_TRY __try
+ #define _SEH2_FINALLY __finally
+ #define _SEH2_EXCEPT(E_) __except((E_))
+ #define _SEH2_END
+ #define _SEH2_GetExceptionInformation() (GetExceptionInformation())
+ #define _SEH2_GetExceptionCode() (GetExceptionCode())
+ #define _SEH2_AbnormalTermination() (AbnormalTermination())
+ #define _SEH2_YIELD(STMT_) STMT_
+ #define _SEH2_LEAVE __leave
+ #endif
+ #endif
++#endif
+ /* EOF */
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1078,14 -1078,14 +1078,14 @@@ CmpLoadHiveThread(IN PVOID StartContext
      NTSTATUS Status = STATUS_SUCCESS;
      PVOID ErrorParameters;
      PAGED_CODE();
-     
      /* Get the hive index, make sure it makes sense */
 -    i = (ULONG)StartContext;
 +    i = PtrToUlong(StartContext);
      ASSERT(CmpMachineHiveList[i].Name != NULL);
-    
      /* We were started */
      CmpMachineHiveList[i].ThreadStarted = TRUE;
-     
      /* Build the file name and registry name strings */
      RtlInitEmptyUnicodeString(&FileName, FileBuffer, MAX_PATH);
      RtlInitEmptyUnicodeString(&RegName, RegBuffer, MAX_PATH);
Simple merge
Simple merge
@@@ -196,8 -196,8 +196,8 @@@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK L
      NTSTATUS Status;
      HANDLE NlsSection;
      PVOID SectionBase = NULL;
 -    ULONG ViewSize = 0;
 +    SIZE_T ViewSize = 0;
-     LARGE_INTEGER SectionOffset = {{0}};
+     LARGE_INTEGER SectionOffset = {{0, 0}};
      PLIST_ENTRY ListHead, NextEntry;
      PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
      ULONG NlsTablesEncountered = 0;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -465,10 -460,9 +460,10 @@@ ExDoCallBack(IN OUT PEX_CALLBACK Callba
  
  #ifdef _WIN64
  #define ExpChangeRundown(x, y, z) InterlockedCompareExchange64((PLONGLONG)x, y, z)
 +#define ExpChangePushlock(lock, new, old) InterlockedCompareExchangePointer((PVOID*)lock, (PVOID)new, (PVOID)old)
  #define ExpSetRundown(x, y) InterlockedExchange64((PLONGLONG)x, y)
  #else
- #define ExpChangeRundown(x, y, z) InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z))
+ #define ExpChangeRundown(x, y, z) PtrToUlong(InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z)))
  #define ExpChangePushlock(x, y, z) LongToPtr(InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z)))
  #define ExpSetRundown(x, y) InterlockedExchange((PLONG)x, y)
  #endif
@@@ -147,128 -104,6 +141,131 @@@ typedef struct _INFORMATION_CLASS_INF
  #define IQS(TypeQuery, TypeSet, AlignmentQuery, AlignmentSet, Flags)        \
    { sizeof(TypeQuery), sizeof(TypeSet), sizeof(AlignmentQuery), sizeof(AlignmentSet), Flags }
  
++<<<<<<< .working
 +#ifndef _M_AMD64
 +FORCEINLINE
 +#else
 +static inline
 +#endif
 +NTSTATUS
 +DefaultSetInfoBufferCheck(ULONG Class,
 +                          const INFORMATION_CLASS_INFO *ClassList,
 +                          ULONG ClassListEntries,
 +                          PVOID Buffer,
 +                          ULONG BufferLength,
 +                          KPROCESSOR_MODE PreviousMode)
 +{
 +    NTSTATUS Status = STATUS_SUCCESS;
 +
 +    if (Class < ClassListEntries)
 +    {
 +        if (!(ClassList[Class].Flags & ICIF_SET))
 +        {
 +            Status = STATUS_INVALID_INFO_CLASS;
 +        }
 +        else if (ClassList[Class].RequiredSizeSET > 0 &&
 +                 BufferLength != ClassList[Class].RequiredSizeSET)
 +        {
 +            if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE))
 +            {
 +                Status = STATUS_INFO_LENGTH_MISMATCH;
 +            }
 +        }
 +
 +        if (NT_SUCCESS(Status))
 +        {
 +            if (PreviousMode != KernelMode)
 +            {
 +                _SEH_TRY
 +                {
 +                    ProbeForRead(Buffer,
 +                                 BufferLength,
 +                                 ClassList[Class].AlignmentSET);
 +                }
 +                _SEH_HANDLE
 +                {
 +                    Status = _SEH_GetExceptionCode();
 +                }
 +                _SEH_END;
 +            }
 +        }
 +    }
 +    else
 +        Status = STATUS_INVALID_INFO_CLASS;
 +
 +    return Status;
 +}
 +
 +#ifndef _M_AMD64
 +FORCEINLINE
 +#else
 +static inline
 +#endif
 +NTSTATUS
 +DefaultQueryInfoBufferCheck(ULONG Class,
 +                            const INFORMATION_CLASS_INFO *ClassList,
 +                            ULONG ClassListEntries,
 +                            PVOID Buffer,
 +                            ULONG BufferLength,
 +                            PULONG ReturnLength,
 +                            PULONG_PTR ReturnLengthLong,
 +                            KPROCESSOR_MODE PreviousMode)
 +{
 +    NTSTATUS Status = STATUS_SUCCESS;
 +
 +    if (Class < ClassListEntries)
 +    {
 +        if (!(ClassList[Class].Flags & ICIF_QUERY))
 +        {
 +            Status = STATUS_INVALID_INFO_CLASS;
 +        }
 +        else if (ClassList[Class].RequiredSizeQUERY > 0 &&
 +                 BufferLength != ClassList[Class].RequiredSizeQUERY)
 +        {
 +            if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE))
 +            {
 +                Status = STATUS_INFO_LENGTH_MISMATCH;
 +            }
 +        }
 +
 +        if (NT_SUCCESS(Status))
 +        {
 +            if (PreviousMode != KernelMode)
 +            {
 +                _SEH_TRY
 +                {
 +                    if (Buffer != NULL)
 +                    {
 +                        ProbeForWrite(Buffer,
 +                                      BufferLength,
 +                                      ClassList[Class].AlignmentQUERY);
 +                    }
 +
 +                    if (ReturnLength != NULL)
 +                    {
 +                        ProbeForWriteUlong(ReturnLength);
 +                    }
 +                    if (ReturnLengthLong != NULL)
 +                    {
 +                        ProbeForWrite(ReturnLengthLong, sizeof(ULONG_PTR), sizeof(ULONG_PTR));
 +                    }
 +                }
 +                _SEH_HANDLE
 +                {
 +                    Status = _SEH_GetExceptionCode();
 +                }
 +                _SEH_END;
 +            }
 +        }
 +    }
 +    else
 +        Status = STATUS_INVALID_INFO_CLASS;
 +
 +    return Status;
 +}
 +
++=======
++>>>>>>> .merge-rechts.r37853
  /*
   * Use IsPointerOffset to test whether a pointer should be interpreted as an offset
   * or as a pointer
@@@ -303,9 -137,8 +300,10 @@@ C_ASSERT(FIELD_OFFSET(KTHREAD, Callback
  C_ASSERT(FIELD_OFFSET(KTHREAD, ApcState.Process) == KTHREAD_APCSTATE_PROCESS);
  C_ASSERT(FIELD_OFFSET(KPROCESS, DirectoryTableBase) == KPROCESS_DIRECTORY_TABLE_BASE);
  C_ASSERT(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
  C_ASSERT(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
 +#endif
 +
  #ifdef _M_IX86
  C_ASSERT(FIELD_OFFSET(KPCR, IRR) == KPCR_IRR);
  C_ASSERT(FIELD_OFFSET(KPCR, IDR) == KPCR_IDR);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -227,16 -227,18 +227,18 @@@ KeRosCaptureUserStackBackTrace(IN ULON
      return (USHORT)i;
  }
  
 -
  VOID
  FASTCALL
 -KeRosDumpStackFrameArray(IN PULONG Frames,
 +KeRosDumpStackFrameArray(IN PULONG_PTR Frames,
                           IN ULONG FrameCount)
  {
 -    ULONG i, Addr;
 +    ULONG i;
 +    ULONG_PTR Addr;
      BOOLEAN InSystem;
      PVOID p;
-     PLDR_DATA_TABLE_ENTRY LdrEntry;
+     /* GCC complaints that it may be used uninitialized */
+     PLDR_DATA_TABLE_ENTRY LdrEntry = NULL;
  
      /* Loop them */
      for (i = 0; i < FrameCount; i++)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -223,9 -223,9 +223,9 @@@ MmFreeContiguousMemory(IN PVOID BaseAdd
   *
   * @implemented
   */
- VOID STDCALL
+ VOID NTAPI
  MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress,
 -                                   IN ULONG NumberOfBytes,
 +                                   IN SIZE_T NumberOfBytes,
                                     IN MEMORY_CACHING_TYPE CacheType)
  {
     MmLockAddressSpace(MmGetKernelAddressSpace());
Simple merge
@@@ -135,9 -135,9 +135,9 @@@ MmMapIoSpace (IN PHYSICAL_ADDRESS Physi
   *
   * @implemented
   */
- VOID STDCALL
+ VOID NTAPI
  MmUnmapIoSpace (IN PVOID BaseAddress,
 -                IN ULONG NumberOfBytes)
 +                IN SIZE_T NumberOfBytes)
  {
     LONG Offset;
     PVOID Address = BaseAddress;
   *
   * @implemented
   */
- PVOID STDCALL
+ PVOID NTAPI
  MmMapVideoDisplay (IN PHYSICAL_ADDRESS PhysicalAddress,
 -                   IN ULONG   NumberOfBytes,
 +                   IN SIZE_T   NumberOfBytes,
                     IN MEMORY_CACHING_TYPE CacheType)
  {
     return MmMapIoSpace (PhysicalAddress, NumberOfBytes, (BOOLEAN)CacheType);
  /*
   * @implemented
   */
- VOID STDCALL
+ VOID NTAPI
  MmUnmapVideoDisplay (IN PVOID BaseAddress,
 -                     IN ULONG NumberOfBytes)
 +                     IN SIZE_T NumberOfBytes)
  {
     MmUnmapIoSpace (BaseAddress, NumberOfBytes);
  }
Simple merge
@@@ -114,8 -114,8 +114,8 @@@ MmFreeNonCachedPage(PVOID Context, MEMO
   *
   * @implemented
   */
- VOID STDCALL MmFreeNonCachedMemory (IN PVOID BaseAddress,
+ VOID NTAPI MmFreeNonCachedMemory (IN PVOID BaseAddress,
 -                                    IN ULONG NumberOfBytes)
 +                                    IN SIZE_T NumberOfBytes)
  {
     MmLockAddressSpace(MmGetKernelAddressSpace());
     MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(),
@@@ -70,8 -70,8 +70,8 @@@ EiAllocatePool(POOL_TYPE PoolType
  /*
   * @implemented
   */
- PVOID STDCALL
+ PVOID NTAPI
 -ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
 +ExAllocatePool (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
  /*
   * FUNCTION: Allocates pool memory of a specified type and returns a pointer
   * to the allocated block. This routine is used for general purpose allocation
  /*
   * @implemented
   */
- PVOID STDCALL
+ PVOID NTAPI
 -ExAllocatePoolWithTag (POOL_TYPE PoolType, ULONG NumberOfBytes, ULONG Tag)
 +ExAllocatePoolWithTag (POOL_TYPE PoolType, SIZE_T NumberOfBytes, ULONG Tag)
  {
     PVOID Block;
  
  /*
   * @implemented
   */
- PVOID STDCALL
+ PVOID NTAPI
 -ExAllocatePoolWithQuota (POOL_TYPE PoolType, ULONG NumberOfBytes)
 +ExAllocatePoolWithQuota (POOL_TYPE PoolType, SIZE_T NumberOfBytes)
  {
     return(ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, TAG_NONE));
  }
Simple merge
Simple merge
@@@ -4777,10 -4774,10 +4777,10 @@@ MmForceSectionClosed 
  /*
   * @implemented
   */
- NTSTATUS STDCALL
+ NTSTATUS NTAPI
  MmMapViewInSystemSpace (IN PVOID SectionObject,
                          OUT PVOID * MappedBase,
 -                        IN OUT PULONG ViewSize)
 +                        IN OUT PSIZE_T ViewSize)
  {
     PROS_SECTION_OBJECT Section;
     PMM_AVL_TABLE AddressSpace;
Simple merge
@@@ -762,8 -758,8 +758,8 @@@ NtWriteVirtualMemory(IN HANDLE ProcessH
      KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
      PEPROCESS Process;
      NTSTATUS Status = STATUS_SUCCESS;
 -    ULONG BytesWritten = 0;
 +    SIZE_T BytesWritten = 0;
-     PAGED_CODE();    
+     PAGED_CODE();
  
      /* Check if we came from user mode */
      if (PreviousMode != KernelMode)
Simple merge
@@@ -252,10 -252,10 +252,10 @@@ NtQueryInformationProcess(IN HANDLE Pro
          case ProcessSessionInformation:
  
              /* Enter SEH for write safety */
-             _SEH_TRY
+             _SEH2_TRY
              {
                  /* Write back the Session ID */
 -                SessionInfo->SessionId = Process->Session;
 +                SessionInfo->SessionId = PtrToUlong(Process->Session);
  
                  /* Set the return length */
                  Length = sizeof(PROCESS_SESSION_INFORMATION);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -61,9 -61,9 +61,9 @@@ CsrRegisterObjectDefinitions(PCSRSS_OBJ
    return STATUS_SUCCESS;
  }
  
- NTSTATUS STDCALL CsrGetObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle, Object_t **Object, DWORD Access )
+ NTSTATUS WINAPI CsrGetObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle, Object_t **Object, DWORD Access )
  {
 -  ULONG h = (ULONG)Handle >> 2;
 +  ULONG_PTR h = (ULONG_PTR)Handle >> 2;
    DPRINT("CsrGetObject, Object: %x, %x, %x\n", Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0);
  
    RtlEnterCriticalSection(&ProcessData->HandleTableLock);
@@@ -206,9 -206,9 +206,9 @@@ NTSTATUS WINAPI CsrDuplicateHandleTable
     return(STATUS_SUCCESS);
  }
  
- NTSTATUS STDCALL CsrVerifyObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle )
+ NTSTATUS WINAPI CsrVerifyObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle )
  {
 -  ULONG h = (ULONG)Handle >> 2;
 +  ULONG_PTR h = (ULONG_PTR)Handle >> 2;
  
    if (h >= ProcessData->HandleTableSize
        || ProcessData->HandleTable[h].Object == NULL)
@@@ -940,9 -940,9 +940,9 @@@ CLEANUP
  }
  
  HHOOK
- STDCALL
+ APIENTRY
  NtUserSetWindowsHookAW(
 -   int idHook, 
 +   int idHook,
     HOOKPROC lpfn,
     BOOL Ansi)
  {
@@@ -63,7 -63,7 +63,7 @@@ IntGdiGetLanguageID(
  /*
   * @unimplemented
   */
- DWORD_PTR STDCALL
 -DWORD APIENTRY
++DWORD_PTR APIENTRY
  NtUserGetThreadState(
     DWORD Routine)
  {
@@@ -74,12 -74,12 +74,12 @@@ co_IntRegisterLogonProcess(HANDLE Proce
  /*
   * @unimplemented
   */
 -DWORD
 +DWORD_PTR
- STDCALL
+ APIENTRY
  NtUserCallNoParam(DWORD Routine)
  {
 -   DWORD Result = 0;
 -   DECLARE_RETURN(DWORD);
 +   DWORD_PTR Result = 0;
 +   DECLARE_RETURN(DWORD_PTR);
  
     DPRINT("Enter NtUserCallNoParam\n");
     UserEnterExclusive();
@@@ -138,8 -138,8 +138,8 @@@ CLEANUP
  /*
   * @implemented
   */
 -DWORD
 +DWORD_PTR
- STDCALL
+ APIENTRY
  NtUserCallOneParam(
     DWORD Param,
     DWORD Routine)
@@@ -415,8 -415,8 +415,8 @@@ CLEANUP
  /*
   * @implemented
   */
 -DWORD
 +DWORD_PTR
- STDCALL
+ APIENTRY
  NtUserCallTwoParam(
     DWORD Param1,
     DWORD Param2,
                                      Count,
                                      2);
  
 -                  Ret = (DWORD)UserRegisterSystemClasses(Count,
 +                  Ret = (DWORD_PTR)UserRegisterSystemClasses(Count,
                                                           RegSysClassArray);
                }
-               _SEH_HANDLE
+               _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
                {
-                   SetLastNtError(_SEH_GetExceptionCode());
+                   SetLastNtError(_SEH2_GetExceptionCode());
                }
-               _SEH_END;
+               _SEH2_END;
            }
  
            RETURN( Ret);
Simple merge
@@@ -4,12 -4,9 +4,13 @@@
        <define name="INT16">SHORT</define>
        <define name="YYDEBUG">1</define>
        <include base="wpp">.</include>
 +      <include base="ReactOS">include/reactos/wine</include>
 +      <include base="ReactOS">include/reactos</include>
 +      <include base="ReactOS">include</include>
 +      <include base="ReactOS" root="intermediate">include</include>
        <library>wpp</library>
        <file>client.c</file>
+       <file>expr.c</file>
        <file>hash.c</file>
        <file>header.c</file>
        <file>proxy.c</file>