- Fix the stupid mess we created when making this from the cmake branch
authorCameron Gutman <aicommander@gmail.com>
Fri, 5 Aug 2011 02:25:05 +0000 (02:25 +0000)
committerCameron Gutman <aicommander@gmail.com>
Fri, 5 Aug 2011 02:25:05 +0000 (02:25 +0000)
- Part 1 of 2

svn path=/branches/GSoC_2011/TcpIpDriver/; revision=53074

88 files changed:
PreLoad.cmake
base/applications/rapps/lang/bg-BG.rc
base/applications/rapps/lang/cs-CZ.rc
base/applications/rapps/lang/de-DE.rc
base/applications/rapps/lang/en-US.rc
base/applications/rapps/lang/es-ES.rc
base/applications/rapps/lang/fr-FR.rc
base/applications/rapps/lang/it-IT.rc
base/applications/rapps/lang/ja-JP.rc
base/applications/rapps/lang/no-NO.rc
base/applications/rapps/lang/pl-PL.rc
base/applications/rapps/lang/ru-RU.rc
base/applications/rapps/lang/sk-SK.rc
base/applications/rapps/lang/uk-UA.rc
boot/freeldr/freeldr/arch/i386/fathelp.S
boot/freeldr/freeldr/arch/i386/realmode.S
boot/freeldr/freeldr/freeldr.c
cmake/CMakeMacros.cmake
cmake/Platform/Windows-cl.cmake
cmake/Platform/Windows.cmake
cmake/config-amd64.cmake
cmake/config-arm.cmake
cmake/config.cmake
dll/directx/ksproxy/datatype.cpp
dll/directx/ksproxy/input_pin.cpp
dll/directx/ksproxy/interface.cpp
dll/directx/ksproxy/ksproxy.cpp
dll/directx/ksproxy/output_pin.cpp
dll/directx/wine/d3dx9_24/d3dx9_24.spec
dll/directx/wine/d3dx9_36/d3dx9_36.spec
dll/directx/wine/d3dx9_36/d3dx9_36_main.c
dll/directx/wine/wined3d/state.c
dll/ntdll/ldr/ldrinit.c
dll/win32/kernel32/client/dllmain.c
dll/win32/kernel32/client/file/find.c
dll/win32/kernel32/client/handle.c
dll/win32/kernel32/client/heapmem.c
dll/win32/kernel32/include/baseheap.h
dll/win32/kernel32/include/kernel32.h
dll/win32/shlwapi/shlwapi_Hu.rc
dll/win32/shlwapi/shlwapi_Pt.rc
dll/win32/wsock32/wsock32.spec
drivers/network/ndis/ndis/miniport.c
drivers/network/tcpip/include/debug.h
drivers/storage/ide/uniata/id_sata.cpp
drivers/usb/usbehci/usbehci.h
hal/halx86/mp/i386/mps.S
include/psdk/winefs.h
include/reactos/buildno.h.cmake
include/reactos/mc/neteventmsg.mc
include/reactos/version.h.cmake
include/reactos/wine/alloca.h
include/reactos/wine/port.h
include/reactos/wine/test.h
include/reactos/wine/typeof.h
lib/drivers/ip/network/routines.c
lib/rossym/compat.h
lib/rossym/delete.c
lib/rossym/dwarf.h
lib/rossym/dwarfabbrev.c
lib/rossym/dwarfaranges.c
lib/rossym/dwarfcfa.c
lib/rossym/dwarfget.c
lib/rossym/dwarfinfo.c
lib/rossym/dwarfopen.c
lib/rossym/dwarfpc.c
lib/rossym/find.c
lib/rossym/fromfile.c
lib/rossym/frommem.c
lib/rossym/initkm.c
lib/rossym/initum.c
lib/rossym/pe.c
lib/rossym/pe.h
lib/rossym/rossympriv.h
lib/rossym/zwfile.c
lib/sdk/crt/string/atol.c
media/inf/syssetup.inf
ntoskrnl/ex/sysinfo.c
ntoskrnl/kdbg/kdb_symbols.c
ntoskrnl/mm/ARM3/vadnode.c
ntoskrnl/ntoskrnl.spec
subsystems/win32/csrss/csrsrv/api/process.c
subsystems/win32/csrss/csrsrv/api/wapi.c
subsystems/win32/csrss/csrsrv/init.c
subsystems/win32/csrss/csrsrv/srv.h
subsystems/win32/csrss/win32csr/console.c
toolchain-msvc.cmake
tools/rsym/rsym.c [new file with mode: 0644]

index 0cc3401..e74b5d9 100644 (file)
@@ -1,10 +1,10 @@
-\r
-# small trick to get the real source directory at this stage\r
-STRING(REPLACE "/PreLoad.cmake" "" REACTOS_HOME_DIR ${CMAKE_CURRENT_LIST_FILE})\r
-\r
-#message("/PreLoad.cmake ... ${REACTOS_HOME_DIR}")\r
-\r
-SET(CMAKE_MODULE_PATH "${REACTOS_HOME_DIR}/cmake" CACHE INTERNAL "")\r
-\r
-#message("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}")\r
-\r
+
+# small trick to get the real source directory at this stage
+STRING(REPLACE "/PreLoad.cmake" "" REACTOS_HOME_DIR ${CMAKE_CURRENT_LIST_FILE})
+
+#message("/PreLoad.cmake ... ${REACTOS_HOME_DIR}")
+
+SET(CMAKE_MODULE_PATH "${REACTOS_HOME_DIR}/cmake" CACHE INTERNAL "")
+
+#message("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}")
+
index 35057a8..0d140c6 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index efd5f98..95dda75 100644 (file)
@@ -3,8 +3,6 @@
  * UPDATED:     2010-12-12
  */
 
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index b7ddda3..8c05ad7 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
 
 IDR_MAINMENU MENU
index c5e674e..677ca86 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 IDR_MAINMENU MENU
index 1af56cf..3ade82d 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
 
 IDR_MAINMENU MENU
index 8b25bc8..2376d97 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
 
 IDR_MAINMENU MENU
index 5bec94b..adfb35a 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
 
 IDR_MAINMENU MENU
index 59c0670..365c4ef 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index eeea091..2934321 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
 
 IDR_MAINMENU MENU
index 67d908d..ddb2093 100644 (file)
@@ -6,8 +6,6 @@
  *         IRC: irc.freenode.net #reactos-pl;
  */
 
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index 2b39ed5..5c2ae8a 100644 (file)
@@ -1,5 +1,3 @@
-#pragma code_page(65001) /* UTF-8 */
-
 LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index f4032f5..a4873c6 100644 (file)
@@ -3,8 +3,6 @@
  * LAST CHANGE:  26-07-2010
  */
 
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index 339f985..c133e97 100644 (file)
@@ -6,8 +6,6 @@
  * TRANSLATOR:  Sakara Yevhen, Igor Paliychuk
  */
 
-#pragma code_page(65001) // UTF-8
-
 LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
 
 IDR_MAINMENU MENU
index 7bd7fb3..4403aa5 100644 (file)
@@ -56,6 +56,7 @@ PUBLIC _mainCRTStartup        // For Mingw32 builds where the linker looks for this sym
 _mainCRTStartup:
 PUBLIC start
 start:
+#if 0
         .byte  HEX(e9)
                .byte   HEX(fd)
                .byte   HEX(01)
@@ -134,7 +135,7 @@ LoadFile_Done:
 
 // Reads the entire FAT into memory at 7000:0000
 ReadFatIntoMemory:
-        mov   ax, [bp+HiddenSectors] 
+        mov   ax, [bp+HiddenSectors]
         mov   dx, [bp+HiddenSectors+2]
                add   ax, [bp+ReservedSectors]
                adc   dx, 0
@@ -233,6 +234,7 @@ msgLoading: .asciz "Loading FreeLoader...\r\n"
 
             .org HEX(1fe)                              // Pad to 510 bytes
                        .word HEX(0aa55)                        // BootSector signature
+#endif
 
 .endcode16
 
index 4464a17..0a146c5 100644 (file)
@@ -2,79 +2,7 @@
 
 #include <asm.inc>
 
-.code16
-PUBLIC _mainCRTStartup
-_mainCRTStartup:
-_LoaderEntry:
-    ret
-
-.endcode16
-
 .code32
 
 
-// globals
-PUBLIC _BootPartition
-_BootPartition:
-PUBLIC _BootDrive
-_BootDrive:
-
-PUBLIC _PageDirectoryStart
-_PageDirectoryStart:
-PUBLIC _PageDirectoryEnd
-_PageDirectoryEnd:
-
-PUBLIC _startup_pagedirectory
-_startup_pagedirectory:
-PUBLIC _apic_pagetable
-_apic_pagetable:
-PUBLIC _kernel_pagetable
-_kernel_pagetable:
-PUBLIC _lowmem_pagetable
-_lowmem_pagetable:
-
-
-PUBLIC RealEntryPoint
-RealEntryPoint:
-
-PUBLIC _EnableA20
-_EnableA20:
-
-PUBLIC _ChainLoadBiosBootSectorCode
-_ChainLoadBiosBootSectorCode:
-
-PUBLIC _BootOldLinuxKernel
-_BootOldLinuxKernel:
-
-PUBLIC _BootNewLinuxKernel
-_BootNewLinuxKernel:
-
-PUBLIC _SoftReboot
-_SoftReboot:
-
-PUBLIC _DriveMapOldInt13HandlerAddress
-_DriveMapOldInt13HandlerAddress:
-
-PUBLIC _DriveMapInt13HandlerStart
-_DriveMapInt13HandlerStart:
-
-PUBLIC _DriveMapInt13HandlerEnd
-_DriveMapInt13HandlerEnd:
-
-PUBLIC _DriveMapInt13HandlerMapList
-_DriveMapInt13HandlerMapList:
-
-PUBLIC _PnpBiosGetDeviceNode
-_PnpBiosGetDeviceNode:
-
-PUBLIC _PnpBiosGetDeviceNodeCount
-_PnpBiosGetDeviceNodeCount:
-
-PUBLIC _PnpBiosSupported
-_PnpBiosSupported:
-
-PUBLIC _Int386
-_Int386:
-
-
 END
index 3a9ca85..9ad6bd1 100644 (file)
@@ -54,17 +54,6 @@ VOID BootMain(LPSTR CmdLine)
        RunLoader();
 }
 
-#ifdef _MSC_VER
-long _ftol2(double f)
-{
-    return _ftol(f);
-}
-long _ftol2_sse(double f)
-{
-    return _ftol(f);
-}
-#endif
-
 // We need to emulate these, because the original ones don't work in freeldr
 int __cdecl wctomb(char *mbchar, wchar_t wchar)
 {
index ef64eeb..09ea187 100644 (file)
-\r
-macro(set_cpp)\r
-    include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/c++/stlport)\r
-    set(IS_CPP 1)\r
-    add_definitions(\r
-        -DNATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/include/c++\r
-        -DNATIVE_C_INCLUDE=${REACTOS_SOURCE_DIR}/include/crt)\r
-endmacro()\r
-\r
-macro(add_dependency_node _node)\r
-    if(GENERATE_DEPENDENCY_GRAPH)\r
-        get_target_property(_type ${_node} TYPE)\r
-        if(_type MATCHES SHARED_LIBRARY OR ${_node} MATCHES ntoskrnl)\r
-            file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "    <node id=\"${_node}\"/>\n")\r
-        endif()\r
-     endif()\r
-endmacro()\r
-\r
-macro(add_dependency_edge _source _target)\r
-    if(GENERATE_DEPENDENCY_GRAPH)\r
-        get_target_property(_type ${_source} TYPE)\r
-        if(_type MATCHES SHARED_LIBRARY)\r
-            file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "    <edge source=\"${_source}\" target=\"${_target}\"/>\n")\r
-        endif()\r
-    endif()\r
-endmacro()\r
-\r
-macro(add_dependency_header)\r
-    file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<graphml>\n  <graph id=\"ReactOS dependencies\" edgedefault=\"directed\">\n")\r
-endmacro()\r
-\r
-macro(add_dependency_footer)\r
-    add_dependency_node(ntdll)\r
-    file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "  </graph>\n</graphml>\n")\r
-endmacro()\r
-\r
-macro(add_message_headers)\r
-    foreach(_in_FILE ${ARGN})\r
-        get_filename_component(FILE ${_in_FILE} NAME_WE)\r
-        macro_mc(${FILE})\r
-        add_custom_command(\r
-            OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h\r
-            COMMAND ${COMMAND_MC}\r
-            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc)\r
-        set_source_files_properties(\r
-            ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc\r
-            PROPERTIES GENERATED TRUE)\r
-        add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc)\r
-    endforeach()\r
-endmacro()\r
-\r
-macro(dir_to_num dir var)\r
-    if(${dir} STREQUAL reactos/system32)\r
-        set(${var} 1)\r
-    elseif(${dir} STREQUAL reactos/system32/drivers)\r
-        set(${var} 2)\r
-    elseif(${dir} STREQUAL reactos/Fonts)\r
-        set(${var} 3)\r
-    elseif(${dir} STREQUAL reactos)\r
-        set(${var} 4)\r
-    elseif(${dir} STREQUAL reactos/system32/drivers/etc)\r
-        set(${var} 5)\r
-    elseif(${dir} STREQUAL reactos/inf)\r
-        set(${var} 6)\r
-    elseif(${dir} STREQUAL reactos/bin)\r
-        set(${var} 7)\r
-    elseif(${dir} STREQUAL reactos/media)\r
-        set(${var} 8)\r
-    else()\r
-        message(ERROR "Wrong destination: ${dir}")\r
-    endif()\r
-endmacro()\r
-\r
-function(add_cd_file)\r
-    cmake_parse_arguments(_CD "NO_CAB" "DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN})\r
-    if(NOT (_CD_TARGET OR _CD_FILE))\r
-        message(FATAL_ERROR "You must provide a target or a file to install!")\r
-    endif()\r
-\r
-    if(NOT _CD_DESTINATION)\r
-        message(FATAL_ERROR "You must provide a destination")\r
-    elseif(${_CD_DESTINATION} STREQUAL root)\r
-        set(_CD_DESTINATION "")\r
-    endif()\r
-\r
-    if(NOT _CD_FOR)\r
-        message(FATAL_ERROR "You must provide a cd name (or "all" for all of them) to install the file on!")\r
-    endif()\r
-\r
-    #get file if we need to\r
-    if(NOT _CD_FILE)\r
-        get_target_property(_CD_FILE ${_CD_TARGET} LOCATION)\r
-    endif()\r
-\r
-    #do we add it to all CDs?\r
-    if(_CD_FOR STREQUAL all)\r
-        set(_CD_FOR "bootcd;livecd;regtest")\r
-    endif()\r
-\r
-    #do we add it to bootcd?\r
-    list(FIND _CD_FOR bootcd __cd)\r
-    if(NOT __cd EQUAL -1)\r
-        #whether or not we should put it in reactos.cab or directly on cd\r
-        if(_CD_NO_CAB)\r
-            #directly on cd\r
-            foreach(item ${_CD_FILE})\r
-                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.cmake "file(COPY \"${item}\" DESTINATION \"\${CD_DIR}/${_CD_DESTINATION}\")\n")\r
-            endforeach()\r
-            if(_CD_NAME_ON_CD)\r
-                get_filename_component(__file ${_CD_FILE} NAME)\r
-                #rename it in the cd tree\r
-                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n")\r
-            endif()\r
-            if(_CD_TARGET)\r
-                #manage dependency\r
-                add_dependencies(bootcd ${_CD_TARGET})\r
-            endif()\r
-        else()\r
-            #add it in reactos.cab\r
-            dir_to_num(${_CD_DESTINATION} _num)\r
-            if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)\r
-                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n")\r
-            else()\r
-                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "\"${_CD_FILE}\" ${_num}\n")\r
-            endif()\r
-            if(_CD_TARGET)\r
-                #manage dependency\r
-                add_dependencies(reactos_cab ${_CD_TARGET})\r
-            endif()\r
-        endif()\r
-    endif() #end bootcd\r
-\r
-    #do we add it to livecd?\r
-    list(FIND _CD_FOR livecd __cd)\r
-    if(NOT __cd EQUAL -1)\r
-        #manage dependency\r
-        if(_CD_TARGET)\r
-            add_dependencies(livecd ${_CD_TARGET})\r
-        endif()\r
-        foreach(item ${_CD_FILE})\r
-            file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake "file(COPY \"${item}\" DESTINATION \"\${CD_DIR}/${_CD_DESTINATION}\")\n")\r
-        endforeach()\r
-        if(_CD_NAME_ON_CD)\r
-            get_filename_component(__file ${_CD_FILE} NAME)\r
-            #rename it in the cd tree\r
-            file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n")\r
-        endif()\r
-    endif() #end livecd\r
-\r
-    #do we add it to regtest?\r
-    list(FIND _CD_FOR regtest __cd)\r
-    if(NOT __cd EQUAL -1)\r
-        #whether or not we should put it in reactos.cab or directly on cd\r
-        if(_CD_NO_CAB)\r
-            #directly on cd\r
-            foreach(item ${_CD_FILE})\r
-                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake "file(COPY \"${item}\" DESTINATION \"\${CD_DIR}/${_CD_DESTINATION}\")\n")\r
-            endforeach()\r
-            if(_CD_NAME_ON_CD)\r
-                get_filename_component(__file ${_CD_FILE} NAME)\r
-                #rename it in the cd tree\r
-                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n")\r
-            endif()\r
-            if(_CD_TARGET)\r
-                #manage dependency\r
-                add_dependencies(bootcdregtest ${_CD_TARGET})\r
-            endif()\r
-        else()\r
-            #add it in reactos.cab\r
-            #dir_to_num(${_CD_DESTINATION} _num)\r
-            #file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n")\r
-            #if(_CD_TARGET)\r
-            #    #manage dependency\r
-            #    add_dependencies(reactos_cab ${_CD_TARGET})\r
-            #endif()\r
-        endif()\r
-    endif() #end bootcd\r
-endfunction()\r
-\r
-# Create module_clean targets\r
-function(add_clean_target target)\r
-    if(CMAKE_GENERATOR MATCHES "Unix Makefiles" OR CMAKE_GENERATOR MATCHES "MinGW Makefiles")\r
-        set(CLEAN_COMMAND make clean)\r
-    elseif(CMAKE_GENERATOR MATCHES "NMake Makefiles")\r
-        set(CLEAN_COMMAND nmake clean)\r
-    endif()\r
-    add_custom_target(${target}_clean\r
-        COMMAND ${CLEAN_COMMAND}\r
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}\r
-        COMMENT "Cleaning ${target}")\r
-endfunction()\r
-\r
-if(NOT MSVC_IDE)\r
-    function(add_library name)\r
-        _add_library(${name} ${ARGN})\r
-        add_clean_target(${name})\r
-    endfunction()\r
-\r
-    function(add_executable name)\r
-        _add_executable(${name} ${ARGN})\r
-        add_clean_target(${name})\r
-    endfunction()\r
-endif()\r
-\r
-if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)\r
-    macro(to_win_path _cmake_path _native_path)\r
-        string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}")\r
-    endmacro()\r
-\r
-    macro(concatenate_files _file1 _file2 _output)\r
-        to_win_path("${_file1}" _real_file1)\r
-        to_win_path("${_file2}" _real_file2)\r
-        to_win_path("${_output}" _real_output)\r
-        add_custom_command(\r
-            OUTPUT ${_output}\r
-            COMMAND cmd.exe /C "copy /Y /B ${_real_file1} + ${_real_file2} ${_real_output} > nul"\r
-            DEPENDS ${_file1}\r
-            DEPENDS ${_file2})\r
-    endmacro()\r
-else()\r
-    macro(concatenate_files _file1 _file2 _output)\r
-        add_custom_command(\r
-            OUTPUT ${_output}\r
-            COMMAND cat ${_file1} ${_file2} > ${_output}\r
-            DEPENDS ${_file1}\r
-            DEPENDS ${_file2})\r
-    endmacro()\r
-endif()\r
-\r
-macro(add_importlibs MODULE)\r
-    add_dependency_node(${MODULE})\r
-    foreach(LIB ${ARGN})\r
-        if ("${LIB}" MATCHES "msvcrt")\r
-            add_definitions(-D_DLL -D__USE_CRTIMP)\r
-            target_link_libraries(${MODULE} msvcrtex)\r
-        endif()\r
-        target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX})\r
-        add_dependencies(${MODULE} lib${LIB})\r
-        add_dependency_edge(${MODULE} ${LIB})\r
-    endforeach()\r
-endmacro()\r
+
+macro(set_cpp)
+    include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/c++/stlport)
+    set(IS_CPP 1)
+    add_definitions(
+        -DNATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/include/c++
+        -DNATIVE_C_INCLUDE=${REACTOS_SOURCE_DIR}/include/crt)
+endmacro()
+
+macro(add_dependency_node _node)
+    if(GENERATE_DEPENDENCY_GRAPH)
+        get_target_property(_type ${_node} TYPE)
+        if(_type MATCHES SHARED_LIBRARY OR ${_node} MATCHES ntoskrnl)
+            file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "    <node id=\"${_node}\"/>\n")
+        endif()
+     endif()
+endmacro()
+
+macro(add_dependency_edge _source _target)
+    if(GENERATE_DEPENDENCY_GRAPH)
+        get_target_property(_type ${_source} TYPE)
+        if(_type MATCHES SHARED_LIBRARY)
+            file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "    <edge source=\"${_source}\" target=\"${_target}\"/>\n")
+        endif()
+    endif()
+endmacro()
+
+macro(add_dependency_header)
+    file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<graphml>\n  <graph id=\"ReactOS dependencies\" edgedefault=\"directed\">\n")
+endmacro()
+
+macro(add_dependency_footer)
+    add_dependency_node(ntdll)
+    file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "  </graph>\n</graphml>\n")
+endmacro()
+
+macro(add_message_headers)
+    foreach(_in_FILE ${ARGN})
+        get_filename_component(FILE ${_in_FILE} NAME_WE)
+        macro_mc(${FILE})
+        add_custom_command(
+            OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h
+            COMMAND ${COMMAND_MC}
+            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc)
+        set_source_files_properties(
+            ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc
+            PROPERTIES GENERATED TRUE)
+        add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc)
+    endforeach()
+endmacro()
+
+macro(dir_to_num dir var)
+    if(${dir} STREQUAL reactos/system32)
+        set(${var} 1)
+    elseif(${dir} STREQUAL reactos/system32/drivers)
+        set(${var} 2)
+    elseif(${dir} STREQUAL reactos/Fonts)
+        set(${var} 3)
+    elseif(${dir} STREQUAL reactos)
+        set(${var} 4)
+    elseif(${dir} STREQUAL reactos/system32/drivers/etc)
+        set(${var} 5)
+    elseif(${dir} STREQUAL reactos/inf)
+        set(${var} 6)
+    elseif(${dir} STREQUAL reactos/bin)
+        set(${var} 7)
+    elseif(${dir} STREQUAL reactos/media)
+        set(${var} 8)
+    else()
+        message(ERROR "Wrong destination: ${dir}")
+    endif()
+endmacro()
+
+function(add_cd_file)
+    cmake_parse_arguments(_CD "NO_CAB" "DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN})
+    if(NOT (_CD_TARGET OR _CD_FILE))
+        message(FATAL_ERROR "You must provide a target or a file to install!")
+    endif()
+
+    if(NOT _CD_DESTINATION)
+        message(FATAL_ERROR "You must provide a destination")
+    elseif(${_CD_DESTINATION} STREQUAL root)
+        set(_CD_DESTINATION "")
+    endif()
+
+    if(NOT _CD_FOR)
+        message(FATAL_ERROR "You must provide a cd name (or "all" for all of them) to install the file on!")
+    endif()
+
+    #get file if we need to
+    if(NOT _CD_FILE)
+        get_target_property(_CD_FILE ${_CD_TARGET} LOCATION)
+    endif()
+
+    #do we add it to all CDs?
+    if(_CD_FOR STREQUAL all)
+        set(_CD_FOR "bootcd;livecd;regtest")
+    endif()
+
+    #do we add it to bootcd?
+    list(FIND _CD_FOR bootcd __cd)
+    if(NOT __cd EQUAL -1)
+        #whether or not we should put it in reactos.cab or directly on cd
+        if(_CD_NO_CAB)
+            #directly on cd
+            foreach(item ${_CD_FILE})
+                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.cmake "file(COPY \"${item}\" DESTINATION \"\${CD_DIR}/${_CD_DESTINATION}\")\n")
+            endforeach()
+            if(_CD_NAME_ON_CD)
+                get_filename_component(__file ${_CD_FILE} NAME)
+                #rename it in the cd tree
+                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n")
+            endif()
+            if(_CD_TARGET)
+                #manage dependency
+                add_dependencies(bootcd ${_CD_TARGET})
+            endif()
+        else()
+            #add it in reactos.cab
+            dir_to_num(${_CD_DESTINATION} _num)
+            if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
+                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n")
+            else()
+                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "\"${_CD_FILE}\" ${_num}\n")
+            endif()
+            if(_CD_TARGET)
+                #manage dependency
+                add_dependencies(reactos_cab ${_CD_TARGET})
+            endif()
+        endif()
+    endif() #end bootcd
+
+    #do we add it to livecd?
+    list(FIND _CD_FOR livecd __cd)
+    if(NOT __cd EQUAL -1)
+        #manage dependency
+        if(_CD_TARGET)
+            add_dependencies(livecd ${_CD_TARGET})
+        endif()
+        foreach(item ${_CD_FILE})
+            file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake "file(COPY \"${item}\" DESTINATION \"\${CD_DIR}/${_CD_DESTINATION}\")\n")
+        endforeach()
+        if(_CD_NAME_ON_CD)
+            get_filename_component(__file ${_CD_FILE} NAME)
+            #rename it in the cd tree
+            file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n")
+        endif()
+    endif() #end livecd
+
+    #do we add it to regtest?
+    list(FIND _CD_FOR regtest __cd)
+    if(NOT __cd EQUAL -1)
+        #whether or not we should put it in reactos.cab or directly on cd
+        if(_CD_NO_CAB)
+            #directly on cd
+            foreach(item ${_CD_FILE})
+                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake "file(COPY \"${item}\" DESTINATION \"\${CD_DIR}/${_CD_DESTINATION}\")\n")
+            endforeach()
+            if(_CD_NAME_ON_CD)
+                get_filename_component(__file ${_CD_FILE} NAME)
+                #rename it in the cd tree
+                file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n")
+            endif()
+            if(_CD_TARGET)
+                #manage dependency
+                add_dependencies(bootcdregtest ${_CD_TARGET})
+            endif()
+        else()
+            #add it in reactos.cab
+            #dir_to_num(${_CD_DESTINATION} _num)
+            #file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n")
+            #if(_CD_TARGET)
+            #    #manage dependency
+            #    add_dependencies(reactos_cab ${_CD_TARGET})
+            #endif()
+        endif()
+    endif() #end bootcd
+endfunction()
+
+# Create module_clean targets
+function(add_clean_target target)
+    if(CMAKE_GENERATOR MATCHES "Unix Makefiles" OR CMAKE_GENERATOR MATCHES "MinGW Makefiles")
+        set(CLEAN_COMMAND make clean)
+    elseif(CMAKE_GENERATOR MATCHES "NMake Makefiles")
+        set(CLEAN_COMMAND nmake clean)
+    endif()
+    add_custom_target(${target}_clean
+        COMMAND ${CLEAN_COMMAND}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        COMMENT "Cleaning ${target}")
+endfunction()
+
+if(NOT MSVC_IDE)
+    function(add_library name)
+        _add_library(${name} ${ARGN})
+        add_clean_target(${name})
+    endfunction()
+
+    function(add_executable name)
+        _add_executable(${name} ${ARGN})
+        add_clean_target(${name})
+    endfunction()
+endif()
+
+if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
+    macro(to_win_path _cmake_path _native_path)
+        string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}")
+    endmacro()
+
+    macro(concatenate_files _file1 _file2 _output)
+        to_win_path("${_file1}" _real_file1)
+        to_win_path("${_file2}" _real_file2)
+        to_win_path("${_output}" _real_output)
+        add_custom_command(
+            OUTPUT ${_output}
+            COMMAND cmd.exe /C "copy /Y /B ${_real_file1} + ${_real_file2} ${_real_output} > nul"
+            DEPENDS ${_file1}
+            DEPENDS ${_file2})
+    endmacro()
+else()
+    macro(concatenate_files _file1 _file2 _output)
+        add_custom_command(
+            OUTPUT ${_output}
+            COMMAND cat ${_file1} ${_file2} > ${_output}
+            DEPENDS ${_file1}
+            DEPENDS ${_file2})
+    endmacro()
+endif()
+
+macro(add_importlibs MODULE)
+    add_dependency_node(${MODULE})
+    foreach(LIB ${ARGN})
+        if ("${LIB}" MATCHES "msvcrt")
+            add_definitions(-D_DLL -D__USE_CRTIMP)
+            target_link_libraries(${MODULE} msvcrtex)
+        endif()
+        target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX})
+        add_dependencies(${MODULE} lib${LIB})
+        add_dependency_edge(${MODULE} ${LIB})
+    endforeach()
+endmacro()
index 5751861..76c1f6f 100644 (file)
-# try to load any previously computed information for C on this platform\r
-INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL)\r
-# try to load any previously computed information for CXX on this platform\r
-INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL)\r
-\r
-SET(WIN32 1)\r
-\r
-INCLUDE(Platform/cl)\r
-\r
-############\r
-# Detect WDK build environment\r
-IF($ENV{DDKBUILDENV} MATCHES "chk")\r
-  MESSAGE(STATUS "DDK/WDK checked build environment detected.")\r
-  SET(CMAKE_USE_WDK_ENV 1)\r
-ENDIF()\r
-\r
-IF($ENV{DDKBUILDENV} MATCHES "fre")\r
-  MESSAGE(STATUS "DDK/WDK free build environment detected.")\r
-  SET(CMAKE_USE_WDK_ENV 1)\r
-ENDIF()\r
-\r
-if(CMAKE_USE_WDK_ENV)\r
-\r
-    # Detect output architecture\r
-    if(NOT ARCH)\r
-        if($ENV{AMD64} MATCHES 1)\r
-            set(ARCH amd64)\r
-            set(MSVC_C_ARCHITECTURE_ID 64)\r
-        else()\r
-            set(ARCH i386)\r
-        endif()\r
-    endif()\r
-\r
-    # Add library directories\r
-    STRING(REPLACE * ${ARCH} ATL_LIB_PATH $ENV{ATL_LIB_PATH})\r
-    STRING(REPLACE * ${ARCH} CRT_LIB_PATH $ENV{CRT_LIB_PATH})\r
-    STRING(REPLACE * ${ARCH} DDK_LIB_PATH $ENV{DDK_LIB_PATH})\r
-    STRING(REPLACE * ${ARCH} KMDF_LIB_PATH $ENV{KMDF_LIB_PATH})\r
-    STRING(REPLACE * ${ARCH} MFC_LIB_PATH $ENV{MFC_LIB_PATH})\r
-    STRING(REPLACE * ${ARCH} SDK_LIB_PATH $ENV{SDK_LIB_PATH})\r
-    LINK_DIRECTORIES(${ATL_LIB_PATH}\r
-                     ${CRT_LIB_PATH}\r
-                     ${DDK_LIB_PATH}\r
-                     ${IFSKIT_LIB_PATH}\r
-                     ${KMDF_LIB_PATH}\r
-                     ${MFC_LIB_PATH}\r
-                     ${SDK_LIB_PATH})\r
-\r
-    # Add environment variables\r
-    if(NOT CMAKE_CROSSCOMPILING)\r
-        set(ENV{INCLUDE} "$ENV{CRT_INC_PATH};$ENV{SDK_INC_PATH};$ENV{SDK_INC_PATH}\\crt\\stl60")\r
-        include_directories($ENV{INCLUDE})\r
-        set(ENV{LIBPATH} "${CRT_LIB_PATH};${SDK_LIB_PATH}")\r
-        set(ENV{USE_MSVCRT} 1)\r
-        set(ENV{USE_STL} 1)\r
-        set(ENV{STL_VER} 60)\r
-    endif()\r
-endif()\r
-\r
-############\r
-\r
-SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)\r
-SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)\r
-\r
-IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")\r
-   SET (CMAKE_NO_BUILD_TYPE 1)\r
-ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")\r
-IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")\r
-  SET (CMAKE_NO_BUILD_TYPE 1)\r
-  SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING\r
-     "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")\r
-  MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES)\r
-ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")\r
-# does the compiler support pdbtype and is it the newer compiler\r
-IF(CMAKE_GENERATOR MATCHES  "Visual Studio 8")\r
-  SET(CMAKE_COMPILER_2005 1)\r
-ENDIF(CMAKE_GENERATOR MATCHES  "Visual Studio 8")\r
-\r
-# make sure to enable languages after setting configuration types\r
-ENABLE_LANGUAGE(RC)\r
-SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")\r
-\r
-# for nmake we need to compute some information about the compiler\r
-# that is being used.\r
-# the compiler may be free command line, 6, 7, or 71, and\r
-# each have properties that must be determined.\r
-# to avoid running these tests with each cmake run, the\r
-# test results are saved in CMakeCPlatform.cmake, a file\r
-# that is automatically copied into try_compile directories\r
-# by the global generator.\r
-SET(MSVC_IDE 1)\r
-IF(CMAKE_GENERATOR MATCHES "Makefiles")\r
-  SET(MSVC_IDE 0)\r
-  IF(NOT CMAKE_VC_COMPILER_TESTS_RUN)\r
-    SET(CMAKE_VC_COMPILER_TESTS 1)\r
-    SET(testNmakeCLVersionFile\r
-      "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c")\r
-    STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}")\r
-    MESSAGE(STATUS "Check for CL compiler version")\r
-    SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})\r
-    IF (NOT CMAKE_C_COMPILER)\r
-      SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})\r
-    ENDIF(NOT CMAKE_C_COMPILER)\r
-    EXEC_PROGRAM(${CMAKE_TEST_COMPILER}\r
-      ARGS /nologo -EP \"${testNmakeCLVersionFile}\"\r
-      OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT\r
-      RETURN_VALUE CMAKE_COMPILER_RETURN\r
-      )\r
-    IF(NOT CMAKE_COMPILER_RETURN)\r
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log\r
-        "Determining the version of compiler passed with the following output:\n"\r
-        "${CMAKE_COMPILER_OUTPUT}\n\n")\r
-      STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")\r
-      STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1"\r
-        compilerVersion "${compilerVersion}")\r
-      MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}")\r
-      SET(MSVC60)\r
-      SET(MSVC70)\r
-      SET(MSVC71)\r
-      SET(MSVC80)\r
-      SET(CMAKE_COMPILER_2005)\r
-      IF("${compilerVersion}" LESS 1300)\r
-        SET(MSVC60 1)\r
-        SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)\r
-      ENDIF("${compilerVersion}" LESS 1300)\r
-      IF("${compilerVersion}" EQUAL 1300)\r
-        SET(MSVC70 1)\r
-        SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)\r
-      ENDIF("${compilerVersion}" EQUAL 1300)\r
-      IF("${compilerVersion}" EQUAL 1310)\r
-        SET(MSVC71 1)\r
-        SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)\r
-      ENDIF("${compilerVersion}" EQUAL 1310)\r
-      IF("${compilerVersion}" EQUAL 1400)\r
-        SET(MSVC80 1)\r
-        SET(CMAKE_COMPILER_2005 1)\r
-      ENDIF("${compilerVersion}" EQUAL 1400)\r
-      IF("${compilerVersion}" EQUAL 1500)\r
-        SET(MSVC90 1)\r
-      ENDIF("${compilerVersion}" EQUAL 1500)\r
-      IF("${compilerVersion}" EQUAL 1600)\r
-        SET(MSVC10 1)\r
-      ENDIF("${compilerVersion}" EQUAL 1600)\r
-      SET(MSVC_VERSION "${compilerVersion}")\r
-    ELSE(NOT CMAKE_COMPILER_RETURN)\r
-      MESSAGE(STATUS "Check for CL compiler version - failed")\r
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log\r
-        "Determining the version of compiler failed with the following output:\n"\r
-        "${CMAKE_COMPILER_OUTPUT}\n\n")\r
-    ENDIF(NOT CMAKE_COMPILER_RETURN)\r
-    # try to figure out if we are running the free command line\r
-    # tools from Microsoft.  These tools do not provide debug libraries,\r
-    # so the link flags used have to be different.\r
-    MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2")\r
-    SET(testForFreeVCFile\r
-      "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx")\r
-    STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}")\r
-    MESSAGE(STATUS "Check if this is a free VC compiler")\r
-    EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2\r
-      ARGS /nologo /EHsc\r
-      \"${testForFreeVCFile}\"\r
-      OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT\r
-      RETURN_VALUE CMAKE_COMPILER_RETURN\r
-      )\r
-    IF(CMAKE_COMPILER_RETURN)\r
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log\r
-        "Determining if this is a free VC compiler failed with the following output:\n"\r
-        "${CMAKE_COMPILER_OUTPUT}\n\n")\r
-      MESSAGE(STATUS "Check if this is a free VC compiler - yes")\r
-      SET(CMAKE_USING_VC_FREE_TOOLS 1)\r
-    ELSE(CMAKE_COMPILER_RETURN)\r
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log\r
-        "Determining if this is a free VC compiler passed with the following output:\n"\r
-        "${CMAKE_COMPILER_OUTPUT}\n\n")\r
-      MESSAGE(STATUS "Check if this is a free VC compiler - no")\r
-      SET(CMAKE_USING_VC_FREE_TOOLS 0)\r
-    ENDIF(CMAKE_COMPILER_RETURN)\r
-    MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")\r
-  ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN)\r
-ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")\r
-\r
-IF(MSVC_C_ARCHITECTURE_ID MATCHES 64)\r
-  SET(CMAKE_CL_64 1)\r
-ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64)\r
-  SET(CMAKE_CL_64 0)\r
-ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64)\r
-IF(CMAKE_FORCE_WIN64)\r
-  SET(CMAKE_CL_64 1)\r
-ENDIF(CMAKE_FORCE_WIN64)\r
-\r
-#IF("${MSVC_VERSION}" GREATER 1599)\r
-#  SET(MSVC_INCREMENTAL_DEFAULT ON)\r
-#ENDIF()\r
-\r
-# No support for old versions\r
-if(MSVC_VERSION LESS 1310)\r
-message(FATAL_ERROR "Your compiler is too old. Get a newer version!")\r
-endif()\r
-\r
-# for 2005 make sure the manifest is put in the dll with mt\r
-#SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")\r
-#SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}")\r
-# create a C shared library\r
-#SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")\r
-# create a C shared module just copy the shared library rule\r
-#SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")\r
-#SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}")\r
-#SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}")\r
-\r
-SET(CMAKE_BUILD_TYPE_INIT Debug)\r
-SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /Zi /Ob0 /Od")\r
-SET(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /Zi /Ob0 /Od")\r
-SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc")\r
-SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
-SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")\r
-SET(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")\r
-SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
-SET(CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")\r
-SET(CMAKE_C_STANDARD_LIBRARIES_INIT "")\r
-SET(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")\r
-SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")\r
-\r
-# executable linker flags\r
-SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")\r
-# set the stack size and the machine type\r
-SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})\r
-IF(NOT _MACHINE_ARCH_FLAG)\r
-  SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})\r
-ENDIF(NOT _MACHINE_ARCH_FLAG)\r
-SET (CMAKE_EXE_LINKER_FLAGS_INIT\r
-    "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")\r
-\r
-# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype\r
-# on versions that support it\r
-SET( MSVC_INCREMENTAL_YES_FLAG "")\r
-IF(NOT MSVC_INCREMENTAL_DEFAULT)\r
-  SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")\r
-ENDIF()\r
-\r
-IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)\r
-  SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")\r
-  SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")\r
-ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE)\r
-  SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")\r
-  SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")\r
-ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)\r
-# for release and minsize release default to no incremental linking\r
-SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")\r
-SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")\r
-\r
-# copy the EXE_LINKER flags to SHARED and MODULE linker flags\r
-# shared linker flags\r
-SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})\r
-SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})\r
-SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})\r
-SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})\r
-SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})\r
-# module linker flags\r
-SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})\r
-SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})\r
-SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})\r
-SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})\r
-SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})\r
-\r
-# save computed information for this platform\r
-IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")\r
-  CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in\r
-    ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE)\r
-ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")\r
-\r
-IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")\r
-  CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in\r
-               ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE)\r
-ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")\r
+# try to load any previously computed information for C on this platform
+INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL)
+# try to load any previously computed information for CXX on this platform
+INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL)
+
+SET(WIN32 1)
+
+INCLUDE(Platform/cl)
+
+############
+# Detect WDK build environment
+IF($ENV{DDKBUILDENV} MATCHES "chk")
+  MESSAGE(STATUS "DDK/WDK checked build environment detected.")
+  SET(CMAKE_USE_WDK_ENV 1)
+ENDIF()
+
+IF($ENV{DDKBUILDENV} MATCHES "fre")
+  MESSAGE(STATUS "DDK/WDK free build environment detected.")
+  SET(CMAKE_USE_WDK_ENV 1)
+ENDIF()
+
+if(CMAKE_USE_WDK_ENV)
+
+    # Detect output architecture
+    if(NOT ARCH)
+        if($ENV{AMD64} MATCHES 1)
+            set(ARCH amd64)
+            set(MSVC_C_ARCHITECTURE_ID 64)
+        else()
+            set(ARCH i386)
+        endif()
+    endif()
+
+    # Add library directories
+    STRING(REPLACE * ${ARCH} ATL_LIB_PATH $ENV{ATL_LIB_PATH})
+    STRING(REPLACE * ${ARCH} CRT_LIB_PATH $ENV{CRT_LIB_PATH})
+    STRING(REPLACE * ${ARCH} DDK_LIB_PATH $ENV{DDK_LIB_PATH})
+    STRING(REPLACE * ${ARCH} KMDF_LIB_PATH $ENV{KMDF_LIB_PATH})
+    STRING(REPLACE * ${ARCH} MFC_LIB_PATH $ENV{MFC_LIB_PATH})
+    STRING(REPLACE * ${ARCH} SDK_LIB_PATH $ENV{SDK_LIB_PATH})
+    LINK_DIRECTORIES(${ATL_LIB_PATH}
+                     ${CRT_LIB_PATH}
+                     ${DDK_LIB_PATH}
+                     ${IFSKIT_LIB_PATH}
+                     ${KMDF_LIB_PATH}
+                     ${MFC_LIB_PATH}
+                     ${SDK_LIB_PATH})
+
+    # Add environment variables
+    if(NOT CMAKE_CROSSCOMPILING)
+        set(ENV{INCLUDE} "$ENV{CRT_INC_PATH};$ENV{SDK_INC_PATH};$ENV{SDK_INC_PATH}\\crt\\stl60")
+        include_directories($ENV{INCLUDE})
+        set(ENV{LIBPATH} "${CRT_LIB_PATH};${SDK_LIB_PATH}")
+        set(ENV{USE_MSVCRT} 1)
+        set(ENV{USE_STL} 1)
+        set(ENV{STL_VER} 60)
+    endif()
+endif()
+
+############
+
+SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
+SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+   SET (CMAKE_NO_BUILD_TYPE 1)
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
+IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
+  SET (CMAKE_NO_BUILD_TYPE 1)
+  SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING
+     "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
+  MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES)
+ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
+# does the compiler support pdbtype and is it the newer compiler
+IF(CMAKE_GENERATOR MATCHES  "Visual Studio 8")
+  SET(CMAKE_COMPILER_2005 1)
+ENDIF(CMAKE_GENERATOR MATCHES  "Visual Studio 8")
+
+# make sure to enable languages after setting configuration types
+ENABLE_LANGUAGE(RC)
+SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
+
+# for nmake we need to compute some information about the compiler
+# that is being used.
+# the compiler may be free command line, 6, 7, or 71, and
+# each have properties that must be determined.
+# to avoid running these tests with each cmake run, the
+# test results are saved in CMakeCPlatform.cmake, a file
+# that is automatically copied into try_compile directories
+# by the global generator.
+SET(MSVC_IDE 1)
+IF(CMAKE_GENERATOR MATCHES "Makefiles")
+  SET(MSVC_IDE 0)
+  IF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
+    SET(CMAKE_VC_COMPILER_TESTS 1)
+    SET(testNmakeCLVersionFile
+      "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c")
+    STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}")
+    MESSAGE(STATUS "Check for CL compiler version")
+    SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})
+    IF (NOT CMAKE_C_COMPILER)
+      SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})
+    ENDIF(NOT CMAKE_C_COMPILER)
+    EXEC_PROGRAM(${CMAKE_TEST_COMPILER}
+      ARGS /nologo -EP \"${testNmakeCLVersionFile}\"
+      OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
+      RETURN_VALUE CMAKE_COMPILER_RETURN
+      )
+    IF(NOT CMAKE_COMPILER_RETURN)
+      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+        "Determining the version of compiler passed with the following output:\n"
+        "${CMAKE_COMPILER_OUTPUT}\n\n")
+      STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")
+      STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1"
+        compilerVersion "${compilerVersion}")
+      MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}")
+      SET(MSVC60)
+      SET(MSVC70)
+      SET(MSVC71)
+      SET(MSVC80)
+      SET(CMAKE_COMPILER_2005)
+      IF("${compilerVersion}" LESS 1300)
+        SET(MSVC60 1)
+        SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)
+      ENDIF("${compilerVersion}" LESS 1300)
+      IF("${compilerVersion}" EQUAL 1300)
+        SET(MSVC70 1)
+        SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
+      ENDIF("${compilerVersion}" EQUAL 1300)
+      IF("${compilerVersion}" EQUAL 1310)
+        SET(MSVC71 1)
+        SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0)
+      ENDIF("${compilerVersion}" EQUAL 1310)
+      IF("${compilerVersion}" EQUAL 1400)
+        SET(MSVC80 1)
+        SET(CMAKE_COMPILER_2005 1)
+      ENDIF("${compilerVersion}" EQUAL 1400)
+      IF("${compilerVersion}" EQUAL 1500)
+        SET(MSVC90 1)
+      ENDIF("${compilerVersion}" EQUAL 1500)
+      IF("${compilerVersion}" EQUAL 1600)
+        SET(MSVC10 1)
+      ENDIF("${compilerVersion}" EQUAL 1600)
+      SET(MSVC_VERSION "${compilerVersion}")
+    ELSE(NOT CMAKE_COMPILER_RETURN)
+      MESSAGE(STATUS "Check for CL compiler version - failed")
+      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+        "Determining the version of compiler failed with the following output:\n"
+        "${CMAKE_COMPILER_OUTPUT}\n\n")
+    ENDIF(NOT CMAKE_COMPILER_RETURN)
+    # try to figure out if we are running the free command line
+    # tools from Microsoft.  These tools do not provide debug libraries,
+    # so the link flags used have to be different.
+    MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2")
+    SET(testForFreeVCFile
+      "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx")
+    STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}")
+    MESSAGE(STATUS "Check if this is a free VC compiler")
+    EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2
+      ARGS /nologo /EHsc
+      \"${testForFreeVCFile}\"
+      OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
+      RETURN_VALUE CMAKE_COMPILER_RETURN
+      )
+    IF(CMAKE_COMPILER_RETURN)
+      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+        "Determining if this is a free VC compiler failed with the following output:\n"
+        "${CMAKE_COMPILER_OUTPUT}\n\n")
+      MESSAGE(STATUS "Check if this is a free VC compiler - yes")
+      SET(CMAKE_USING_VC_FREE_TOOLS 1)
+    ELSE(CMAKE_COMPILER_RETURN)
+      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+        "Determining if this is a free VC compiler passed with the following output:\n"
+        "${CMAKE_COMPILER_OUTPUT}\n\n")
+      MESSAGE(STATUS "Check if this is a free VC compiler - no")
+      SET(CMAKE_USING_VC_FREE_TOOLS 0)
+    ENDIF(CMAKE_COMPILER_RETURN)
+    MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")
+  ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
+ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
+
+IF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+  SET(CMAKE_CL_64 1)
+ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+  SET(CMAKE_CL_64 0)
+ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+IF(CMAKE_FORCE_WIN64)
+  SET(CMAKE_CL_64 1)
+ENDIF(CMAKE_FORCE_WIN64)
+
+#IF("${MSVC_VERSION}" GREATER 1599)
+#  SET(MSVC_INCREMENTAL_DEFAULT ON)
+#ENDIF()
+
+# No support for old versions
+if(MSVC_VERSION LESS 1310)
+message(FATAL_ERROR "Your compiler is too old. Get a newer version!")
+endif()
+
+# for 2005 make sure the manifest is put in the dll with mt
+#SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+#SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}")
+# create a C shared library
+#SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+# create a C shared module just copy the shared library rule
+#SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
+#SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}")
+#SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}")
+
+SET(CMAKE_BUILD_TYPE_INIT Debug)
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/Zi /Ob0 /Od")
+SET(CMAKE_C_FLAGS_DEBUG_INIT "/Zi /Ob0 /Od")
+SET(CMAKE_CXX_FLAGS_INIT "")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
+SET(CMAKE_C_FLAGS_INIT "")
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
+SET(CMAKE_C_STANDARD_LIBRARIES_INIT "")
+SET(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
+SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+
+# executable linker flags
+SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
+# set the stack size and the machine type
+SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
+IF(NOT _MACHINE_ARCH_FLAG)
+  SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
+ENDIF(NOT _MACHINE_ARCH_FLAG)
+SET (CMAKE_EXE_LINKER_FLAGS_INIT
+    "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
+
+# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
+# on versions that support it
+SET( MSVC_INCREMENTAL_YES_FLAG "")
+IF(NOT MSVC_INCREMENTAL_DEFAULT)
+  SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
+ENDIF()
+
+IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+  SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
+  SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
+ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+  SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
+  SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
+ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
+# for release and minsize release default to no incremental linking
+SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
+
+# copy the EXE_LINKER flags to SHARED and MODULE linker flags
+# shared linker flags
+SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
+SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
+SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
+SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
+SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
+# module linker flags
+SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
+SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
+SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
+SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
+SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
+
+# save computed information for this platform
+IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")
+  CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
+    ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE)
+ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")
+
+IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
+  CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
+               ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE)
+ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
index a6988d4..a858e0c 100644 (file)
@@ -1,36 +1,36 @@
-SET(WIN32 1)\r
-\r
-SET(CMAKE_STATIC_LIBRARY_PREFIX "")\r
-SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")\r
-SET(CMAKE_SHARED_LIBRARY_PREFIX "")          # lib\r
-SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")          # .so\r
-SET(CMAKE_IMPORT_LIBRARY_PREFIX "")\r
-SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")\r
-SET(CMAKE_EXECUTABLE_SUFFIX ".exe")          # .exe\r
-SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib")\r
-SET(CMAKE_DL_LIBS "")\r
-\r
-SET(CMAKE_FIND_LIBRARY_PREFIXES "")\r
-SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")\r
-\r
-# for borland make long command lines are redirected to a file\r
-# with the following syntax, see Windows-bcc32.cmake for use\r
-IF(CMAKE_GENERATOR MATCHES "Borland")\r
-  SET(CMAKE_START_TEMP_FILE "@&&|\n")\r
-  SET(CMAKE_END_TEMP_FILE "\n|")\r
-ENDIF(CMAKE_GENERATOR MATCHES "Borland")\r
-\r
-# for nmake make long command lines are redirected to a file\r
-# with the following syntax, see Windows-bcc32.cmake for use\r
-IF(CMAKE_GENERATOR MATCHES "NMake")\r
-#  SET(CMAKE_START_TEMP_FILE "@<<\n")\r
-#  SET(CMAKE_END_TEMP_FILE "\n<<")\r
-ENDIF(CMAKE_GENERATOR MATCHES "NMake")\r
-\r
-INCLUDE(Platform/WindowsPaths)\r
-\r
-# uncomment these out to debug nmake and borland makefiles\r
-SET(CMAKE_START_TEMP_FILE "")\r
-SET(CMAKE_END_TEMP_FILE "")\r
-#SET(CMAKE_VERBOSE_MAKEFILE 1)\r
-\r
+SET(WIN32 1)
+
+SET(CMAKE_STATIC_LIBRARY_PREFIX "")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_SHARED_LIBRARY_PREFIX "")          # lib
+SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")          # .so
+SET(CMAKE_IMPORT_LIBRARY_PREFIX "")
+SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_EXECUTABLE_SUFFIX ".exe")          # .exe
+SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
+SET(CMAKE_DL_LIBS "")
+
+SET(CMAKE_FIND_LIBRARY_PREFIXES "")
+SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
+
+# for borland make long command lines are redirected to a file
+# with the following syntax, see Windows-bcc32.cmake for use
+IF(CMAKE_GENERATOR MATCHES "Borland")
+  SET(CMAKE_START_TEMP_FILE "@&&|\n")
+  SET(CMAKE_END_TEMP_FILE "\n|")
+ENDIF(CMAKE_GENERATOR MATCHES "Borland")
+
+# for nmake make long command lines are redirected to a file
+# with the following syntax, see Windows-bcc32.cmake for use
+IF(CMAKE_GENERATOR MATCHES "NMake")
+#  SET(CMAKE_START_TEMP_FILE "@<<\n")
+#  SET(CMAKE_END_TEMP_FILE "\n<<")
+ENDIF(CMAKE_GENERATOR MATCHES "NMake")
+
+INCLUDE(Platform/WindowsPaths)
+
+# uncomment these out to debug nmake and borland makefiles
+SET(CMAKE_START_TEMP_FILE "")
+SET(CMAKE_END_TEMP_FILE "")
+#SET(CMAKE_VERBOSE_MAKEFILE 1)
+
index 31b0609..d4d5a44 100644 (file)
@@ -1,43 +1,43 @@
-\r
-set(SARCH "" CACHE STRING\r
-"Sub-architecture to build for.")\r
-\r
-set(OARCH "athlon64" CACHE STRING\r
-"Generate instructions for this CPU type. Specify one of:\r
- k8 opteron athlon64 athlon-fx")\r
-\r
-set (OPTIMIZE "1" CACHE STRING\r
-"What level of optimisation to use.\r
-  0 = off\r
-  1 = Default option, optimize for size (-Os) with some additional options\r
-  2 = -Os\r
-  3 = -O1\r
-  4 = -O2\r
-  5 = -O3")\r
-\r
-set(DBG TRUE CACHE BOOL\r
-"Whether to compile for debugging.")\r
-\r
-set(KDBG FALSE CACHE BOOL\r
-"Whether to compile in the integrated kernel debugger.")\r
-\r
-set(GDB FALSE CACHE BOOL\r
-"Whether to compile for debugging with GDB.\r
-If you don't use GDB, don't    enable this.")\r
-\r
-set(_WINKD_ TRUE CACHE BOOL\r
-"Whether to compile with the KD protocol.")\r
-\r
-set(_ELF_ FALSE CACHE BOOL\r
-"Whether to compile support for ELF files.\r
-Do not enable unless you know what you're doing.")\r
-\r
-set(NSWPAT FALSE CACHE BOOL\r
-"Whether to compile apps/libs with features covered software patents or not.\r
-If you live in a country where software patents are valid/apply, don't\r
-enable this (except they/you purchased a license from the patent owner).\r
-This settings is disabled (0) by default.")\r
-\r
-set(USERMODE TRUE CACHE BOOL\r
-"Whether to compile any usermode parts. This is while kernel mode is under\r
- heavy development and usermode part not relevant for bootcd.")\r
+
+set(SARCH "" CACHE STRING
+"Sub-architecture to build for.")
+
+set(OARCH "athlon64" CACHE STRING
+"Generate instructions for this CPU type. Specify one of:
+ k8 opteron athlon64 athlon-fx")
+
+set (OPTIMIZE "1" CACHE STRING
+"What level of optimisation to use.
+  0 = off
+  1 = Default option, optimize for size (-Os) with some additional options
+  2 = -Os
+  3 = -O1
+  4 = -O2
+  5 = -O3")
+
+set(DBG TRUE CACHE BOOL
+"Whether to compile for debugging.")
+
+set(KDBG FALSE CACHE BOOL
+"Whether to compile in the integrated kernel debugger.")
+
+set(GDB FALSE CACHE BOOL
+"Whether to compile for debugging with GDB.
+If you don't use GDB, don't    enable this.")
+
+set(_WINKD_ TRUE CACHE BOOL
+"Whether to compile with the KD protocol.")
+
+set(_ELF_ FALSE CACHE BOOL
+"Whether to compile support for ELF files.
+Do not enable unless you know what you're doing.")
+
+set(NSWPAT FALSE CACHE BOOL
+"Whether to compile apps/libs with features covered software patents or not.
+If you live in a country where software patents are valid/apply, don't
+enable this (except they/you purchased a license from the patent owner).
+This settings is disabled (0) by default.")
+
+set(USERMODE TRUE CACHE BOOL
+"Whether to compile any usermode parts. This is while kernel mode is under
+ heavy development and usermode part not relevant for bootcd.")
index 02ae149..79f4ae5 100644 (file)
@@ -1,46 +1,46 @@
-\r
-set(SARCH "omap3-zoom2" CACHE STRING\r
-"Sub-architecture (board) to build for. Specify one of:\r
- kurobox versatile omap3-zoom2 omap3-beagle")\r
-\r
-set(OARCH "armv7-a" CACHE STRING\r
-"Generate instructions for this CPU type. Specify one of:\r
- armv5te armv7-a")\r
-\r
-set (OPTIMIZE "1" CACHE STRING\r
-"What level of optimisation to use.\r
-  0 = off\r
-  1 = Default option, optimize for size (-Os) with some additional options\r
-  2 = -Os\r
-  3 = -O1\r
-  4 = -O2\r
-  5 = -O3")\r
-\r
-set(DBG TRUE CACHE BOOL\r
-"Whether to compile for debugging.")\r
-\r
-set(KDBG FALSE CACHE BOOL\r
-"Whether to compile in the integrated kernel debugger.")\r
-\r
-set(GDB FALSE CACHE BOOL\r
-"Whether to compile for debugging with GDB.\r
-If you don't use GDB, don't    enable this.")\r
-\r
-set(_WINKD_ TRUE CACHE BOOL\r
-"Whether to compile with the KD protocol.")\r
-\r
-set(_ELF_ FALSE CACHE BOOL\r
-"Whether to compile support for ELF files.\r
-Do not enable unless you know what you're doing.")\r
-\r
-set(NSWPAT FALSE CACHE BOOL\r
-"Whether to compile apps/libs with features covered software patents or not.\r
-If you live in a country where software patents are valid/apply, don't\r
-enable this (except they/you purchased a license from the patent owner).\r
-This settings is disabled (0) by default.")\r
-\r
-set(BUILD_MP TRUE CACHE BOOL\r
-"Whether to compile the multi processor versions for ntoskrnl and hal.")\r
-\r
-set(NEWSPRINTF FALSE CACHE BOOL\r
-"Whether to compile the new sprintf.")\r
+
+set(SARCH "omap3-zoom2" CACHE STRING
+"Sub-architecture (board) to build for. Specify one of:
+ kurobox versatile omap3-zoom2 omap3-beagle")
+
+set(OARCH "armv7-a" CACHE STRING
+"Generate instructions for this CPU type. Specify one of:
+ armv5te armv7-a")
+
+set (OPTIMIZE "1" CACHE STRING
+"What level of optimisation to use.
+  0 = off
+  1 = Default option, optimize for size (-Os) with some additional options
+  2 = -Os
+  3 = -O1
+  4 = -O2
+  5 = -O3")
+
+set(DBG TRUE CACHE BOOL
+"Whether to compile for debugging.")
+
+set(KDBG FALSE CACHE BOOL
+"Whether to compile in the integrated kernel debugger.")
+
+set(GDB FALSE CACHE BOOL
+"Whether to compile for debugging with GDB.
+If you don't use GDB, don't    enable this.")
+
+set(_WINKD_ TRUE CACHE BOOL
+"Whether to compile with the KD protocol.")
+
+set(_ELF_ FALSE CACHE BOOL
+"Whether to compile support for ELF files.
+Do not enable unless you know what you're doing.")
+
+set(NSWPAT FALSE CACHE BOOL
+"Whether to compile apps/libs with features covered software patents or not.
+If you live in a country where software patents are valid/apply, don't
+enable this (except they/you purchased a license from the patent owner).
+This settings is disabled (0) by default.")
+
+set(BUILD_MP TRUE CACHE BOOL
+"Whether to compile the multi processor versions for ntoskrnl and hal.")
+
+set(NEWSPRINTF FALSE CACHE BOOL
+"Whether to compile the new sprintf.")
index dbcc85a..aabef67 100644 (file)
@@ -1,57 +1,57 @@
-\r
-set(SARCH "pc" CACHE STRING\r
-"Sub-architecture to build for. Specify one of: xbox")\r
-\r
-set(OARCH "pentium" CACHE STRING\r
-"Generate instructions for this CPU type. Specify one of:\r
- native, i386, i486, pentium, pentium-mmx, pentiumpro, i686,\r
- pentium2, pentium3, pentium-m, pentium4, prescott, nocona,\r
- core2, k6, k6-2, athlon, athlon-xp, opteron, opteron-sse3,\r
- barcelona, winchip-c6, winchip2, c3, c3-2, geode")\r
-\r
-set(TUNE "i686" CACHE STRING\r
-"Which CPU ReactOS should be optimized for.")\r
-\r
-set(OPTIMIZE "1" CACHE STRING\r
-"What level of optimisation to use.\r
-  0 = off\r
-  1 = Default option, optimize for size (-Os) with some additional options\r
-  2 = -Os\r
-  3 = -O1\r
-  4 = -O2\r
-  5 = -O3")\r
-\r
-set(GDB FALSE CACHE BOOL\r
-"Whether to compile for debugging with GDB.\r
-If you don't use GDB, don't    enable this.")\r
-\r
-set(DBG TRUE CACHE BOOL\r
-"Whether to compile for debugging.")\r
-\r
-if(MSVC)\r
-    set(KDBG FALSE CACHE BOOL\r
-"Whether to compile in the integrated kernel debugger.")\r
-    set(_WINKD_ TRUE CACHE BOOL\r
-"Whether to compile with the KD protocol.")\r
-else()\r
-    set(KDBG TRUE CACHE BOOL\r
-"Whether to compile in the integrated kernel debugger.")\r
-    set(_WINKD_ FALSE CACHE BOOL\r
-"Whether to compile with the KD protocol.")\r
-endif()\r
-\r
-set(_ELF_ FALSE CACHE BOOL\r
-"Whether to compile support for ELF files.\r
-Do not enable unless you know what you're doing.")\r
-\r
-set(NSWPAT FALSE CACHE BOOL\r
-"Whether to compile apps/libs with features covered software patents or not.\r
-If you live in a country where software patents are valid/apply, don't\r
-enable this (except they/you purchased a license from the patent owner).\r
-This settings is disabled (0) by default.")\r
-\r
-set(BUILD_MP TRUE CACHE BOOL\r
-"Whether to compile the multi processor versions for ntoskrnl and hal.")\r
-\r
-set(GENERATE_DEPENDENCY_GRAPH FALSE CACHE BOOL\r
-"Whether to create a graphml dependency of dlls.")\r
+
+set(SARCH "pc" CACHE STRING
+"Sub-architecture to build for. Specify one of: xbox")
+
+set(OARCH "pentium" CACHE STRING
+"Generate instructions for this CPU type. Specify one of:
+ native, i386, i486, pentium, pentium-mmx, pentiumpro, i686,
+ pentium2, pentium3, pentium-m, pentium4, prescott, nocona,
+ core2, k6, k6-2, athlon, athlon-xp, opteron, opteron-sse3,
+ barcelona, winchip-c6, winchip2, c3, c3-2, geode")
+
+set(TUNE "i686" CACHE STRING
+"Which CPU ReactOS should be optimized for.")
+
+set(OPTIMIZE "1" CACHE STRING
+"What level of optimisation to use.
+  0 = off
+  1 = Default option, optimize for size (-Os) with some additional options
+  2 = -Os
+  3 = -O1
+  4 = -O2
+  5 = -O3")
+
+set(GDB FALSE CACHE BOOL
+"Whether to compile for debugging with GDB.
+If you don't use GDB, don't    enable this.")
+
+set(DBG TRUE CACHE BOOL
+"Whether to compile for debugging.")
+
+if(MSVC)
+    set(KDBG FALSE CACHE BOOL
+"Whether to compile in the integrated kernel debugger.")
+    set(_WINKD_ TRUE CACHE BOOL
+"Whether to compile with the KD protocol.")
+else()
+    set(KDBG TRUE CACHE BOOL
+"Whether to compile in the integrated kernel debugger.")
+    set(_WINKD_ FALSE CACHE BOOL
+"Whether to compile with the KD protocol.")
+endif()
+
+set(_ELF_ FALSE CACHE BOOL
+"Whether to compile support for ELF files.
+Do not enable unless you know what you're doing.")
+
+set(NSWPAT FALSE CACHE BOOL
+"Whether to compile apps/libs with features covered software patents or not.
+If you live in a country where software patents are valid/apply, don't
+enable this (except they/you purchased a license from the patent owner).
+This settings is disabled (0) by default.")
+
+set(BUILD_MP TRUE CACHE BOOL
+"Whether to compile the multi processor versions for ntoskrnl and hal.")
+
+set(GENERATE_DEPENDENCY_GRAPH FALSE CACHE BOOL
+"Whether to create a graphml dependency of dlls.")
index 8ad71a5..965e847 100644 (file)
@@ -11,8 +11,6 @@
 /* FIXME guid mess */
 #ifndef _MSC_VER
 const GUID IID_IUnknown           = {0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
-#else
-const GUID IID_IKsDataTypeHandler = {0x5FFBAA02L, 0x49A3, 0x11D0, {0x9F, 0x36, 0x00, 0xAA, 0x00, 0xA2, 0x16, 0xA1}};
 #endif
 const GUID IID_IClassFactory      = {0x00000001, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
 
index d6b5b5a..e56eacb 100644 (file)
 
 const GUID IID_IKsPinPipe = {0xe539cd90, 0xa8b4, 0x11d1, {0x81, 0x89, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02}};
 const GUID IID_IKsPinEx   = {0x7bb38260L, 0xd19c, 0x11d2, {0xb3, 0x8a, 0x00, 0xa0, 0xc9, 0x5e, 0xc2, 0x2e}};
-#ifdef _MSC_VER
-const GUID IID_IKsPin =     {0xb61178d1L, 0xa2d9, 0x11cf, {0x9e, 0x53, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
-const GUID IID_IKsInterfaceHandler = {0xD3ABC7E0L, 0x9A61, 0x11D0, {0xA4, 0x0D, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
-#endif
+
+
 #ifndef _MSC_VER
 
 const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
index 67196fb..7eb0fd2 100644 (file)
@@ -10,8 +10,6 @@
 
 const GUID IID_IKsObject           = {0x423c13a2, 0x2070, 0x11d0, {0x9e, 0xf7, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
 
-extern const GUID IID_IKsInterfaceHandler;
-
 class CKsInterfaceHandler : public IKsInterfaceHandler
 {
 public:
index 545af53..7baa7e3 100644 (file)
@@ -16,13 +16,12 @@ const GUID CLSID_KsQualityForwarder            = {0xe05592e4, 0xc0b5, 0x11d0, {0
 
 
 #ifndef _MSC_VER
+const GUID CLSID_KsIBasicAudioInterfaceHandler = {0xb9f8ac3e, 0x0f71, 0x11d2, {0xb7, 0x2c, 0x00, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d}};
 const GUID KSPROPSETID_Pin                     = {0x8C134960, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
 const GUID KSINTERFACESETID_Standard           = {STATIC_KSINTERFACESETID_Standard};
 const GUID CLSID_Proxy                         = {0x17CCA71B, 0xECD7, 0x11D0, {0xB9, 0x08, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
 #endif
 
-const GUID CLSID_KsIBasicAudioInterfaceHandler = {0xb9f8ac3e, 0x0f71, 0x11d2, {0xb7, 0x2c, 0x00, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d}};
-
 static INTERFACE_TABLE InterfaceTable[] =
 {
     {&MEDIATYPE_Audio, CKsDataTypeHandler_Constructor},
index c096ab4..2bf85c8 100644 (file)
@@ -8,9 +8,6 @@
  */
 #include "precomp.h"
 
-extern const GUID IID_IKsPin;
-extern const GUID IID_IKsInterfaceHandler;
-
 class COutputPin : public IPin,
                    public IKsObject,
                    public IKsPropertySet,
@@ -1684,7 +1681,7 @@ COutputPin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
         if (GetSupportedSets(&pGuid, &NumGuids))
         {
             // load all proxy plugins
-            if (FAILED(LoadProxyPlugins(pGuid, NumGuids)))
+            if (FAILED(LoadProxyPlugins(pGuid, NumGuids)));
             {
 #ifdef KSPROXY_TRACE
                 OutputDebugStringW(L"COutputPin::Connect LoadProxyPlugins failed\n");
index 6f86ff0..3a7e007 100644 (file)
@@ -26,7 +26,7 @@
 @ stdcall D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) d3dx9_36.D3DXConcatenateMeshes
 @ stdcall D3DXConvertMeshSubsetToSingleStrip(ptr long long ptr ptr) d3dx9_36.D3DXConvertMeshSubsetToSingleStrip
 @ stdcall D3DXConvertMeshSubsetToStrips(ptr long long ptr ptr ptr ptr) d3dx9_36.D3DXConvertMeshSubsetToStrips
-@ stdcall -stub D3DXCpuOptimizations(long)
+@ stub D3DXCpuOptimizations
 @ stdcall D3DXCreateAnimationController(long long long long ptr) d3dx9_36.D3DXCreateAnimationController
 @ stdcall D3DXCreateBox(ptr long long long ptr ptr) d3dx9_36.D3DXCreateBox
 @ stdcall D3DXCreateBuffer(long ptr) d3dx9_36.D3DXCreateBuffer
 @ stdcall D3DXGetShaderSamplers(ptr ptr ptr) d3dx9_36.D3DXGetShaderSamplers
 @ stdcall D3DXGetShaderSize(ptr) d3dx9_36.D3DXGetShaderSize
 @ stdcall D3DXGetShaderVersion(ptr) d3dx9_36.D3DXGetShaderVersion
-@ stdcall -stub D3DXGetTargetDescByName(long long long)
-@ stdcall -stub D3DXGetTargetDescByVersion(long long long)
+@ stub D3DXGetTargetDescByName
+@ stub D3DXGetTargetDescByVersion
 @ stdcall D3DXGetVertexShaderProfile(ptr) d3dx9_36.D3DXGetVertexShaderProfile
 @ stdcall D3DXIntersect(ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) d3dx9_36.D3DXIntersect
 @ stdcall D3DXIntersectSubset(ptr long ptr ptr ptr ptr ptr ptr ptr ptr ptr) d3dx9_36.D3DXIntersectSubset
 @ stdcall D3DXLoadSurfaceFromMemory(ptr ptr ptr ptr long long ptr ptr long long) d3dx9_36.D3DXLoadSurfaceFromMemory
 @ stdcall D3DXLoadSurfaceFromResourceA(ptr ptr ptr long ptr ptr long long ptr) d3dx9_36.D3DXLoadSurfaceFromResourceA
 @ stdcall D3DXLoadSurfaceFromResourceW(ptr ptr ptr long ptr ptr long long ptr) d3dx9_36.D3DXLoadSurfaceFromResourceW
-@ stdcall D3DXLoadSurfaceFromSurface(ptr ptr ptr ptr ptr ptr long long) d3dx9_36.D3DXLoadSurfaceFromSurface
+@ stdcall D3DXLoadSurfaceFromSurface(ptr ptr ptr ptr ptr ptr long) d3dx9_36.D3DXLoadSurfaceFromSurface
 @ stdcall D3DXLoadVolumeFromFileA(ptr ptr ptr ptr ptr long long ptr) d3dx9_36.D3DXLoadVolumeFromFileA
 @ stdcall D3DXLoadVolumeFromFileInMemory(ptr ptr ptr ptr long ptr long long ptr) d3dx9_36.D3DXLoadVolumeFromFileInMemory
 @ stdcall D3DXLoadVolumeFromFileW(ptr ptr ptr ptr ptr long long ptr) d3dx9_36.D3DXLoadVolumeFromFileW
index 94b29bc..7924081 100644 (file)
 @ stdcall D3DXAssembleShaderFromResourceA(long str ptr ptr long ptr ptr)
 @ stdcall D3DXAssembleShaderFromResourceW(long wstr ptr ptr long ptr ptr)
 @ stdcall D3DXBoxBoundProbe(ptr ptr ptr ptr)
-@ stdcall -stub D3DXCheckCubeTextureRequirements(ptr ptr ptr long ptr long)
-@ stdcall -stub D3DXCheckTextureRequirements(ptr ptr ptr ptr long ptr long)
+@ stub D3DXCheckCubeTextureRequirements
+@ stub D3DXCheckTextureRequirements
 @ stdcall D3DXCheckVersion(long long)
-@ stdcall -stub D3DXCheckVolumeTextureRequirements(ptr ptr ptr ptr ptr long ptr long)
-@ stdcall -stub D3DXCleanMesh(ptr ptr ptr ptr ptr)
+@ stub D3DXCheckVolumeTextureRequirements
+@ stub D3DXCleanMesh
 @ stdcall D3DXColorAdjustContrast(ptr ptr long)
 @ stdcall D3DXColorAdjustSaturation(ptr ptr long)
 @ stdcall D3DXCompileShader(ptr long ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCompileShaderFromFileA(ptr ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCompileShaderFromFileW(ptr ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCompileShaderFromResourceA(long ptr ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCompileShaderFromResourceW(long ptr ptr ptr ptr ptr long ptr ptr ptr)
+@ stub D3DXCompileShaderFromFileA
+@ stub D3DXCompileShaderFromFileW
+@ stub D3DXCompileShaderFromResourceA
+@ stub D3DXCompileShaderFromResourceW
 @ stdcall D3DXComputeBoundingBox(ptr long long ptr ptr)
 @ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
 @ stub D3DXComputeIMTFromPerTexelSignal
 @ stub D3DXComputeIMTFromPerVertexSignal
 @ stub D3DXComputeIMTFromSignal
 @ stub D3DXComputeIMTFromTexture
-@ stdcall -stub D3DXComputeNormalMap(ptr ptr ptr long long long)
-@ stdcall -stub D3DXComputeNormals(ptr ptr)
-@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
-@ stdcall -stub D3DXComputeTangentFrame(ptr long)
-@ stdcall -stub D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr long long long ptr ptr)
-@ stdcall -stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXConvertMeshSubsetToSingleStrip(ptr long long ptr ptr)
-@ stdcall -stub D3DXConvertMeshSubsetToStrips(ptr long long ptr ptr ptr ptr)
-@ stdcall -stub D3DXCreateAnimationController(long long long long ptr)
-@ stdcall -stub D3DXCreateBox(ptr long long long ptr ptr)
+@ stub D3DXComputeNormalMap
+@ stub D3DXComputeNormals
+@ stub D3DXComputeTangent
+@ stub D3DXComputeTangentFrame
+@ stub D3DXComputeTangentFrameEx
+@ stub D3DXConcatenateMeshes
+@ stub D3DXConvertMeshSubsetToSingleStrip
+@ stub D3DXConvertMeshSubsetToStrips
+@ stub D3DXCreateAnimationController
+@ stub D3DXCreateBox
 @ stdcall D3DXCreateBuffer(long ptr)
-@ stdcall -stub D3DXCreateCompressedAnimationSet(ptr long long ptr long ptr ptr)
-@ stdcall -stub D3DXCreateCubeTexture(ptr long long long long long ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromFileA(ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromFileExA(ptr ptr long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromFileExW(ptr ptr long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromFileInMemory(ptr ptr long ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromFileInMemoryEx(ptr ptr long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromFileW(ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromResourceA(ptr long ptr ptr) d3dx9_36.D3DXCreateCubeTextureFromResourceA
-@ stdcall -stub D3DXCreateCubeTextureFromResourceExA(ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromResourceExW(ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateCubeTextureFromResourceW(ptr long ptr ptr)
-@ stdcall -stub D3DXCreateCylinder(ptr long long long long long ptr ptr)
-@ stdcall -stub D3DXCreateEffect(ptr ptr long ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectCompiler(ptr long ptr ptr long ptr ptr)
-@ stdcall -stub D3DXCreateEffectCompilerFromFileA(ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXCreateEffectCompilerFromFileW(ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXCreateEffectCompilerFromResourceA(long ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXCreateEffectCompilerFromResourceW(long ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXCreateEffectEx(ptr ptr long ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromFileA(ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromFileExA(ptr ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromFileExW(ptr ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromFileW(ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromResourceA(ptr long ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromResourceExA(ptr long ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromResourceExW(ptr long ptr ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectFromResourceW(ptr long ptr ptr ptr long ptr ptr ptr)
-@ stdcall -stub D3DXCreateEffectPool(ptr)
+@ stub D3DXCreateCompressedAnimationSet
+@ stub D3DXCreateCubeTexture
+@ stub D3DXCreateCubeTextureFromFileA
+@ stub D3DXCreateCubeTextureFromFileExA
+@ stub D3DXCreateCubeTextureFromFileExW
+@ stub D3DXCreateCubeTextureFromFileInMemory
+@ stub D3DXCreateCubeTextureFromFileInMemoryEx
+@ stub D3DXCreateCubeTextureFromFileW
+@ stub D3DXCreateCubeTextureFromResourceA
+@ stub D3DXCreateCubeTextureFromResourceExA
+@ stub D3DXCreateCubeTextureFromResourceExW
+@ stub D3DXCreateCubeTextureFromResourceW
+@ stub D3DXCreateCylinder
+@ stub D3DXCreateEffect
+@ stub D3DXCreateEffectCompiler
+@ stub D3DXCreateEffectCompilerFromFileA
+@ stub D3DXCreateEffectCompilerFromFileW
+@ stub D3DXCreateEffectCompilerFromResourceA
+@ stub D3DXCreateEffectCompilerFromResourceW
+@ stub D3DXCreateEffectEx
+@ stub D3DXCreateEffectFromFileA
+@ stub D3DXCreateEffectFromFileExA
+@ stub D3DXCreateEffectFromFileExW
+@ stub D3DXCreateEffectFromFileW
+@ stub D3DXCreateEffectFromResourceA
+@ stub D3DXCreateEffectFromResourceExA
+@ stub D3DXCreateEffectFromResourceExW
+@ stub D3DXCreateEffectFromResourceW
+@ stub D3DXCreateEffectPool
 @ stdcall D3DXCreateFontA(ptr long long long long long long long long long str ptr)
 @ stdcall D3DXCreateFontIndirectA(ptr ptr ptr)
 @ stdcall D3DXCreateFontIndirectW(ptr ptr ptr)
 @ stdcall D3DXCreateFontW(ptr long long long long long long long long long wstr ptr)
-@ stdcall -stub D3DXCreateFragmentLinker(ptr long ptr)
+@ stub D3DXCreateFragmentLinker
 @ stub D3DXCreateFragmentLinkerEx
-@ stdcall -stub D3DXCreateKeyframedAnimationSet(ptr long long long long ptr ptr)
-@ stdcall -stub D3DXCreateLine(ptr ptr)
+@ stub D3DXCreateKeyframedAnimationSet
+@ stub D3DXCreateLine
 @ stdcall D3DXCreateMatrixStack(long ptr)
-@ stdcall -stub D3DXCreateMesh(long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateMeshFVF(long long long long ptr ptr)
-@ stdcall -stub D3DXCreateNPatchMesh(ptr ptr)
-@ stdcall -stub D3DXCreatePMeshFromStream(ptr long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXCreatePatchMesh(ptr long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreatePolygon(ptr long long ptr ptr)
-@ stdcall -stub D3DXCreatePRTBuffer(long long long ptr)
-@ stdcall -stub D3DXCreatePRTBufferTex(long long long long ptr)
-@ stdcall -stub D3DXCreatePRTCompBuffer(long long long ptr ptr ptr ptr)
-@ stdcall -stub D3DXCreatePRTEngine(ptr ptr long ptr ptr)
-@ stdcall -stub D3DXCreateRenderToEnvMap(ptr long long long long long ptr)
-@ stdcall -stub D3DXCreateRenderToSurface(ptr long long long long long ptr)
-@ stdcall -stub D3DXCreateSPMesh(ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXCreateSkinInfo(long ptr long ptr)
-@ stdcall -stub D3DXCreateSkinInfoFromBlendedMesh(ptr long ptr ptr)
-@ stdcall -stub D3DXCreateSkinInfoFVF(long long long ptr)
-@ stdcall -stub D3DXCreateSphere(ptr long long long ptr ptr)
+@ stub D3DXCreateMesh
+@ stub D3DXCreateMeshFVF
+@ stub D3DXCreateNPatchMesh
+@ stub D3DXCreatePMeshFromStream
+@ stub D3DXCreatePatchMesh
+@ stub D3DXCreatePolygon
+@ stub D3DXCreatePRTBuffer
+@ stub D3DXCreatePRTBufferTex
+@ stub D3DXCreatePRTCompBuffer
+@ stub D3DXCreatePRTEngine
+@ stub D3DXCreateRenderToEnvMap
+@ stub D3DXCreateRenderToSurface
+@ stub D3DXCreateSPMesh
+@ stub D3DXCreateSkinInfo
+@ stub D3DXCreateSkinInfoFromBlendedMesh
+@ stub D3DXCreateSkinInfoFVF
+@ stub D3DXCreateSphere
 @ stdcall D3DXCreateSprite(ptr ptr)
-@ stdcall -stub D3DXCreateTeapot(ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextA(ptr long ptr long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextW(ptr long ptr long long ptr ptr ptr)
+@ stub D3DXCreateTeapot
+@ stub D3DXCreateTextA
+@ stub D3DXCreateTextW
 @ stdcall D3DXCreateTexture(ptr long long long long long long ptr)
-@ stdcall -stub D3DXCreateTextureFromFileA(ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromFileExA(ptr ptr long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromFileExW(ptr ptr long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromFileInMemory(ptr ptr long ptr)
-@ stdcall -stub D3DXCreateTextureFromFileInMemoryEx(ptr ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromFileW(ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromResourceA(ptr long ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromResourceExA(ptr long ptr long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromResourceExW(ptr long ptr long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateTextureFromResourceW(ptr long ptr ptr)
-@ stdcall -stub D3DXCreateTextureGutterHelper(long long ptr long ptr)
-@ stdcall -stub D3DXCreateTextureShader(ptr ptr)
-@ stdcall -stub D3DXCreateTorus(ptr long long long long ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTexture(ptr long long long long long long long ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromFileA(ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromFileExA(ptr ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromFileExW(ptr ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromFileInMemory(ptr ptr long ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromFileInMemoryEx(ptr ptr long long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromFileW(ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromResourceA(ptr long ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromResourceExA(ptr long ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromResourceExW(ptr long ptr long long long long long long long long long long ptr ptr ptr)
-@ stdcall -stub D3DXCreateVolumeTextureFromResourceW(ptr long ptr ptr)
+@ stub D3DXCreateTextureFromFileA
+@ stub D3DXCreateTextureFromFileExA
+@ stub D3DXCreateTextureFromFileExW
+@ stub D3DXCreateTextureFromFileInMemory
+@ stub D3DXCreateTextureFromFileInMemoryEx
+@ stub D3DXCreateTextureFromFileW
+@ stub D3DXCreateTextureFromResourceA
+@ stub D3DXCreateTextureFromResourceExA
+@ stub D3DXCreateTextureFromResourceExW
+@ stub D3DXCreateTextureFromResourceW
+@ stub D3DXCreateTextureGutterHelper
+@ stub D3DXCreateTextureShader
+@ stub D3DXCreateTorus
+@ stub D3DXCreateVolumeTexture
+@ stub D3DXCreateVolumeTextureFromFileA
+@ stub D3DXCreateVolumeTextureFromFileExA
+@ stub D3DXCreateVolumeTextureFromFileExW
+@ stub D3DXCreateVolumeTextureFromFileInMemory
+@ stub D3DXCreateVolumeTextureFromFileInMemoryEx
+@ stub D3DXCreateVolumeTextureFromFileW
+@ stub D3DXCreateVolumeTextureFromResourceA
+@ stub D3DXCreateVolumeTextureFromResourceExA
+@ stub D3DXCreateVolumeTextureFromResourceExW
+@ stub D3DXCreateVolumeTextureFromResourceW
 @ stdcall D3DXDebugMute(long)
-@ stdcall -stub D3DXDeclaratorFromFVF(long ptr)
-@ stdcall -stub D3DXDisassembleEffect(ptr long ptr)
-@ stdcall -stub D3DXDisassembleShader(ptr long ptr ptr)
-@ stdcall -stub D3DXFileCreate(ptr)
-@ stdcall -stub D3DXFillCubeTexture(ptr ptr ptr)
-@ stdcall -stub D3DXFillCubeTextureTX(ptr ptr)TX
-@ stdcall -stub D3DXFillTexture(ptr ptr ptr)
-@ stdcall -stub D3DXFillTextureTX(ptr ptr)
-@ stdcall -stub D3DXFillVolumeTexture(ptr ptr ptr)
-@ stdcall -stub D3DXFillVolumeTextureTX(ptr ptr)
-@ stdcall -stub D3DXFilterTexture(ptr ptr long long)
+@ stub D3DXDeclaratorFromFVF
+@ stub D3DXDisassembleEffect
+@ stub D3DXDisassembleShader
+@ stub D3DXFileCreate
+@ stub D3DXFillCubeTexture
+@ stub D3DXFillCubeTextureTX
+@ stub D3DXFillTexture
+@ stub D3DXFillTextureTX
+@ stub D3DXFillVolumeTexture
+@ stub D3DXFillVolumeTextureTX
+@ stub D3DXFilterTexture
 @ stdcall D3DXFindShaderComment(ptr long ptr ptr)
-@ stdcall -stub D3DXFloat16To32Array(ptr ptr long)
-@ stdcall -stub D3DXFloat32To16Array(ptr ptr long)
-@ stdcall -stub D3DXFrameAppendChild(ptr ptr)
-@ stdcall -stub D3DXFrameCalculateBoundingSphere(ptr ptr ptr)
-@ stdcall -stub D3DXFrameDestroy(ptr ptr)
-@ stdcall -stub D3DXFrameFind(ptr ptr)
-@ stdcall -stub D3DXFrameNumNamedMatrices(ptr)
-@ stdcall -stub D3DXFrameRegisterNamedMatrices(ptr ptr)
+@ stub D3DXFloat16To32Array
+@ stub D3DXFloat32To16Array
+@ stub D3DXFrameAppendChild
+@ stub D3DXFrameCalculateBoundingSphere
+@ stub D3DXFrameDestroy
+@ stub D3DXFrameFind
+@ stub D3DXFrameNumNamedMatrices
+@ stub D3DXFrameRegisterNamedMatrices
 @ stdcall D3DXFresnelTerm(long long)
-@ stdcall -stub D3DXFVFFromDeclarator(ptr ptr)
-@ stdcall -stub D3DXGatherFragments(ptr long ptr ptr long ptr ptr)
-@ stdcall -stub D3DXGatherFragmentsFromFileA(ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXGatherFragmentsFromFileW(ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXGatherFragmentsFromResourceA(long ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXGatherFragmentsFromResourceW(long ptr ptr ptr long ptr ptr)
-@ stdcall -stub D3DXGenerateOutputDecl(ptr ptr)
-@ stdcall -stub D3DXGeneratePMesh(ptr ptr ptr ptr long long ptr)
-@ stdcall -stub D3DXGetDeclLength(ptr)
+@ stub D3DXFVFFromDeclarator
+@ stub D3DXGatherFragments
+@ stub D3DXGatherFragmentsFromFileA
+@ stub D3DXGatherFragmentsFromFileW
+@ stub D3DXGatherFragmentsFromResourceA
+@ stub D3DXGatherFragmentsFromResourceW
+@ stub D3DXGenerateOutputDecl
+@ stub D3DXGeneratePMesh
+@ stub D3DXGetDeclLength
 @ stdcall D3DXGetDeclVertexSize(ptr long)
 @ stdcall D3DXGetDriverLevel(ptr)
 @ stdcall D3DXGetFVFVertexSize(long)
 @ stdcall D3DXGetPixelShaderProfile(ptr)
 @ stdcall D3DXGetShaderConstantTable(ptr ptr)
 @ stdcall D3DXGetShaderConstantTableEx(ptr long ptr)
-@ stdcall -stub D3DXGetShaderInputSemantics(ptr ptr ptr)
-@ stdcall -stub D3DXGetShaderOutputSemantics(ptr ptr ptr)
-@ stdcall -stub D3DXGetShaderSamplers(ptr ptr ptr)
+@ stub D3DXGetShaderInputSemantics
+@ stub D3DXGetShaderOutputSemantics
+@ stub D3DXGetShaderSamplers
 @ stdcall D3DXGetShaderSize(ptr)
 @ stdcall D3DXGetShaderVersion(ptr)
 @ stdcall D3DXGetVertexShaderProfile(ptr)
-@ stdcall -stub D3DXIntersect(ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXIntersectSubset(ptr long ptr ptr ptr ptr ptr ptr ptr ptr ptr)
+@ stub D3DXIntersect
+@ stub D3DXIntersectSubset
 @ stdcall D3DXIntersectTri(ptr ptr ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshFromXA(ptr long ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshFromXInMemory(ptr long long ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshFromXResource(long ptr ptr long ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshFromXW(ptr long ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshFromXof(ptr long ptr ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshHierarchyFromXA(ptr long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshHierarchyFromXInMemory(ptr long long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadMeshHierarchyFromXW(ptr long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXLoadPatchMeshFromXof(ptr long ptr ptr ptr long ptr)
-@ stdcall -stub D3DXLoadPRTBufferFromFileA(ptr ptr)
-@ stdcall -stub D3DXLoadPRTBufferFromFileW(ptr ptr)
-@ stdcall -stub D3DXLoadPRTCompBufferFromFileA(ptr ptr)
-@ stdcall -stub D3DXLoadPRTCompBufferFromFileW(ptr ptr)
-@ stdcall -stub D3DXLoadSkinMeshFromXof(ptr long ptr ptr ptr ptr ptr ptr ptr)
+@ stub D3DXLoadMeshFromXA
+@ stub D3DXLoadMeshFromXInMemory
+@ stub D3DXLoadMeshFromXResource
+@ stub D3DXLoadMeshFromXW
+@ stub D3DXLoadMeshFromXof
+@ stub D3DXLoadMeshHierarchyFromXA
+@ stub D3DXLoadMeshHierarchyFromXInMemory
+@ stub D3DXLoadMeshHierarchyFromXW
+@ stub D3DXLoadPatchMeshFromXof
+@ stub D3DXLoadPRTBufferFromFileA
+@ stub D3DXLoadPRTBufferFromFileW
+@ stub D3DXLoadPRTCompBufferFromFileA
+@ stub D3DXLoadPRTCompBufferFromFileW
+@ stub D3DXLoadSkinMeshFromXof
 @ stdcall D3DXLoadSurfaceFromFileA(ptr ptr ptr str ptr long long ptr)
 @ stdcall D3DXLoadSurfaceFromFileInMemory(ptr ptr ptr ptr long ptr long long ptr)
 @ stdcall D3DXLoadSurfaceFromFileW(ptr ptr ptr wstr ptr long long ptr)
 @ stdcall D3DXLoadSurfaceFromResourceA(ptr ptr ptr ptr str ptr long long ptr)
 @ stdcall D3DXLoadSurfaceFromResourceW(ptr ptr ptr ptr wstr ptr long long ptr)
 @ stdcall D3DXLoadSurfaceFromSurface(ptr ptr ptr ptr ptr ptr long long)
-@ stdcall -stub D3DXLoadVolumeFromFileA(ptr ptr ptr ptr ptr long long ptr)
-@ stdcall -stub D3DXLoadVolumeFromFileInMemory(ptr ptr ptr ptr long ptr long long ptr)
-@ stdcall -stub D3DXLoadVolumeFromFileW(ptr ptr ptr ptr ptr long long ptr)
-@ stdcall -stub D3DXLoadVolumeFromMemory(ptr ptr ptr ptr long long long ptr ptr long long)
-@ stdcall -stub D3DXLoadVolumeFromResourceA(ptr ptr ptr long ptr ptr long long ptr)
-@ stdcall -stub D3DXLoadVolumeFromResourceW(ptr ptr ptr long ptr ptr long long ptr)
-@ stdcall -stub D3DXLoadVolumeFromVolume(ptr ptr ptr ptr ptr ptr long long)
+@ stub D3DXLoadVolumeFromFileA
+@ stub D3DXLoadVolumeFromFileInMemory
+@ stub D3DXLoadVolumeFromFileW
+@ stub D3DXLoadVolumeFromMemory
+@ stub D3DXLoadVolumeFromResourceA
+@ stub D3DXLoadVolumeFromResourceW
+@ stub D3DXLoadVolumeFromVolume
 @ stdcall D3DXMatrixAffineTransformation(ptr long ptr ptr ptr)
 @ stdcall D3DXMatrixAffineTransformation2D(ptr long ptr long ptr)
 @ stdcall D3DXMatrixDecompose(ptr ptr ptr ptr)
 @ stdcall D3DXMatrixTransformation2D(ptr ptr long ptr ptr long ptr)
 @ stdcall D3DXMatrixTranslation(ptr long long long)
 @ stdcall D3DXMatrixTranspose(ptr ptr)
-@ stdcall -stub D3DXOptimizeFaces(ptr long long long ptr)
-@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
+@ stub D3DXOptimizeFaces
+@ stub D3DXOptimizeVertices
 @ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
 @ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
 @ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)
 @ stdcall D3DXQuaternionRotationYawPitchRoll(ptr long long long)
 @ stdcall D3DXQuaternionSlerp(ptr ptr ptr long)
 @ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr long)
-@ stdcall -stub D3DXQuaternionSquadSetup(ptr ptr ptr ptr ptr ptr ptr)
+@ stub D3DXQuaternionSquadSetup
 @ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr)
-@ stdcall -stub D3DXRectPatchSize(ptr ptr ptr)
-@ stdcall -stub D3DXSaveMeshHierarchyToFileA(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveMeshHierarchyToFileW(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveMeshToXA(ptr ptr ptr ptr ptr long long)
-@ stdcall -stub D3DXSaveMeshToXW(ptr ptr ptr ptr ptr long long)
-@ stdcall -stub D3DXSavePRTBufferToFileA(ptr ptr)
-@ stdcall -stub D3DXSavePRTBufferToFileW(ptr ptr)
-@ stdcall -stub D3DXSavePRTCompBufferToFileA(ptr ptr)
-@ stdcall -stub D3DXSavePRTCompBufferToFileW(ptr ptr)
-@ stdcall -stub D3DXSaveSurfaceToFileA(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveSurfaceToFileInMemory(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveSurfaceToFileW(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveTextureToFileA(ptr long ptr ptr)
-@ stdcall -stub D3DXSaveTextureToFileInMemory(ptr long ptr ptr)
-@ stdcall -stub D3DXSaveTextureToFileW(ptr long ptr ptr)
-@ stdcall -stub D3DXSaveVolumeToFileA(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveVolumeToFileInMemory(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSaveVolumeToFileW(ptr long ptr ptr ptr)
-@ stdcall -stub D3DXSHAdd(ptr long ptr ptr)
-@ stdcall -stub D3DXSHDot(long ptr ptr)
-@ stdcall -stub D3DXSHEvalConeLight(long ptr long long long long ptr ptr ptr)
-@ stdcall -stub D3DXSHEvalDirection(ptr long ptr)
-@ stdcall -stub D3DXSHEvalDirectionalLight(long ptr long long long long ptr ptr ptr)
-@ stdcall -stub D3DXSHEvalHemisphereLight(long ptr long long ptr ptr ptr)
-@ stdcall -stub D3DXSHEvalSphericalLight(long ptr long long long long ptr ptr ptr)
+@ stub D3DXRectPatchSize
+@ stub D3DXSaveMeshHierarchyToFileA
+@ stub D3DXSaveMeshHierarchyToFileW
+@ stub D3DXSaveMeshToXA
+@ stub D3DXSaveMeshToXW
+@ stub D3DXSavePRTBufferToFileA
+@ stub D3DXSavePRTBufferToFileW
+@ stub D3DXSavePRTCompBufferToFileA
+@ stub D3DXSavePRTCompBufferToFileW
+@ stub D3DXSaveSurfaceToFileA
+@ stub D3DXSaveSurfaceToFileInMemory
+@ stub D3DXSaveSurfaceToFileW
+@ stub D3DXSaveTextureToFileA
+@ stub D3DXSaveTextureToFileInMemory
+@ stub D3DXSaveTextureToFileW
+@ stub D3DXSaveVolumeToFileA
+@ stub D3DXSaveVolumeToFileInMemory
+@ stub D3DXSaveVolumeToFileW
+@ stub D3DXSHAdd
+@ stub D3DXSHDot
+@ stub D3DXSHEvalConeLight
+@ stub D3DXSHEvalDirection
+@ stub D3DXSHEvalDirectionalLight
+@ stub D3DXSHEvalHemisphereLight
+@ stub D3DXSHEvalSphericalLight
 @ stub D3DXSHMultiply2
 @ stub D3DXSHMultiply3
 @ stub D3DXSHMultiply4
 @ stub D3DXSHMultiply5
 @ stub D3DXSHMultiply6
-@ stdcall -stub D3DXSHProjectCubeMap(long ptr ptr ptr ptr)
-@ stdcall -stub D3DXSHPRTCompSplitMeshSC(ptr long long ptr long ptr long long ptr ptr long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXSHPRTCompSuperCluster(ptr ptr long long ptr ptr)
-@ stdcall -stub D3DXSHRotate(ptr long ptr ptr)
-@ stdcall -stub D3DXSHRotateZ(ptr long long ptr)
-@ stdcall -stub D3DXSHScale(ptr long ptr ptr)
-@ stdcall -stub D3DXSimplifyMesh(ptr ptr ptr ptr long long ptr)
+@ stub D3DXSHProjectCubeMap
+@ stub D3DXSHPRTCompSplitMeshSC
+@ stub D3DXSHPRTCompSuperCluster
+@ stub D3DXSHRotate
+@ stub D3DXSHRotateZ
+@ stub D3DXSHScale
+@ stub D3DXSimplifyMesh
 @ stdcall D3DXSphereBoundProbe(ptr long ptr ptr)
-@ stdcall -stub D3DXSplitMesh(ptr ptr long long ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXTessellateNPatches(ptr ptr long long ptr ptr)
-@ stdcall -stub D3DXTessellateRectPatch(ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXTessellateTriPatch(ptr ptr ptr ptr ptr)
-@ stdcall -stub D3DXTriPatchSize(ptr ptr ptr)
+@ stub D3DXSplitMesh
+@ stub D3DXTessellateNPatches
+@ stub D3DXTessellateRectPatch
+@ stub D3DXTessellateTriPatch
+@ stub D3DXTriPatchSize
 @ stub D3DXUVAtlasCreate
 @ stub D3DXUVAtlasPack
 @ stub D3DXUVAtlasPartition
-@ stdcall -stub D3DXValidMesh(ptr ptr ptr)
-@ stdcall -stub D3DXValidPatchMesh(ptr ptr ptr ptr)
+@ stub D3DXValidMesh
+@ stub D3DXValidPatchMesh
 @ stdcall D3DXVec2BaryCentric(ptr ptr ptr ptr long long)
 @ stdcall D3DXVec2CatmullRom(ptr ptr ptr ptr ptr long)
 @ stdcall D3DXVec2Hermite(ptr ptr ptr ptr ptr long)
 @ stdcall D3DXVec4Normalize(ptr ptr)
 @ stdcall D3DXVec4Transform(ptr ptr ptr)
 @ stdcall D3DXVec4TransformArray(ptr long ptr long ptr long)
-@ stdcall -stub D3DXWeldVertices(ptr long ptr ptr ptr ptr ptr)
+@ stub D3DXWeldVertices
index ffd5361..e9c7004 100644 (file)
 
 #include "d3dx9.h"
 
-#ifdef _MSC_VER
-DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
-#endif
-
 /***********************************************************************
  * DllMain.
  */
index 378e0f9..a43cc38 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/*
  * Direct3D state management
  *
  * Copyright 2002 Lionel Ulmer
index 8bb2e40..da065c4 100644 (file)
@@ -1996,9 +1996,11 @@ NTAPI
 LdrpInitFailure(NTSTATUS Status)
 {
     ULONG Response;
+    PPEB Peb = NtCurrentPeb();
 
     /* Print a debug message */
-    DPRINT1("LDR: Process initialization failure; NTSTATUS = %08lx\n", Status);
+    DPRINT1("LDR: Process initialization failure for %wZ; NTSTATUS = %08lx\n",
+            &Peb->ProcessParameters->ImagePathName, Status);
 
     /* Raise a hard error */
     if (!LdrpFatalHardErrorCount)
index 61677f0..cc4c073 100644 (file)
@@ -29,7 +29,6 @@ BOOLEAN BaseRunningInServerProcess;
 WCHAR BaseDefaultPathBuffer[6140];
 
 HANDLE BaseNamedObjectDirectory;
-HANDLE hProcessHeap = NULL;
 HMODULE hCurrentModule = NULL;
 HMODULE kernel32_handle = NULL;
 HANDLE hBaseDir = NULL;
@@ -58,13 +57,6 @@ extern BOOL FASTCALL NlsInit(VOID);
 extern VOID FASTCALL NlsUninit(VOID);
 BOOLEAN InWindows = FALSE;
 
-HANDLE
-WINAPI
-DuplicateConsoleHandle(HANDLE hConsole,
-                       DWORD dwDesiredAccess,
-                       BOOL    bInheritHandle,
-                       DWORD dwOptions);
-
 #define WIN_OBJ_DIR L"\\Windows"
 #define SESSION_DIR L"\\Sessions"
 
@@ -323,11 +315,7 @@ DllMain(HANDLE hDll,
         }
 
         /* Initialize heap handle table */
-        hProcessHeap = RtlGetProcessHeap();
-        RtlInitializeHandleTable(0xFFFF,
-                                 sizeof(BASE_HEAP_HANDLE_ENTRY),
-                                 &BaseHeapHandleTable);
-        DPRINT("Heap: %p\n", hProcessHeap);
+        BaseDllInitializeMemoryManager();
 
         /* Set HMODULE for our DLL */
         kernel32_handle = hCurrentModule = hDll;
index 91fc17a..e726eca 100644 (file)
@@ -364,7 +364,7 @@ InternalFindFirstFile (
 
        if (!NT_SUCCESS(Status))
        {
-          RtlFreeHeap (hProcessHeap,
+          RtlFreeHeap (RtlGetProcessHeap(),
                        0,
                        NtPathBuffer);
 
@@ -387,20 +387,20 @@ InternalFindFirstFile (
        {
            /* No file part?! */
            NtClose(hDirectory);
-           RtlFreeHeap (hProcessHeap,
+           RtlFreeHeap (RtlGetProcessHeap(),
                         0,
                         NtPathBuffer);
            SetLastError(ERROR_FILE_NOT_FOUND);
            return INVALID_HANDLE_VALUE;
        }
 
-       IHeader = RtlAllocateHeap (hProcessHeap,
+       IHeader = RtlAllocateHeap (RtlGetProcessHeap(),
                                   HEAP_ZERO_MEMORY,
                                       sizeof(KERNEL32_FIND_DATA_HEADER) +
                                       sizeof(KERNEL32_FIND_FILE_DATA) + FIND_DATA_SIZE);
        if (NULL == IHeader)
        {
-           RtlFreeHeap (hProcessHeap,
+           RtlFreeHeap (RtlGetProcessHeap(),
                         0,
                         NtPathBuffer);
            NtClose(hDirectory);
@@ -431,7 +431,7 @@ InternalFindFirstFile (
                                       &PathFileName,
                                       lpFindFileData);
 
-       RtlFreeHeap (hProcessHeap,
+       RtlFreeHeap (RtlGetProcessHeap(),
                     0,
                     NtPathBuffer);
 
@@ -596,7 +596,7 @@ FindClose (
                        PKERNEL32_FIND_STREAM_DATA IData = (PKERNEL32_FIND_STREAM_DATA)(IHeader + 1);
                        if (IData->pFileStreamInfo != NULL)
                        {
-                               RtlFreeHeap (hProcessHeap, 0, IData->pFileStreamInfo);
+                               RtlFreeHeap (RtlGetProcessHeap(), 0, IData->pFileStreamInfo);
                        }
                        break;
                }
@@ -606,7 +606,7 @@ FindClose (
                        return FALSE;
        }
 
-       RtlFreeHeap (hProcessHeap, 0, IHeader);
+       RtlFreeHeap (RtlGetProcessHeap(), 0, IHeader);
 
        return TRUE;
 }
@@ -835,7 +835,7 @@ FindFirstStreamW(IN LPCWSTR lpFileName,
     }
 
     /* create the search context */
-    IHeader = RtlAllocateHeap(hProcessHeap,
+    IHeader = RtlAllocateHeap(RtlGetProcessHeap(),
                               0,
                               sizeof(KERNEL32_FIND_DATA_HEADER) +
                                   sizeof(KERNEL32_FIND_STREAM_DATA));
@@ -859,7 +859,7 @@ FindFirstStreamW(IN LPCWSTR lpFileName,
 
         if (IData->pFileStreamInfo == NULL)
         {
-            IData->pFileStreamInfo = RtlAllocateHeap(hProcessHeap,
+            IData->pFileStreamInfo = RtlAllocateHeap(RtlGetProcessHeap(),
                                                      0,
                                                      BufferSize);
             if (IData->pFileStreamInfo == NULL)
@@ -872,7 +872,7 @@ FindFirstStreamW(IN LPCWSTR lpFileName,
         {
             PFILE_STREAM_INFORMATION pfsi;
 
-            pfsi = RtlReAllocateHeap(hProcessHeap,
+            pfsi = RtlReAllocateHeap(RtlGetProcessHeap(),
                                      0,
                                      IData->pFileStreamInfo,
                                      BufferSize);
@@ -923,12 +923,12 @@ Cleanup:
         {
             if (IData->pFileStreamInfo != NULL)
             {
-                RtlFreeHeap(hProcessHeap,
+                RtlFreeHeap(RtlGetProcessHeap(),
                             0,
                             IData->pFileStreamInfo);
             }
 
-            RtlFreeHeap(hProcessHeap,
+            RtlFreeHeap(RtlGetProcessHeap(),
                         0,
                         IHeader);
         }
index 3f5eef2..8c18a87 100644 (file)
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS system libraries
- * FILE:            lib/kernel32/misc/handle.c
- * PURPOSE:         Object  functions
- * PROGRAMMER:      Ariadne ( ariadne@xs4all.nl)
- * UPDATE HISTORY:
- *                  Created 01/11/98
+/*
+ * PROJECT:         ReactOS Win32 Base API
+ * LICENSE:         See COPYING in the top level directory
+ * FILE:            dll/win32/kernel32/client/handle.c
+ * PURPOSE:         Object Handle Functions
+ * PROGRAMMERS:     Ariadne ( ariadne@xs4all.nl)
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include <k32.h>
 
 #define NDEBUG
 #include <debug.h>
 
-/* GLOBALS *******************************************************************/
-
-HANDLE WINAPI
-DuplicateConsoleHandle (HANDLE hConsole,
-                       DWORD   dwDesiredAccess,
-                       BOOL    bInheritHandle,
-                       DWORD   dwOptions);
+/* PRIVATE FUNCTIONS **********************************************************/
 
-/* FUNCTIONS *****************************************************************/
-
-HANDLE FASTCALL
-TranslateStdHandle(HANDLE hHandle)
+HANDLE
+FASTCALL
+TranslateStdHandle(IN HANDLE hHandle)
 {
-  PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters;
+    PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters;
 
-  switch ((ULONG)hHandle)
+    switch ((ULONG)hHandle)
     {
-      case STD_INPUT_HANDLE:  return Ppb->StandardInput;
-      case STD_OUTPUT_HANDLE: return Ppb->StandardOutput;
-      case STD_ERROR_HANDLE:  return Ppb->StandardError;
+        case STD_INPUT_HANDLE:  return Ppb->StandardInput;
+        case STD_OUTPUT_HANDLE: return Ppb->StandardOutput;
+        case STD_ERROR_HANDLE:  return Ppb->StandardError;
     }
 
-  return hHandle;
+    return hHandle;
 }
 
+/* PUBLIC FUNCTIONS ***********************************************************/
+
 /*
  * @implemented
  */
-BOOL WINAPI
-GetHandleInformation (HANDLE hObject,
-                     LPDWORD lpdwFlags)
+BOOL
+WINAPI
+GetHandleInformation(IN HANDLE hObject,
+                     OUT LPDWORD lpdwFlags)
 {
-  OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
-  ULONG BytesWritten;
-  NTSTATUS Status;
-  DWORD Flags;
-
-  hObject = TranslateStdHandle(hObject);
-
-  Status = NtQueryObject (hObject,
-                         ObjectHandleFlagInformation,
-                         &HandleInfo,
-                         sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
-                         &BytesWritten);
-  if (NT_SUCCESS(Status))
-  {
-    Flags = 0;
-    if (HandleInfo.Inherit)
-      Flags |= HANDLE_FLAG_INHERIT;
-    if (HandleInfo.ProtectFromClose)
-      Flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
+    OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
+    ULONG BytesWritten;
+    NTSTATUS Status;
+    DWORD Flags;
 
-    *lpdwFlags = Flags;
+    hObject = TranslateStdHandle(hObject);
 
+    if (IsConsoleHandle(hObject))
+    {
+        /* FIXME: GetConsoleHandleInformation required */
+        UNIMPLEMENTED;
+        BaseSetLastNTError(STATUS_NOT_IMPLEMENTED);
+        return FALSE;
+    }
+
+    Status = NtQueryObject(hObject,
+                           ObjectHandleFlagInformation,
+                           &HandleInfo,
+                           sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
+                           &BytesWritten);
+    if (!NT_SUCCESS(Status))
+    {
+        BaseSetLastNTError(Status);
+        return FALSE;
+    }
+
+    Flags = 0;
+    if (HandleInfo.Inherit) Flags |= HANDLE_FLAG_INHERIT;
+    if (HandleInfo.ProtectFromClose) Flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
+    *lpdwFlags = Flags;
     return TRUE;
-  }
-  else
-  {
-    BaseSetLastNTError (Status);
-    return FALSE;
-  }
 }
 
-
 /*
  * @implemented
  */
-BOOL WINAPI
-SetHandleInformation (HANDLE hObject,
-                     DWORD dwMask,
-                     DWORD dwFlags)
+BOOL
+WINAPI
+SetHandleInformation(IN HANDLE hObject,
+                     IN DWORD dwMask,
+                     IN DWORD dwFlags)
 {
-  OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
-  ULONG BytesWritten;
-  NTSTATUS Status;
-
-  hObject = TranslateStdHandle(hObject);
-
-  Status = NtQueryObject (hObject,
-                         ObjectHandleFlagInformation,
-                         &HandleInfo,
-                         sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
-                         &BytesWritten);
-  if (NT_SUCCESS(Status))
-  {
+    OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo;
+    ULONG BytesWritten;
+    NTSTATUS Status;
+
+    hObject = TranslateStdHandle(hObject);
+
+    if (IsConsoleHandle(hObject))
+    {
+        /* FIXME: SetConsoleHandleInformation required */
+        UNIMPLEMENTED;
+        BaseSetLastNTError(STATUS_NOT_IMPLEMENTED);
+        return FALSE;
+    }
+
+    Status = NtQueryObject(hObject,
+                           ObjectHandleFlagInformation,
+                           &HandleInfo,
+                           sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
+                           &BytesWritten);
+    if (!NT_SUCCESS(Status))
+    {
+        BaseSetLastNTError(Status);
+        return FALSE;
+    }
+
     if (dwMask & HANDLE_FLAG_INHERIT)
-      HandleInfo.Inherit = (dwFlags & HANDLE_FLAG_INHERIT) != 0;
-    if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE)
-      HandleInfo.ProtectFromClose = (dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
+    {
+        HandleInfo.Inherit = (dwFlags & HANDLE_FLAG_INHERIT) != 0;
+    }
 
-    Status = NtSetInformationObject (hObject,
-                                    ObjectHandleFlagInformation,
-                                    &HandleInfo,
-                                    sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION));
-    if(!NT_SUCCESS(Status))
+    if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE)
     {
-      BaseSetLastNTError (Status);
-      return FALSE;
+        HandleInfo.ProtectFromClose = (dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
     }
 
-    return TRUE;
-  }
-  else
-  {
-    BaseSetLastNTError (Status);
+    Status = NtSetInformationObject(hObject,
+                                    ObjectHandleFlagInformation,
+                                    &HandleInfo,
+                                    sizeof(HandleInfo));
+    if (NT_SUCCESS(Status)) return TRUE;
+
+    BaseSetLastNTError(Status);
     return FALSE;
-  }
 }
 
-
 /*
  * @implemented
  */
-BOOL WINAPI CloseHandle(HANDLE  hObject)
-/*
- * FUNCTION: Closes an open object handle
- * PARAMETERS:
- *       hObject = Identifies an open object handle
- * RETURNS: If the function succeeds, the return value is nonzero
- *          If the function fails, the return value is zero
- */
+BOOL
+WINAPI
+CloseHandle(IN HANDLE hObject)
 {
-   NTSTATUS Status;
+    NTSTATUS Status;
 
-   hObject = TranslateStdHandle(hObject);
+    hObject = TranslateStdHandle(hObject);
 
-   if (IsConsoleHandle(hObject))
-     {
-       return(CloseConsoleHandle(hObject));
-     }
+    if (IsConsoleHandle(hObject)) return CloseConsoleHandle(hObject);
 
-   Status = NtClose(hObject);
-   if (!NT_SUCCESS(Status))
-     {
-       BaseSetLastNTError (Status);
-       return FALSE;
-     }
+    Status = NtClose(hObject);
+    if (NT_SUCCESS(Status)) return TRUE;
 
-   return TRUE;
+    BaseSetLastNTError(Status);
+    return FALSE;
 }
 
-
 /*
  * @implemented
  */
-BOOL WINAPI DuplicateHandle(HANDLE hSourceProcessHandle,
-                               HANDLE hSourceHandle,
-                               HANDLE hTargetProcessHandle,
-                               LPHANDLE lpTargetHandle,
-                               DWORD dwDesiredAccess,
-                               BOOL bInheritHandle,
-                               DWORD dwOptions)
+BOOL
+WINAPI
+DuplicateHandle(IN HANDLE hSourceProcessHandle,
+                IN HANDLE hSourceHandle,
+                IN HANDLE hTargetProcessHandle,
+                OUT LPHANDLE lpTargetHandle,
+                IN DWORD dwDesiredAccess,
+                IN BOOL bInheritHandle,
+                IN DWORD dwOptions)
 {
-   DWORD SourceProcessId, TargetProcessId;
-   NTSTATUS Status;
-
-   hSourceHandle = TranslateStdHandle(hSourceHandle);
-
-   if (IsConsoleHandle(hSourceHandle))
-   {
-      SourceProcessId = GetProcessId(hSourceProcessHandle);
-      TargetProcessId = GetProcessId(hTargetProcessHandle);
-      if (!SourceProcessId || !TargetProcessId ||
-         SourceProcessId != TargetProcessId ||
-         SourceProcessId != GetCurrentProcessId())
-      {
-        SetLastError(ERROR_INVALID_PARAMETER);
+    NTSTATUS Status;
+    HANDLE hTargetHandle;
+
+    hSourceHandle = TranslateStdHandle(hSourceHandle);
+
+    if ((IsConsoleHandle(hSourceHandle)) &&
+        ((hSourceHandle != NtCurrentProcess()) &&
+         (hSourceHandle != NtCurrentThread())))
+    {
+        if ((hSourceProcessHandle != NtCurrentProcess()) &&
+            (hTargetProcessHandle != NtCurrentProcess()))
+        {
+            BaseSetLastNTError(STATUS_INVALID_PARAMETER);
+            return FALSE;
+        }
+
+        hTargetHandle = DuplicateConsoleHandle(hSourceHandle,
+                                               dwDesiredAccess,
+                                               bInheritHandle,
+                                               dwOptions);
+        if (hTargetHandle != INVALID_HANDLE_VALUE)
+        {
+            if (lpTargetHandle) *lpTargetHandle = hTargetHandle;
+            return TRUE;
+        }
+
         return FALSE;
-      }
-
-      *lpTargetHandle = DuplicateConsoleHandle(hSourceHandle, dwDesiredAccess, bInheritHandle, dwOptions);
-      return *lpTargetHandle != INVALID_HANDLE_VALUE;
-   }
-
-   Status = NtDuplicateObject(hSourceProcessHandle,
-                             hSourceHandle,
-                             hTargetProcessHandle,
-                             lpTargetHandle,
-                             dwDesiredAccess,
-                             bInheritHandle ? OBJ_INHERIT : 0,
-                             dwOptions);
-   if (!NT_SUCCESS(Status))
-     {
-       BaseSetLastNTError (Status);
-       return FALSE;
-     }
-
-   return TRUE;
+    }
+
+    Status = NtDuplicateObject(hSourceProcessHandle,
+                               hSourceHandle,
+                               hTargetProcessHandle,
+                               lpTargetHandle,
+                               dwDesiredAccess,
+                               bInheritHandle ? OBJ_INHERIT : 0,
+                               dwOptions);
+    if (NT_SUCCESS(Status)) return TRUE;
+
+    BaseSetLastNTError(Status);
+    return FALSE;
 }
 
 /*
@@ -211,9 +208,9 @@ BOOL WINAPI DuplicateHandle(HANDLE hSourceProcessHandle,
  */
 UINT
 WINAPI
-SetHandleCount(UINT nCount)
+SetHandleCount(IN UINT nCount)
 {
-   return nCount;
+    return nCount;
 }
 
 /*
@@ -240,7 +237,6 @@ CreateSocketHandle(VOID)
     DbgPrintEx(0, 0, "Unsupported API - kernel32!CreateSocketHandle() called\n");
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
-
 }
 
 /*
index 808e31b..58aa059 100644 (file)
@@ -6,18 +6,36 @@
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
  */
 
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
 
 #include <k32.h>
 
 #define NDEBUG
 #include <debug.h>
 
-/* TYPES *********************************************************************/
+/* GLOBALS ********************************************************************/
 
 RTL_HANDLE_TABLE BaseHeapHandleTable;
+HANDLE BaseHeap;
+ULONG_PTR SystemRangeStart;
 
-/* FUNCTIONS ***************************************************************/
+/* PRIVATE FUNCTIONS **********************************************************/
+
+VOID
+NTAPI
+BaseDllInitializeMemoryManager(VOID)
+{
+    BaseHeap = RtlGetProcessHeap();
+    RtlInitializeHandleTable(0xFFFF,
+                             sizeof(BASE_HEAP_HANDLE_ENTRY),
+                             &BaseHeapHandleTable);
+    NtQuerySystemInformation(SystemRangeStartInformation,
+                             &SystemRangeStart,
+                             sizeof(SystemRangeStart),
+                             NULL);
+}
+
+/* PUBLIC FUNCTIONS ***********************************************************/
 
 /*
  * @implemented
@@ -275,6 +293,8 @@ HeapWalk(HANDLE     hHeap,
 {
     NTSTATUS Status;
 
+    DPRINT1("Warning, HeapWalk is calling RtlWalkHeap with Win32 parameters\n");
+
     Status = RtlWalkHeap(hHeap, lpEntry);
 
     if (!NT_SUCCESS(Status))
@@ -353,7 +373,7 @@ GlobalAlloc(UINT uFlags,
     HANDLE hMemory;
     PBASE_HEAP_HANDLE_ENTRY HandleEntry;
     BASE_TRACE_ALLOC(dwBytes, uFlags);
-    ASSERT(hProcessHeap);
+    ASSERT(BaseHeap);
 
     /* Make sure the flags are valid */
     if (uFlags & ~GMEM_VALID_FLAGS)
@@ -374,13 +394,14 @@ GlobalAlloc(UINT uFlags,
         if (uFlags & GMEM_DDESHARE) Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE;
 
         /* Allocate heap for it */
-        Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes);
+        Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes ? dwBytes : 1);
+        if (!Ptr) SetLastError(ERROR_NOT_ENOUGH_MEMORY);
         BASE_TRACE_ALLOC2(Ptr);
         return Ptr;
     }
 
     /* This is heap based, so lock it in first */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
 
     /*
      * Disable locking, enable custom flags, and write the
@@ -398,35 +419,35 @@ GlobalAlloc(UINT uFlags,
         hMemory = NULL;
         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
         BASE_TRACE_FAILURE();
-        goto Quickie;
     }
-
-    /* Get the object and make sure we have size */
-    hMemory = &HandleEntry->Object;
-    if (dwBytes)
+    else
     {
-        /* Allocate the actual memory for it */
-        Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes);
-        BASE_TRACE_PTR(HandleEntry, Ptr);
-        if (!Ptr)
+        /* Get the object and make sure we have size */
+        hMemory = &HandleEntry->Object;
+        if (dwBytes)
         {
-            /* We failed, manually set the allocate flag and free the handle */
-            HandleEntry->Flags = RTL_HANDLE_VALID;
-            BaseHeapFreeEntry(HandleEntry);
+            /* Allocate the actual memory for it */
+            Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes);
+            BASE_TRACE_PTR(HandleEntry, Ptr);
+            if (!Ptr)
+            {
+                /* We failed, manually set the allocate flag and free the handle */
+                HandleEntry->Flags = RTL_HANDLE_VALID;
+                BaseHeapFreeEntry(HandleEntry);
 
-            /* For the cleanup case */
-            HandleEntry = NULL;
-        }
-        else
-        {
-            /* All worked well, save our heap entry */
-            RtlSetUserValueHeap(hProcessHeap, HEAP_NO_SERIALIZE, Ptr, hMemory);
+                /* For the cleanup case */
+                HandleEntry = NULL;
+            }
+            else
+            {
+                /* All worked well, save our heap entry */
+                RtlSetUserValueHeap(BaseHeap, HEAP_NO_SERIALIZE, Ptr, hMemory);
+            }
         }
     }
 
-Quickie:
     /* Cleanup! First unlock the heap */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
 
     /* Check if a handle was allocated */
     if (HandleEntry)
@@ -477,7 +498,7 @@ NTAPI
 GlobalCompact(DWORD dwMinFree)
 {
     /* Call the RTL Heap Manager */
-    return RtlCompactHeap(hProcessHeap, 0);
+    return RtlCompactHeap(BaseHeap, 0);
 }
 
 /*
@@ -504,71 +525,81 @@ GlobalFlags(HGLOBAL hMem)
     UINT uFlags = GMEM_INVALID_HANDLE;
 
     /* Start by locking the heap */
-    RtlLockHeap(hProcessHeap);
-
-    /* Check if this is a simple RTL Heap Managed block */
-    if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY))
+    RtlLockHeap(BaseHeap);
+    _SEH2_TRY
     {
-        /* Then we'll query RTL Heap */
-        RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags);
-        BASE_TRACE_PTR(Handle, hMem);
-
-        /*
-         * Check if RTL Heap didn't find a handle associated with us or
-         * said that this heap isn't movable, which means something we're
-         * really not a handle-based heap.
-         */
-        if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
-        {
-            /* Then set the flags to 0 */
-            uFlags = 0;
-        }
-        else
+        /* Check if this is a simple RTL Heap Managed block */
+        if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY))
         {
-            /* Otherwise we're handle-based, so get the internal handle */
-            hMem = Handle;
-        }
-    }
+            /* Then we'll query RTL Heap */
+            RtlGetUserInfoHeap(BaseHeap, Flags, hMem, &Handle, &Flags);
+            BASE_TRACE_PTR(Handle, hMem);
 
-    /* Check if the handle is actually an entry in our table */
-    if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)
-    {
-        /* Then get the entry */
-        HandleEntry = BaseHeapGetEntry(hMem);
-        BASE_TRACE_HANDLE(HandleEntry, hMem);
+            /*
+             * Check if RTL Heap didn't find a handle associated with us or
+             * said that this heap isn't movable, which means something we're
+             * really not a handle-based heap.
+             */
+            if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
+            {
+                /* Then set the flags to 0 */
+                uFlags = 0;
+            }
+            else
+            {
+                /* Otherwise we're handle-based, so get the internal handle */
+                hMem = Handle;
+            }
+        }
 
-        /* Make sure it's a valid handle */
-        if (BaseHeapValidateEntry(HandleEntry))
+        /* Check if the handle is actually an entry in our table */
+        if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)
         {
-            /* Get the lock count first */
-            uFlags = HandleEntry->LockCount & GMEM_LOCKCOUNT;
+            /* Then get the entry */
+            HandleEntry = BaseHeapGetEntry(hMem);
+            BASE_TRACE_HANDLE(HandleEntry, hMem);
 
-            /* Now check if it's discardable */
-            if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSABLE)
+            /* Make sure it's a valid handle */
+            if (BaseHeapValidateEntry(HandleEntry))
             {
-                /* Set the Win32 Flag */
-                uFlags |= GMEM_DISCARDABLE;
-            }
+                /* Get the lock count first */
+                uFlags = HandleEntry->LockCount & GMEM_LOCKCOUNT;
 
-            /* Check if it's DDE Shared */
-            if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_DDESHARE)
-            {
-                /* Set the Win32 Flag */
-                uFlags |= GMEM_DDESHARE;
-            }
+                /* Now check if it's discardable */
+                if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSABLE)
+                {
+                    /* Set the Win32 Flag */
+                    uFlags |= GMEM_DISCARDABLE;
+                }
 
-            /* Now check if it's discarded */
-            if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE)
-               /* Set the Win32 Flag */
-               uFlags |= GMEM_DISCARDED;
+                /* Check if it's DDE Shared */
+                if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_DDESHARE)
+                {
+                    /* Set the Win32 Flag */
+                    uFlags |= GMEM_DDESHARE;
+                }
+
+                /* Now check if it's discarded */
+                if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE)
+                {
+                   /* Set the Win32 Flag */
+                   uFlags |= GMEM_DISCARDED;
+               }
+            }
         }
-    }
 
-    /* Check if by now, we still haven't gotten any useful flags */
-    if (uFlags == GMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE);
+        /* Check if by now, we still haven't gotten any useful flags */
+        if (uFlags == GMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE);
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        /* Set the exception code */
+        BaseSetLastNTError(_SEH2_GetExceptionCode());
+    }
+    _SEH2_END;
 
     /* All done! Unlock heap and return Win32 Flags */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return uFlags;
 }
 
@@ -587,7 +618,7 @@ GlobalFree(HGLOBAL hMem)
     if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY))
     {
         /* Free it with the RTL Heap Manager */
-        if (RtlFreeHeap(hProcessHeap, 0, hMem))
+        if (RtlFreeHeap(BaseHeap, 0, hMem))
         {
             /* Return NULL since there's no handle */
             return NULL;
@@ -602,51 +633,67 @@ GlobalFree(HGLOBAL hMem)
     }
 
     /* It's a handle probably, so lock the heap */
-    RtlLockHeap(hProcessHeap);
-
-    /* Make sure that this is an entry in our handle database */
-    if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)
+    RtlLockHeap(BaseHeap);
+    _SEH2_TRY
     {
-        /* Get the entry */
-        HandleEntry = BaseHeapGetEntry(hMem);
-        BASE_TRACE_HANDLE(HandleEntry, hMem);
-
-        /* Make sure the handle is valid */
-        if (!BaseHeapValidateEntry(HandleEntry))
+        /* Make sure that this is an entry in our handle database */
+        if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)
         {
-            /* It's not, fail */
-            SetLastError(ERROR_INVALID_HANDLE);
-            Ptr = NULL;
+            /* Get the entry */
+            HandleEntry = BaseHeapGetEntry(hMem);
+            BASE_TRACE_HANDLE(HandleEntry, hMem);
+
+            /* Make sure the handle is valid */
+            if (!BaseHeapValidateEntry(HandleEntry))
+            {
+                /* It's not, fail */
+                SetLastError(ERROR_INVALID_HANDLE);
+                Ptr = NULL;
+            }
+            else
+            {
+                /* It's valid, so get the pointer */
+                Ptr = HandleEntry->Object;
+
+                /* Free this handle */
+                BaseHeapFreeEntry(HandleEntry);
+
+                /* If the pointer is 0, then we don't have a handle either */
+                if (!Ptr) hMem = NULL;
+            }
         }
         else
         {
-            /* It's valid, so get the pointer */
-            Ptr = HandleEntry->Object;
-
-            /* Free this handle */
-            BaseHeapFreeEntry(HandleEntry);
+            /* Otherwise, reuse the handle as a pointer */
+            BASE_TRACE_FAILURE();
+            Ptr = hMem;
+        }
 
-            /* If the pointer is 0, then we don't have a handle either */
-            if (!Ptr) hMem = NULL;
+        /* Check if we got here with a valid heap pointer */
+        if (Ptr)
+        {
+            /* Free it with the RTL Heap Manager */
+            if (RtlFreeHeap(BaseHeap, HEAP_NO_SERIALIZE, Ptr))
+            {
+                /* Everything worked */
+                hMem = NULL;
+            }
+            else
+            {
+                /* This wasn't a real heap handle */
+                SetLastError(ERROR_INVALID_HANDLE);
+            }
         }
     }
-    else
-    {
-        /* Otherwise, reuse the handle as a pointer */
-        BASE_TRACE_FAILURE();
-        Ptr = hMem;
-    }
-
-    /* Check if we got here with a valid heap pointer */
-    if (Ptr)
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
     {
-        /* Free it */
-        RtlFreeHeap(hProcessHeap, HEAP_NO_SERIALIZE, Ptr);
-        hMem = NULL;
+        /* Set the exception code */
+        BaseSetLastNTError(_SEH2_GetExceptionCode());
     }
+    _SEH2_END;
 
     /* We're done, so unlock the heap and return the handle */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return hMem;
 }
 
@@ -661,28 +708,42 @@ GlobalHandle(LPCVOID pMem)
     ULONG Flags;
 
     /* Lock the heap */
-    RtlLockHeap(hProcessHeap);
-
-    /* Query RTL Heap */
-    RtlGetUserInfoHeap(hProcessHeap,
-                       HEAP_NO_SERIALIZE,
-                       (PVOID)pMem,
-                       &Handle,
-                       &Flags);
-    BASE_TRACE_PTR(Handle, pMem);
-
-    /*
-     * Check if RTL Heap didn't find a handle for us or said that
-     * this heap isn't movable.
-     */
-    if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
+    RtlLockHeap(BaseHeap);
+    _SEH2_TRY
     {
-        /* We're actually handle-based, so the pointer is a handle */
-        Handle = (HANDLE)pMem;
+        /* Query RTL Heap */
+        if (!RtlGetUserInfoHeap(BaseHeap,
+                                HEAP_NO_SERIALIZE,
+                                (PVOID)pMem,
+                                &Handle,
+                                &Flags))
+        {
+            /* RTL Heap Manager does not know about this heap */
+            SetLastError(ERROR_INVALID_HANDLE);
+        }
+        else
+        {
+            /*
+             * Check if RTL Heap didn't find a handle for us or said that
+             * this heap isn't movable.
+             */
+            BASE_TRACE_PTR(Handle, pMem);
+            if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
+            {
+                /* We're actually handle-based, so the pointer is a handle */
+                Handle = (HANDLE)pMem;
+            }
+        }
     }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        /* Set the exception code */
+        BaseSetLastNTError(_SEH2_GetExceptionCode());
+    }
+    _SEH2_END;
 
     /* All done, unlock the heap and return the handle */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return Handle;
 }
 
@@ -699,13 +760,20 @@ GlobalLock(HGLOBAL hMem)
     /* Check if this was a simple allocated heap entry */
     if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY))
     {
-        /* Verify and return the pointer */
-        return IsBadReadPtr(hMem, 1) ? NULL : hMem;
+        /* Make sure it's not a kernel or invalid address */
+        if ((hMem >= (HGLOBAL)SystemRangeStart) || (IsBadReadPtr(hMem, 1)))
+        {
+            /* Signal an error */
+            SetLastError(ERROR_INVALID_HANDLE);
+            return NULL;
+        }
+
+        /* It's all good */
+        return hMem;
     }
 
     /* Otherwise, lock the heap */
-    RtlLockHeap(hProcessHeap);
-
+    RtlLockHeap(BaseHeap);
     _SEH2_TRY
     {
         /* Get the handle entry */
@@ -745,10 +813,10 @@ GlobalLock(HGLOBAL hMem)
         SetLastError(ERROR_INVALID_HANDLE);
         Ptr = NULL;
     }
-    _SEH2_END
+    _SEH2_END;
 
     /* All done. Unlock the heap and return the pointer */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return Ptr;
 }
 
@@ -763,6 +831,20 @@ GlobalReAlloc(HGLOBAL hMem,
     LPVOID Ptr;
     ULONG Flags = 0;
 
+    /* Throw out invalid flags */
+    if (uFlags & ~(GMEM_VALID_FLAGS | GMEM_MODIFY))
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return NULL;
+    }
+
+    /* Throw out invalid combo */
+    if ((uFlags & GMEM_DISCARDABLE) && !(uFlags & GMEM_MODIFY))
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return NULL;
+    }
+
     /* Convert ZEROINIT */
     if (uFlags & GMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY;
 
@@ -770,7 +852,7 @@ GlobalReAlloc(HGLOBAL hMem,
     if (!(uFlags & GMEM_MOVEABLE)) Flags |= HEAP_REALLOC_IN_PLACE_ONLY;
 
     /* Lock the heap and disable built-in locking in the RTL Heap funcitons */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
     Flags |= HEAP_NO_SERIALIZE;
 
     /* Check if this is a simple handle-based block */
@@ -816,14 +898,15 @@ GlobalReAlloc(HGLOBAL hMem,
                     if ((uFlags & GMEM_MOVEABLE) && !(HandleEntry->LockCount))
                     {
                         /* Free the current heap */
-                        RtlFreeHeap(hProcessHeap, Flags, Ptr);
-
-                        /* Free the handle */
-                        HandleEntry->Object = NULL;
-                        HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE;
-
-                        /* Get the object pointer */
-                        hMem = &HandleEntry->Object;
+                        if (RtlFreeHeap(BaseHeap, Flags, Ptr))
+                        {
+                            /* Free the handle */
+                            HandleEntry->Object = NULL;
+                            HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE;
+
+                            /* Get the object pointer */
+                            hMem = &HandleEntry->Object;
+                        }
                     }
                 }
                 else
@@ -839,12 +922,12 @@ GlobalReAlloc(HGLOBAL hMem,
                 if (!Ptr)
                 {
                     /* We don't have a base, so allocate one */
-                    Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes);
+                    Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes);
                     BASE_TRACE_ALLOC2(Ptr);
                     if (Ptr)
                     {
                         /* Allocation succeeded, so save our entry */
-                        RtlSetUserValueHeap(hProcessHeap,
+                        RtlSetUserValueHeap(BaseHeap,
                                             HEAP_NO_SERIALIZE,
                                             Ptr,
                                             hMem);
@@ -867,18 +950,8 @@ GlobalReAlloc(HGLOBAL hMem,
                         Flags &= ~HEAP_REALLOC_IN_PLACE_ONLY;
                     }
 
-                    /* And do the re-allocation */
-                    Ptr = RtlReAllocateHeap(hProcessHeap, Flags, Ptr, dwBytes);
-
-                    if (Ptr)
-                    {
-                        /* Allocation succeeded, so save our entry */
-                        RtlSetUserValueHeap(hProcessHeap,
-                                            HEAP_NO_SERIALIZE,
-                                            Ptr,
-                                            hMem);
-                    }
-
+                    /* Do the re-allocation. No need to save the entry again */
+                    Ptr = RtlReAllocateHeap(BaseHeap, Flags, Ptr, dwBytes);
                 }
 
                 /* Make sure we have a pointer by now */
@@ -904,81 +977,87 @@ GlobalReAlloc(HGLOBAL hMem,
         {
             /* Get information on its current state */
             Handle = hMem;
-            DPRINT1("h h %lx %lx\n", Handle, hMem);
-            RtlGetUserInfoHeap(hProcessHeap,
-                               HEAP_NO_SERIALIZE,
-                               hMem,
-                               &Handle,
-                               &Flags);
-            DPRINT1("h h %lx %lx\n", Handle, hMem);
-
-            /*
-             * Check if the handle matches the pointer or if the moveable flag
-             * isn't there, which is what we expect since it currenly isn't.
-             */
-            if (Handle == hMem || !(Flags & BASE_HEAP_FLAG_MOVABLE))
+            if (RtlGetUserInfoHeap(BaseHeap,
+                                   HEAP_NO_SERIALIZE,
+                                   hMem,
+                                   &Handle,
+                                   NULL))
             {
-                /* Allocate a handle for it */
-                HandleEntry = BaseHeapAllocEntry();
-
-                /* Calculate the size of the current heap */
-                dwBytes = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem);
-
-                /* Set the movable flag */
-                Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE;
-
-                /* Now allocate the actual heap for it */
-                HandleEntry->Object = RtlAllocateHeap(hProcessHeap,
-                                                      Flags,
-                                                      dwBytes);
-                BASE_TRACE_PTR(HandleEntry->Object, HandleEntry);
-                if (!HandleEntry->Object)
-                {
-                    /*
-                     * We failed, manually set the allocate flag and
-                     * free the handle
-                     */
-                    HandleEntry->Flags = RTL_HANDLE_VALID;
-                    BaseHeapFreeEntry(HandleEntry);
-
-                    /* For the cleanup case */
-                    BASE_TRACE_FAILURE();
-                    HandleEntry = NULL;
-                    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-                }
-                else
+                /*
+                 * Check if the handle matches the pointer or the moveable flag
+                 * isn't there, which is what we expect since it currenly isn't.
+                 */
+                if ((Handle == hMem) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
                 {
-                    /* Otherwise, copy the current heap and free the old one */
-                    RtlMoveMemory(HandleEntry->Object, hMem, dwBytes);
-                    RtlFreeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem);
+                    /* Allocate a handle for it */
+                    HandleEntry = BaseHeapAllocEntry();
+                    if (!HandleEntry)
+                    {
+                        /* No entry could be allocated */
+                        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+                        RtlUnlockHeap(BaseHeap);
+                        return NULL;
+                    }
 
-                    /* Select the heap pointer */
-                    hMem = (HANDLE)&HandleEntry->Object;
+                    /* Calculate the size of the current heap */
+                    dwBytes = RtlSizeHeap(BaseHeap, HEAP_NO_SERIALIZE, hMem);
 
-                    /* Initialize the count and default flags */
-                    HandleEntry->LockCount = 0;
-                    HandleEntry->Flags = RTL_HANDLE_VALID |
-                                         BASE_HEAP_ENTRY_FLAG_MOVABLE;
+                    /* Set the movable flag */
+                    Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE;
 
-                    /* Check if it's also discardable */
-                    if (uFlags & GMEM_DISCARDABLE)
+                    /* Now allocate the actual heap for it */
+                    HandleEntry->Object = RtlAllocateHeap(BaseHeap,
+                                                          Flags,
+                                                          dwBytes);
+                    BASE_TRACE_PTR(HandleEntry->Object, HandleEntry);
+                    if (!HandleEntry->Object)
                     {
-                        /* Set the internal flag */
-                        HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE;
+                        /*
+                         * We failed, manually set the allocate flag and
+                         * free the handle
+                         */
+                        HandleEntry->Flags = RTL_HANDLE_VALID;
+                        BaseHeapFreeEntry(HandleEntry);
+
+                        /* For the cleanup case */
+                        BASE_TRACE_FAILURE();
+                        HandleEntry = NULL;
+                        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
                     }
-
-                    /* Check if it's also DDE Shared */
-                    if (uFlags & GMEM_DDESHARE)
+                    else
                     {
-                        /* Set the internal flag */
-                        HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE;
-                    }
+                        /* Otherwise, copy the new heap and free the old one */
+                        RtlMoveMemory(HandleEntry->Object, hMem, dwBytes);
+                        RtlFreeHeap(BaseHeap, HEAP_NO_SERIALIZE, hMem);
+
+                        /* Select the heap pointer */
+                        hMem = (HANDLE)&HandleEntry->Object;
+
+                        /* Initialize the count and default flags */
+                        HandleEntry->LockCount = 0;
+                        HandleEntry->Flags = RTL_HANDLE_VALID |
+                                             BASE_HEAP_ENTRY_FLAG_MOVABLE;
+
+                        /* Check if it's also discardable */
+                        if (uFlags & GMEM_DISCARDABLE)
+                        {
+                            /* Set the internal flag */
+                            HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE;
+                        }
+
+                        /* Check if it's also DDE Shared */
+                        if (uFlags & GMEM_DDESHARE)
+                        {
+                            /* Set the internal flag */
+                            HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE;
+                        }
 
-                    /* Allocation succeeded, so save our entry */
-                    RtlSetUserValueHeap(hProcessHeap,
-                                        HEAP_NO_SERIALIZE,
-                                        HandleEntry->Object,
-                                        hMem);
+                        /* Allocation succeeded, so save our entry */
+                        RtlSetUserValueHeap(BaseHeap,
+                                            HEAP_NO_SERIALIZE,
+                                            HandleEntry->Object,
+                                            hMem);
+                    }
                 }
             }
         }
@@ -986,7 +1065,7 @@ GlobalReAlloc(HGLOBAL hMem,
     else
     {
         /* Otherwise, this is a simple RTL Managed Heap, so just call it */
-        hMem = RtlReAllocateHeap(hProcessHeap,
+        hMem = RtlReAllocateHeap(BaseHeap,
                                  Flags | HEAP_NO_SERIALIZE,
                                  hMem,
                                  dwBytes);
@@ -999,7 +1078,7 @@ GlobalReAlloc(HGLOBAL hMem,
     }
 
     /* All done, unlock the heap and return the pointer */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return hMem;
 }
 
@@ -1016,30 +1095,30 @@ GlobalSize(HGLOBAL hMem)
     SIZE_T dwSize = MAXULONG_PTR;
 
     /* Lock the heap */
-    RtlLockHeap(hProcessHeap);
-
+    RtlLockHeap(BaseHeap);
     _SEH2_TRY
     {
         /* Check if this is a simple RTL Heap Managed block */
         if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY))
         {
             /* Then we'll query RTL Heap */
-            RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags);
-            BASE_TRACE_PTR(Handle, hMem);
-
-            /*
-             * Check if RTL Heap didn't give us a handle or said that this heap
-             * isn't movable.
-             */
-            if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
-            {
-                /* This implies we're not a handle heap, so use the generic call */
-                dwSize = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem);
-            }
-            else
+            if (RtlGetUserInfoHeap(BaseHeap, Flags, hMem, &Handle, &Flags))
             {
-                /* Otherwise we're a handle heap, so get the internal handle */
-                hMem = Handle;
+                BASE_TRACE_PTR(Handle, hMem);
+                /*
+                 * Check if RTL Heap didn't give us a handle or said that this
+                 * heap isn't movable.
+                 */
+                if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE))
+                {
+                    /* We're not a handle heap, so use the generic call */
+                    dwSize = RtlSizeHeap(BaseHeap, HEAP_NO_SERIALIZE, hMem);
+                }
+                else
+                {
+                    /* We're a handle heap so get the internal handle */
+                    hMem = Handle;
+                }
             }
         }
 
@@ -1065,30 +1144,30 @@ GlobalSize(HGLOBAL hMem)
             else
             {
                 /* Otherwise, query RTL about it */
-                dwSize = RtlSizeHeap(hProcessHeap,
+                dwSize = RtlSizeHeap(BaseHeap,
                                      HEAP_NO_SERIALIZE,
                                      HandleEntry->Object);
             }
         }
-
-        /* Check if by now, we still haven't gotten any useful size */
-        if (dwSize == MAXULONG_PTR)
-        {
-            /* Fail */
-            BASE_TRACE_FAILURE();
-            SetLastError(ERROR_INVALID_HANDLE);
-            dwSize = 0;
-        }
     }
     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
     {
+        /* Set failure for later */
+        dwSize = MAXULONG_PTR;
+    }
+    _SEH2_END;
+
+    /* Check if by now, we still haven't gotten any useful size */
+    if (dwSize == MAXULONG_PTR)
+    {
+        /* Fail */
+        BASE_TRACE_FAILURE();
         SetLastError(ERROR_INVALID_HANDLE);
         dwSize = 0;
     }
-    _SEH2_END
 
     /* All done! Unlock heap and return the size */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return dwSize;
 }
 
@@ -1117,7 +1196,7 @@ GlobalUnlock(HGLOBAL hMem)
     if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) return RetVal;
 
     /* Otherwise, lock the heap */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
 
     /* Get the handle entry */
     HandleEntry = BaseHeapGetEntry(hMem);
@@ -1156,10 +1235,10 @@ GlobalUnlock(HGLOBAL hMem)
         SetLastError(ERROR_INVALID_PARAMETER);
         RetVal = FALSE;
     }
-    _SEH2_END
+    _SEH2_END;
 
     /* All done. Unlock the heap and return the pointer */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return RetVal;
 }
 
@@ -1292,7 +1371,7 @@ LocalAlloc(UINT uFlags,
     HANDLE hMemory;
     PBASE_HEAP_HANDLE_ENTRY HandleEntry;
     BASE_TRACE_ALLOC(dwBytes, uFlags);
-    ASSERT(hProcessHeap);
+    ASSERT(BaseHeap);
 
     /* Make sure the flags are valid */
     if (uFlags & ~LMEM_VALID_FLAGS)
@@ -1310,13 +1389,13 @@ LocalAlloc(UINT uFlags,
     if (!(uFlags & LMEM_MOVEABLE))
     {
         /* Allocate heap for it */
-        Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes);
+        Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes);
         BASE_TRACE_ALLOC2(Ptr);
         return Ptr;
     }
 
     /* This is heap based, so lock it in first */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
 
     /*
      * Disable locking, enable custom flags, and write the
@@ -1342,7 +1421,7 @@ LocalAlloc(UINT uFlags,
     if (dwBytes)
     {
         /* Allocate the actual memory for it */
-        Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes);
+        Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes);
         BASE_TRACE_PTR(HandleEntry, Ptr);
         if (!Ptr)
         {
@@ -1356,13 +1435,13 @@ LocalAlloc(UINT uFlags,
         else
         {
             /* All worked well, save our heap entry */
-            RtlSetUserValueHeap(hProcessHeap, HEAP_NO_SERIALIZE, Ptr, hMemory);
+            RtlSetUserValueHeap(BaseHeap, HEAP_NO_SERIALIZE, Ptr, hMemory);
         }
     }
 
 Quickie:
     /* Cleanup! First unlock the heap */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
 
     /* Check if a handle was allocated */
     if (HandleEntry)
@@ -1406,7 +1485,7 @@ NTAPI
 LocalCompact(UINT dwMinFree)
 {
     /* Call the RTL Heap Manager */
-    return RtlCompactHeap(hProcessHeap, 0);
+    return RtlCompactHeap(BaseHeap, 0);
 }
 
 /*
@@ -1422,13 +1501,13 @@ LocalFlags(HLOCAL hMem)
     UINT uFlags = LMEM_INVALID_HANDLE;
 
     /* Start by locking the heap */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
 
     /* Check if this is a simple RTL Heap Managed block */
     if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY))
     {
         /* Then we'll query RTL Heap */
-        RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags);
+        RtlGetUserInfoHeap(BaseHeap, Flags, hMem, &Handle, &Flags);
         BASE_TRACE_PTR(Handle, hMem);
 
         /*
@@ -1479,7 +1558,7 @@ LocalFlags(HLOCAL hMem)
     if (uFlags == LMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE);
 
     /* All done! Unlock heap and return Win32 Flags */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return uFlags;
 }
 
@@ -1534,7 +1613,7 @@ LocalReAlloc(HLOCAL hMem,
     if (!(uFlags & LMEM_MOVEABLE)) Flags |= HEAP_REALLOC_IN_PLACE_ONLY;
 
     /* Lock the heap and disable built-in locking in the RTL Heap funcitons */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
     Flags |= HEAP_NO_SERIALIZE;
 
     /* Check if this is a simple handle-based block */
@@ -1580,7 +1659,7 @@ LocalReAlloc(HLOCAL hMem,
                     if ((uFlags & LMEM_MOVEABLE) && !(HandleEntry->LockCount))
                     {
                         /* Free the current heap */
-                        RtlFreeHeap(hProcessHeap, Flags, Ptr);
+                        RtlFreeHeap(BaseHeap, Flags, Ptr);
 
                         /* Free the handle */
                         HandleEntry->Object = NULL;
@@ -1603,12 +1682,12 @@ LocalReAlloc(HLOCAL hMem,
                 if (!Ptr)
                 {
                     /* We don't have a base, so allocate one */
-                    Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes);
+                    Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes);
                     BASE_TRACE_ALLOC2(Ptr);
                     if (Ptr)
                     {
                         /* Allocation succeeded, so save our entry */
-                        RtlSetUserValueHeap(hProcessHeap,
+                        RtlSetUserValueHeap(BaseHeap,
                                             HEAP_NO_SERIALIZE,
                                             Ptr,
                                             hMem);
@@ -1632,7 +1711,7 @@ LocalReAlloc(HLOCAL hMem,
                     }
 
                     /* And do the re-allocation */
-                    Ptr = RtlReAllocateHeap(hProcessHeap, Flags, Ptr, dwBytes);
+                    Ptr = RtlReAllocateHeap(BaseHeap, Flags, Ptr, dwBytes);
                 }
 
                 /* Make sure we have a pointer by now */
@@ -1654,7 +1733,7 @@ LocalReAlloc(HLOCAL hMem,
     else if (!(uFlags & LMEM_MODIFY))
     {
         /* Otherwise, this is a simple RTL Managed Heap, so just call it */
-        hMem = RtlReAllocateHeap(hProcessHeap,
+        hMem = RtlReAllocateHeap(BaseHeap,
                                  Flags | HEAP_NO_SERIALIZE,
                                  hMem,
                                  dwBytes);
@@ -1667,7 +1746,7 @@ LocalReAlloc(HLOCAL hMem,
     }
 
     /* All done, unlock the heap and return the pointer */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return hMem;
 }
 
@@ -1680,7 +1759,7 @@ LocalShrink(HLOCAL hMem,
             UINT cbNewSize)
 {
     /* Call RTL */
-    return RtlCompactHeap(hProcessHeap, 0);
+    return RtlCompactHeap(BaseHeap, 0);
 }
 
 /*
@@ -1713,12 +1792,11 @@ LocalUnlock(HLOCAL hMem)
     }
 
     /* Otherwise, lock the heap */
-    RtlLockHeap(hProcessHeap);
+    RtlLockHeap(BaseHeap);
 
     /* Get the handle entry */
     HandleEntry = BaseHeapGetEntry(hMem);
     BASE_TRACE_HANDLE(HandleEntry, hMem);
-
     _SEH2_TRY
     {
         /* Make sure it's valid */
@@ -1752,10 +1830,10 @@ LocalUnlock(HLOCAL hMem)
         SetLastError(ERROR_INVALID_PARAMETER);
         RetVal = FALSE;
     }
-    _SEH2_END
+    _SEH2_END;
 
     /* All done. Unlock the heap and return the pointer */
-    RtlUnlockHeap(hProcessHeap);
+    RtlUnlockHeap(BaseHeap);
     return RetVal;
 }
 
index c2a05e3..8cb2a73 100644 (file)
 // API for it (such as GlobalLock).
 //
 
-//
-// The Handle Table
-//
-extern RTL_HANDLE_TABLE BaseHeapHandleTable;
-
-//
 // Tracing Support
 // Define _BASE_HANDLE_TRACE for Traces
 //
index ec4109f..008d77d 100644 (file)
@@ -91,7 +91,6 @@ DWORD
 /* GLOBAL VARIABLES **********************************************************/
 
 extern BOOL bIsFileApiAnsi;
-extern HANDLE hProcessHeap;
 extern HANDLE hBaseDir;
 extern HMODULE hCurrentModule;
 
@@ -110,6 +109,10 @@ extern BOOLEAN BaseRunningInServerProcess;
 
 /* FUNCTION PROTOTYPES *******************************************************/
 
+VOID
+NTAPI
+BaseDllInitializeMemoryManager(VOID);
+
 BOOL WINAPI VerifyConsoleIoHandle(HANDLE Handle);
 
 BOOL WINAPI CloseConsoleHandle(HANDLE Handle);
@@ -249,3 +252,11 @@ BaseSetLastNTError(IN NTSTATUS Status);
 
 /* FIXME */
 WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *);
+
+HANDLE
+WINAPI
+DuplicateConsoleHandle(HANDLE hConsole,
+                       DWORD dwDesiredAccess,
+                       BOOL    bInheritHandle,
+                       DWORD dwOptions);
+
index 94ce85e..676b1d4 100644 (file)
@@ -33,10 +33,10 @@ FONT 8, "MS Shell Dlg"
  LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20
  LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8
  CHECKBOX "Ne jelení&tse meg ezt az üzenetet mégegyszer", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&Mégse", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&Igen", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&Nem", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&Mégse" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&Igen" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&Nem" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
 }
 
 STRINGTABLE
index bd07373..2080fc5 100644 (file)
@@ -34,10 +34,10 @@ FONT 8, "MS Shell Dlg"
  LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20
  LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8
  CHECKBOX "Não &mostrar esta mensagem novamente", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&Cancelar", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&Sim", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON L"&Não", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&Cancelar" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&Sim" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON L"&Não" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
 }
 
 STRINGTABLE
index 493d01e..4d8571a 100644 (file)
@@ -7,9 +7,9 @@
 7   stdcall  getsockopt(long long long ptr ptr) ws2_32.getsockopt
 8   stdcall  htonl(long) ws2_32.htonl
 9   stdcall  htons(long) ws2_32.htons
-10  stdcall  ioctlsocket(long long ptr) ws2_32.ioctlsocket
-11  stdcall  inet_addr(str) ws2_32.inet_addr
-12  stdcall  inet_ntoa(ptr) ws2_32.inet_ntoa
+10  stdcall  inet_addr(str) ws2_32.inet_addr
+11  stdcall  inet_ntoa(ptr) ws2_32.inet_ntoa
+12  stdcall  ioctlsocket(long long ptr) ws2_32.ioctlsocket
 13  stdcall  listen(long long) ws2_32.listen
 14  stdcall  ntohl(long) ws2_32.ntohl
 15  stdcall  ntohs(long) ws2_32.ntohs
index c5e9e6f..3353f69 100644 (file)
@@ -1877,7 +1877,6 @@ NdisIPnPStartDevice(
   {
       NDIS_DbgPrint(MIN_TRACE, ("Failed to open configuration key\n"));
       ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
-      NdisCloseConfiguration(ConfigHandle);
       return NdisStatus;
   }
 
index 0e3e409..303d66a 100644 (file)
 #define DEBUG_INFO     0x02000000
 #define DEBUG_ULTRA    0x7FFFFFFF
 
-#define DBG 1
-
 #if DBG
 
 #define REMOVE_PARENS(...) __VA_ARGS__
 #define TI_DbgPrint(_t_, _x_) \
     DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) | DPFLTR_MASK, "(%s:%d) ", __FILE__, __LINE__), \
     DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) | DPFLTR_MASK, REMOVE_PARENS _x_)
-    //DbgPrint(REMOVE_PARENS _x_)
+
 #else /* DBG */
 
 #define TI_DbgPrint(_t_, _x_)
index 0a65822..a48d6e0 100644 (file)
@@ -242,8 +242,7 @@ UniataSataEvent(
     return FALSE;
 } // end UniataSataEvent()
 
-ULONG 
-NTAPI
+ULONG
 NTAPI
 UniataSataReadPort4(
     IN PHW_CHANNEL chan,
index 903a01f..09e2947 100644 (file)
@@ -96,7 +96,8 @@ typedef struct _COMMON_DEVICE_EXTENSION
 typedef struct _FDO_DEVICE_EXTENSION
 {
     COMMON_DEVICE_EXTENSION Common;
-
+    PDRIVER_OBJECT DriverObject;
+    PDEVICE_OBJECT DeviceObject;
     PDEVICE_OBJECT LowerDevice;
     PDEVICE_OBJECT Pdo;
     ULONG DeviceState;
index 250ab9c..094780f 100644 (file)
@@ -11,9 +11,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include <asm.inc>
-
-#include <ks386.inc>
+#include <ndk/asm.h>
 
 /* FUNCTIONS *****************************************************************/
 
index a46f7a5..f4a2282 100644 (file)
@@ -47,6 +47,11 @@ BOOL WINAPI EncryptionDisable (
        BOOL
        );
 
+BOOL WINAPI FileEncryptionStatus (
+       LPCTSTR,
+       LPDWORD
+       );
+
 DWORD WINAPI QueryUsersOnEncryptedFile (
        LPCWSTR,
        PENCRYPTION_CERTIFICATE_HASH_LIST*
index ac47278..6e5e345 100644 (file)
@@ -1,18 +1,18 @@
-/* Do not edit - Machine generated */\r
-#ifndef _INC_REACTOS_BUILDNO\r
-#define _INC_REACTOS_BUILDNO\r
-#define KERNEL_VERSION_BUILD   @KERNEL_VERSION_BUILD@\r
-#define KERNEL_VERSION_BUILD_HEX       0x@KERNEL_VERSION_BUILD_HEX@\r
-#define KERNEL_VERSION_BUILD_STR       "@KERNEL_VERSION_BUILD@@REVISION@"\r
-#define KERNEL_VERSION_BUILD_RC        "@KERNEL_VERSION_BUILD@@REVISION@\0"\r
-#define KERNEL_RELEASE_RC      "@KERNEL_VERSION@\0"\r
-#define KERNEL_RELEASE_STR     "@KERNEL_VERSION@"\r
-#define KERNEL_VERSION_RC      "@KERNEL_VERSION@\0"\r
-#define KERNEL_VERSION_STR     "@KERNEL_VERSION@"\r
-#define REACTOS_DLL_VERSION_MAJOR      @REACTOS_DLL_VERSION_MAJOR@\r
-#define REACTOS_DLL_RELEASE_RC "@DLL_VERSION_STR@\0"\r
-#define REACTOS_DLL_RELEASE_STR        "@DLL_VERSION_STR@"\r
-#define REACTOS_DLL_VERSION_RC "@DLL_VERSION_STR@\0"\r
-#define REACTOS_DLL_VERSION_STR        "@DLL_VERSION_STR@"\r
-#endif\r
-/* EOF */\r
+/* Do not edit - Machine generated */
+#ifndef _INC_REACTOS_BUILDNO
+#define _INC_REACTOS_BUILDNO
+#define KERNEL_VERSION_BUILD   @KERNEL_VERSION_BUILD@
+#define KERNEL_VERSION_BUILD_HEX       0x@KERNEL_VERSION_BUILD_HEX@
+#define KERNEL_VERSION_BUILD_STR       "@KERNEL_VERSION_BUILD@@REVISION@"
+#define KERNEL_VERSION_BUILD_RC        "@KERNEL_VERSION_BUILD@@REVISION@\0"
+#define KERNEL_RELEASE_RC      "@KERNEL_VERSION@\0"
+#define KERNEL_RELEASE_STR     "@KERNEL_VERSION@"
+#define KERNEL_VERSION_RC      "@KERNEL_VERSION@\0"
+#define KERNEL_VERSION_STR     "@KERNEL_VERSION@"
+#define REACTOS_DLL_VERSION_MAJOR      @REACTOS_DLL_VERSION_MAJOR@
+#define REACTOS_DLL_RELEASE_RC "@DLL_VERSION_STR@\0"
+#define REACTOS_DLL_RELEASE_STR        "@DLL_VERSION_STR@"
+#define REACTOS_DLL_VERSION_RC "@DLL_VERSION_STR@\0"
+#define REACTOS_DLL_VERSION_STR        "@DLL_VERSION_STR@"
+#endif
+/* EOF */
index 3800d16..420c451 100644 (file)
@@ -22,7 +22,49 @@ LanguageNames=(English=0x409:MSG00409)
 
 ; Facility=System
 
-; Eventlog messages 6xxx-
+;
+; eventlog events 6000-6099
+;
+
+MessageId=6000
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_LOG_FULL
+Language=English
+The %1 log file is full.
+.
+
+MessageId=6001
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_LogFileNotOpened
+Language=English
+The %1 log file cannot be opened.
+.
+
+MessageId=6002
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_LogFileCorrupt
+Language=English
+The %1 log file is corrupted and will be cleared.
+.
+
+MessageId=6003
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_DefaultLogCorrupt
+Language=English
+The Application log file could not be opened.  %1 will be used as the default log file.
+.
+
+MessageId=6004
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_BadDriverPacket
+Language=English
+A driver packet received from the I/O subsystem was invalid.  The data is the packet.
+.
 
 MessageId=6005
 Severity=Warning
@@ -40,6 +82,22 @@ Language=English
 The Event log service was stopped.
 .
 
+MessageId=6007
+Severity=Warning
+Facility=System
+SymbolicName=TITLE_EventlogMessageBox
+Language=English
+Eventlog Service %0
+.
+
+MessageId=6008
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_EventlogAbnormalShutdown
+Language=English
+The previous system shutdown at %1 on %2 was unexpected.
+.
+
 MessageId=6009
 Severity=Warning
 Facility=System
@@ -48,8 +106,366 @@ Language=English
 ReactOS %1 %2 %3 %4.
 .
 
+MessageId=6010
+Severity=Error
+Facility=System
+SymbolicName=EVENT_ServiceNoEventLog
+Language=English
+The %1 service was unable to set up an event source.
+.
+
+MessageId=6011
+Severity=Error
+Facility=System
+SymbolicName=EVENT_ComputerNameChange
+Language=English
+The NetBIOS name and DNS host name of this machine have been changed from %1 to %2.
+.
+
+MessageId=6012
+Severity=Error
+Facility=System
+SymbolicName=EVENT_DNSDomainNameChange
+Language=English
+The DNS domain assigned to this computer has been changed from %1 to %2.
+.
+
+
+;
+; system events 6100 - 6199
+;
+
+MessageId=6100
+Severity=Error
+Facility=System
+SymbolicName=EVENT_UP_DRIVER_ON_MP
+Language=English
+A uniprocessor-specific driver was loaded on a multiprocessor system.  The driver could not load.
+.
+
+
+;
+; service controller events 7000-7899
+;
+
+MessageId=7000
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_START_FAILED
+Language=English
+The %1 service failed to start due to the following error: %n%2
+.
+
+MessageId=7001
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_START_FAILED_II
+Language=English
+The %1 service depends on the %2 service which failed to start because of the following error: %n%3
+.
+
+MessageId=7002
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_START_FAILED_GROUP
+Language=English
+The %1 service depends on the %2 group and no member of this group started.
+.
+
+MessageId=7003
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_START_FAILED_NONE
+Language=English
+The %1 service depends on the following nonexistent service: %2
+.
+
+MessageId=7004
+Severity=Error
+Facility=System
+SymbolicName=EVENT_CALL_TO_FUNCTION_FAILED
+Language=English
+The %1 call failed with the following error: %n%2
+.
+
+MessageId=7005
+Severity=Error
+Facility=System
+SymbolicName=EVENT_CALL_TO_FUNCTION_FAILED_II
+Language=English
+The %1 call failed for %2 with the following error: %n%3
+.
+
+MessageId=7006
+Severity=Error
+Facility=System
+SymbolicName=EVENT_REVERTED_TO_LASTKNOWNGOOD
+Language=English
+The system reverted to its last known good configuration.  The system is restarting....
+.
+
+MessageId=7007
+Severity=Error
+Facility=System
+SymbolicName=EVENT_BAD_ACCOUNT_NAME
+Language=English
+No backslash is in the account name.
+.
+
+MessageId=7008
+Severity=Error
+Facility=System
+SymbolicName=EVENT_CONNECTION_TIMEOUT
+Language=English
+Timeout (%1 milliseconds) waiting for the %2 service to connect.
+.
+
+MessageId=7009
+Severity=Error
+Facility=System
+SymbolicName=EVENT_READFILE_TIMEOUT
+Language=English
+Timeout (%1 milliseconds) waiting for ReadFile.
+.
+
+MessageId=7010
+Severity=Error
+Facility=System
+SymbolicName=EVENT_TRANSACT_TIMEOUT
+Language=English
+Timeout (%1 milliseconds) waiting for a transaction response from the %2 service.
+.
+
+MessageId=7011
+Severity=Error
+Facility=System
+SymbolicName=EVENT_TRANSACT_INVALID
+Language=English
+Message returned in transaction has incorrect size.
+.
+
+MessageId=7012
+Severity=Error
+Facility=System
+SymbolicName=EVENT_FIRST_LOGON_FAILED
+Language=English
+Logon attempt with current password failed with the following error: %n%1
+.
+
+MessageId=7013
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SECOND_LOGON_FAILED
+Language=English
+Second logon attempt with old password also failed with the following error: %n%1
+.
+
+MessageId=7014
+Severity=Error
+Facility=System
+SymbolicName=EVENT_INVALID_DRIVER_DEPENDENCY
+Language=English
+Boot-start or system-start driver (%1) must not depend on a service.
+.
+
+MessageId=7015
+Severity=Error
+Facility=System
+SymbolicName=EVENT_BAD_SERVICE_STATE
+Language=English
+The %1 service has reported an invalid current state %2.
+.
+
+MessageId=7016
+Severity=Error
+Facility=System
+SymbolicName=EVENT_CIRCULAR_DEPENDENCY_DEMAND
+Language=English
+Detected circular dependencies demand starting %1.
+.
+
+MessageId=7017
+Severity=Error
+Facility=System
+SymbolicName=EVENT_CIRCULAR_DEPENDENCY_AUTO
+Language=English
+Detected circular dependencies auto-starting services.
+.
+
+MessageId=7018
+Severity=Error
+Facility=System
+SymbolicName=EVENT_DEPEND_ON_LATER_SERVICE
+Language=English
+Circular dependency: The %1 service depends on a service in a group which starts later.
+.
+
+MessageId=7019
+Severity=Error
+Facility=System
+SymbolicName=EVENT_DEPEND_ON_LATER_GROUP
+Language=English
+Circular dependency: The %1 service depends on a group which starts later.
+.
+
+MessageId=7020
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SEVERE_SERVICE_FAILED
+Language=English
+About to revert to the last known good configuration because the %1 service failed to start.
+.
+
+MessageId=7021
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_START_HUNG
+Language=English
+The %1 service hung on starting.
+.
+
+MessageId=7022
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_EXIT_FAILED
+Language=English
+The %1 service terminated with the following error: %n%2
+.
+
+MessageId=7023
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_EXIT_FAILED_SPECIFIC
+Language=English
+The %1 service terminated with service-specific error %2.
+.
+
+MessageId=7024
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_START_AT_BOOT_FAILED
+Language=English
+At least one service or driver failed during system startup.  Use Event Viewer to examine the event log for details.
+.
+
+MessageId=7025
+Severity=Error
+Facility=System
+SymbolicName=EVENT_BOOT_SYSTEM_DRIVERS_FAILED
+Language=English
+The following boot-start or system-start driver(s) failed to load: %1
+.
+
+MessageId=7026
+Severity=Error
+Facility=System
+SymbolicName=EVENT_RUNNING_LASTKNOWNGOOD
+Language=English
+ReactOS could not be started as configured.  A previous working configuration was used instead.
+.
+
+MessageId=7027
+Severity=Error
+Facility=System
+SymbolicName=EVENT_TAKE_OWNERSHIP
+Language=English
+The %1 Registry key denied access to SYSTEM account programs so the Service Control Manager took ownership of the Registry key.
+.
+
+MessageId=7028
+Severity=Error
+Facility=System
+SymbolicName=TITLE_SC_MESSAGE_BOX
+Language=English
+Service Control Manager %0
+.
+
+MessageId=7029
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_NOT_INTERACTIVE
+Language=English
+The %1 service is marked as an interactive service.  However, the system is configured to not allow interactive services.  This service may not function properly.
+.
+
+MessageId=7030
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_CRASH
+Language=English
+The %1 service terminated unexpectedly.  It has done this %2 time(s).  The following corrective action will be taken in %3 milliseconds: %5.
+.
+
+MessageId=7031
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_RECOVERY_FAILED
+Language=English
+The Service Control Manager tried to take a corrective action (%2) after the unexpected termination of the %3 service, but this action failed with the following error: %n%4
+.
+
+MessageId=7032
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_SCESRV_FAILED
+Language=English
+The Service Control Manager did not initialize successfully. The security
+configuration server (scesrv.dll) failed to initialize with error %1.  The
+system is restarting...
+.
+
+MessageId=7033
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_CRASH_NO_ACTION
+Language=English
+The %1 service terminated unexpectedly.  It has done this %2 time(s).
+.
+
+MessageId=7034
+Severity=Informational
+Facility=System
+SymbolicName=EVENT_SERVICE_CONTROL_SUCCESS
+Language=English
+The %1 service was successfully sent a %2 control.
+.
+
+MessageId=7035
+Severity=Informational
+Facility=System
+SymbolicName=EVENT_SERVICE_STATUS_SUCCESS
+Language=English
+Service Control Manager %0
+.
+
+MessageId=7036
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_CONFIG_BACKOUT_FAILED
+Language=English
+The Service Control Manager encountered an error undoing a configuration change
+to the %1 service.  The service's %2 is currently in an unpredictable state.
+
+If you do not correct this configuration, you may not be able to restart the %1
+service or may encounter other errors.  To ensure that the service is configured
+properly, use the Services snap-in in Microsoft Management Console (MMC).
+.
+
+MessageId=7037
+Severity=Error
+Facility=System
+SymbolicName=EVENT_FIRST_LOGON_FAILED_II
+Language=English
+The %1 service was unable to log on as %2 with the currently configured
+password due to the following error: %n%3%n%nTo ensure that the service is
+configured properly, use the Services snap-in in Microsoft Management
+Console (MMC).
+.
+
 
-; transport messages
+;
+; transport events 9000-9499
+;
 
 MessageId=9004
 Severity=Error
index 64dc2f3..7ced99b 100644 (file)
@@ -1,31 +1,31 @@
-/*\r
- * COPYRIGHT:   See COPYING in the top level directory\r
- * PROJECT:     ReactOS kernel\r
- * FILE:        include/internal/version.h\r
- * PURPOSE:     Defines the current version\r
- * PROGRAMMER:  David Welch (welch@mcmail.com)\r
- * REVISIONS:\r
- *     1999-11-06 (ea)\r
- *             Moved from include/internal in include/reactos\r
- *             to be used by buildno.\r
- *     2002-01-17 (ea)\r
- *             KERNEL_VERSION removed. Use\r
- *             reactos/buildno.h:KERNEL_VERSION_STR instead.\r
- */\r
-\r
-#ifndef __VERSION_H\r
-#define __VERSION_H\r
-\r
-#define KERNEL_VERSION_MAJOR @KERNEL_VERSION_MAJOR@\r
-#define KERNEL_VERSION_MINOR @KERNEL_VERSION_MINOR@\r
-#define KERNEL_VERSION_PATCH_LEVEL @KERNEL_VERSION_PATCH_LEVEL@\r
-\r
-#define COPYRIGHT_YEAR "@COPYRIGHT_YEAR@"\r
-\r
-/* KERNEL_VERSION_BUILD_TYPE is L"SVN", L"RC1", L"RC2" or L"" (for the release) */\r
-#define KERNEL_VERSION_BUILD_TYPE "@KERNEL_VERSION_BUILD_TYPE@"\r
-\r
-\r
-#endif\r
-\r
-/* EOF */\r
+/*
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS kernel
+ * FILE:        include/internal/version.h
+ * PURPOSE:     Defines the current version
+ * PROGRAMMER:  David Welch (welch@mcmail.com)
+ * REVISIONS:
+ *     1999-11-06 (ea)
+ *             Moved from include/internal in include/reactos
+ *             to be used by buildno.
+ *     2002-01-17 (ea)
+ *             KERNEL_VERSION removed. Use
+ *             reactos/buildno.h:KERNEL_VERSION_STR instead.
+ */
+
+#ifndef __VERSION_H
+#define __VERSION_H
+
+#define KERNEL_VERSION_MAJOR @KERNEL_VERSION_MAJOR@
+#define KERNEL_VERSION_MINOR @KERNEL_VERSION_MINOR@
+#define KERNEL_VERSION_PATCH_LEVEL @KERNEL_VERSION_PATCH_LEVEL@
+
+#define COPYRIGHT_YEAR "@COPYRIGHT_YEAR@"
+
+/* KERNEL_VERSION_BUILD_TYPE is L"SVN", L"RC1", L"RC2" or L"" (for the release) */
+#define KERNEL_VERSION_BUILD_TYPE "@KERNEL_VERSION_BUILD_TYPE@"
+
+
+#endif
+
+/* EOF */
index 265fecf..7297202 100644 (file)
@@ -1,2 +1,8 @@
 
+#ifdef _MSC_VER
 #include <malloc.h>
+#define alloca _alloca
+#else
+#include_next <alloca.h>
+#endif
+
index 2853a42..0b25317 100644 (file)
@@ -153,11 +153,7 @@ struct statfs;
 
 /* Constructor functions */
 
-#ifdef _MSC_VER // ReactOS
-#pragma message("DECL_GLOBAL_CONSTRUCTOR is not properly defined")
-# define DECL_GLOBAL_CONSTRUCTOR(func) \
-    static void func(void)
-#elif defined(__GNUC__)
+#ifdef __GNUC__
 # define DECL_GLOBAL_CONSTRUCTOR(func) \
     static void func(void) __attribute__((constructor)); \
     static void func(void)
index 22d64ce..eb45ad6 100644 (file)
@@ -96,7 +96,7 @@ extern void winetest_vskip( const char *msg, __winetest_va_list ap );
 
 #ifdef __GNUC__
 
-extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... );
+extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) __attribute__((format (printf,2,3) ));
 extern void __winetest_cdecl winetest_skip( const char *msg, ... ) __attribute__((format (printf,1,2)));
 extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) __attribute__((format (printf,1,2)));
 extern void __winetest_cdecl winetest_trace( const char *msg, ... ) __attribute__((format (printf,1,2)));
@@ -440,13 +440,13 @@ void winetest_wait_child_process( HANDLE process )
     {
         if (exit_code > 255)
         {
-            fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, (unsigned int)exit_code );
+            fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, exit_code );
             InterlockedIncrement( &failures );
         }
         else
         {
             fprintf( stdout, "%s: %u failures in child process\n",
-                     current_test->name, (unsigned int)exit_code );
+                     current_test->name, exit_code );
             while (exit_code-- > 0)
                 InterlockedIncrement(&failures);
         }
@@ -558,10 +558,10 @@ static int run_test( const char *name )
     if (winetest_debug)
     {
         fprintf( stdout, "%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
-                 test->name, (int)(successes + failures + todo_successes + todo_failures),
-                 (int)todo_successes, (int)(failures + todo_failures),
+                 test->name, successes + failures + todo_successes + todo_failures,
+                 todo_successes, failures + todo_failures,
                  (failures + todo_failures != 1) ? "failures" : "failure",
-                 (int)skipped );
+                 skipped );
     }
     status = (failures + todo_failures < 255) ? failures + todo_failures : 255;
     return status;
index 369e402..daefcc1 100644 (file)
@@ -25,7 +25,7 @@ struct _xsltStylesheet;
 struct jpeg_decompress_struct;
 
 typedef struct IWineD3D * (__stdcall typeof(WineDirect3DCreate))(unsigned int, struct IUnknown *);
-typedef struct IWineD3DClipper * (__stdcall typeof(WineDirect3DCreateClipper))(void);
+typedef struct IWineD3DClipper * (__stdcall typeof(WineDirect3DCreateClipper))(struct IUnknown *);
 typedef int (__stdcall typeof(ImeInquire))(struct _tagIMEINFO *, __typeof_wchar *, const __typeof_wchar *);
 typedef int (__stdcall typeof(ImeConfigure))(void *, void *, unsigned int, void *);
 typedef int (__stdcall typeof(ImeDestroy))(unsigned int);
index 1c01c1b..44aa276 100644 (file)
@@ -54,9 +54,46 @@ static VOID DisplayIPHeader(
       ((IPHeader->DstAddr >> 16) & 0xFF), ((IPHeader->DstAddr >> 24) & 0xFF));
 }
 
+static VOID DisplayTCPHeader(
+    PCHAR Header,
+    UINT Length)
+{
+    /* FIXME: IPv4 only */
+    PIPv4_HEADER IPHeader = (PIPv4_HEADER)Header;
+    PTCPv4_HEADER TCPHeader;
+
+    if (IPHeader->Protocol != IPPROTO_TCP) {
+        DbgPrint("This is not a TCP datagram. Protocol is %d\n", IPHeader->Protocol);
+        return;
+    }
+
+    TCPHeader = (PTCPv4_HEADER)((PCHAR)IPHeader + (IPHeader->VerIHL & 0x0F) * 4);
+
+    DbgPrint("TCP header:\n");
+    DbgPrint("  SourcePort: %d\n", WN2H(TCPHeader->SourcePort));
+    DbgPrint("  DestinationPort: %d\n", WN2H(TCPHeader->DestinationPort));
+    DbgPrint("  SequenceNumber: 0x%x\n", DN2H(TCPHeader->SequenceNumber));
+    DbgPrint("  AckNumber: 0x%x\n", DN2H(TCPHeader->AckNumber));
+    DbgPrint("  DataOffset: 0x%x (0x%x) 32-bit words\n", TCPHeader->DataOffset, TCPHeader->DataOffset >> 4);
+    DbgPrint("  Flags: 0x%x (0x%x)\n", TCPHeader->Flags, TCPHeader->Flags & 0x3F);
+    if ((TCPHeader->Flags & TCP_URG) > 0) DbgPrint("    TCP_URG - Urgent Pointer field significant\n");
+    if ((TCPHeader->Flags & TCP_ACK) > 0) DbgPrint("    TCP_ACK - Acknowledgement field significant\n");
+    if ((TCPHeader->Flags & TCP_PSH) > 0) DbgPrint("    TCP_PSH - Push Function\n");
+    if ((TCPHeader->Flags & TCP_RST) > 0) DbgPrint("    TCP_RST - Reset the connection\n");
+    if ((TCPHeader->Flags & TCP_SYN) > 0) DbgPrint("    TCP_SYN - Synchronize sequence numbers\n");
+    if ((TCPHeader->Flags & TCP_FIN) > 0) DbgPrint("    TCP_FIN - No more data from sender\n");
+    DbgPrint("  Window: 0x%x\n", WN2H(TCPHeader->Window));
+    DbgPrint("  Checksum: 0x%x\n", WN2H(TCPHeader->Checksum));
+    DbgPrint("  Urgent: 0x%x\n", WN2H(TCPHeader->Urgent));
+}
+
+
 VOID DisplayTCPPacket(
     PIP_PACKET IPPacket)
 {
+    UINT Length;
+    PCHAR Buffer;
+
     if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE) ||
         (DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK) != TRUE)) {
         return;
@@ -75,6 +112,20 @@ VOID DisplayTCPPacket(
     TI_DbgPrint(MIN_TRACE, ("TotalSize (%d).\n", IPPacket->TotalSize));
     TI_DbgPrint(MIN_TRACE, ("ContigSize (%d).\n", IPPacket->ContigSize));
     TI_DbgPrint(MIN_TRACE, ("NdisPacket (0x%X).\n", IPPacket->NdisPacket));
+
+    if (IPPacket->NdisPacket) {
+        NdisQueryPacket(IPPacket->NdisPacket, NULL, NULL, NULL, &Length);
+        Buffer = ExAllocatePool(NonPagedPool, Length);
+        if (Buffer) {
+            Length = CopyPacketToBuffer(Buffer, IPPacket->NdisPacket, 0, Length);
+            DisplayTCPHeader(Buffer, Length);
+            ExFreePool(Buffer);
+        }
+    } else {
+        Buffer = IPPacket->Header;
+        Length = IPPacket->ContigSize;
+        DisplayTCPHeader(Buffer, Length);
+    }
 }
 #endif
 
index 375b498..64dc549 100644 (file)
@@ -32,8 +32,6 @@ void *RosSymRealloc(void *mem, ulong newsize);
 void xfree(void *v);
 
 #define werrstr(str, ...) DPRINT(str "\n" ,##__VA_ARGS__)
-//#define werrstr(x, ...) printf("(%s:%d) " x "\n",__FILE__,__LINE__,##__VA_ARGS__)
-
 #define malloc(x) RosSymAllocMem(x)
 #define mallocz(x,y) RosSymAllocMemZero(x,y)
 #define free(x) xfree(x)
index 1e6fe83..c97e40c 100644 (file)
 #define NTOSAPI
 #include <ntddk.h>
 #include <reactos/rossym.h>
-#include <ntimage.h>
+#include "rossympriv.h"
 
 #define NDEBUG
 #include <debug.h>
 
-#include "rossympriv.h"
-#include "pe.h"
-#include "dwarf.h"
-
 VOID
 RosSymDelete(PROSSYM_INFO RosSymInfo)
 {
-       dwarfclose(RosSymInfo);
+  RosSymFreeMem(RosSymInfo);
 }
 
 /* EOF */
index 7308d7d..0468981 100644 (file)
@@ -6,8 +6,6 @@ typedef struct DwarfBlock DwarfBlock;
 typedef struct DwarfBuf DwarfBuf;
 typedef struct DwarfExpr DwarfExpr;
 typedef struct DwarfSym DwarfSym;
-typedef struct DwarfStack DwarfStack;
-typedef struct DwarfParam DwarfParam;
 typedef union DwarfVal DwarfVal;
 
 enum
@@ -205,16 +203,6 @@ struct DwarfBlock
        ulong len;
 };
 
-struct DwarfParam
-{
-       char *name;
-       ulong unit;
-       ulong type;
-    ulong loctype;
-       ulong fde, len;
-    ulong value;
-};
-
 /* not for consumer use */
 struct DwarfBuf
 {
@@ -384,16 +372,19 @@ struct DwarfExpr
 
 struct DwarfSym
 {
-    DwarfAttrs attrs;
-    
+       DwarfAttrs attrs;
+
 /* not for consumer use... */
-    uint num;
-    DwarfBuf b;
-    int depth;
-    ulong unit, childoff, nextunit;
-    ulong aoff;
+       DwarfBuf b;
+       ulong unit;
+       uint uoff;
+       ulong aoff;
+       int depth;
+       int allunits;
+       ulong nextunit;
 };
 
+
 struct _Pe;
 Dwarf *dwarfopen(struct _Pe *elf);
 void dwarfclose(Dwarf*);
@@ -407,11 +398,9 @@ int dwarfenumunit(Dwarf*, ulong, DwarfSym*);
 int dwarfseeksym(Dwarf*, ulong, ulong, DwarfSym*);
 int dwarfenum(Dwarf*, DwarfSym*);
 int dwarfnextsym(Dwarf*, DwarfSym*);
-int dwarfnextsymat(Dwarf*, DwarfSym *parent, DwarfSym *child);
-int dwarfpctoline(Dwarf*, DwarfSym *proc, ulong, char**, char**, ulong *);
-int dwarfgetarg(Dwarf *d, const char *name, DwarfBuf *locbuf, ulong cfa, PROSSYM_REGISTERS registers, ulong *value);
-int dwarfgettype(Dwarf *d, DwarfSym *param, DwarfSym *type);
-
+int dwarfnextsymat(Dwarf*, DwarfSym*, int);
+int dwarfpctoline(Dwarf*, ulong, char**, char**, char**, char **, ulong*, ulong*, ulong*);
+int dwarfunwind(Dwarf*, ulong, DwarfExpr*, DwarfExpr*, DwarfExpr*, int);
 ulong dwarfget1(DwarfBuf*);
 ulong dwarfget2(DwarfBuf*);
 ulong dwarfget4(DwarfBuf*);
@@ -422,10 +411,7 @@ ulong dwarfgetaddr(DwarfBuf*);
 int dwarfgetn(DwarfBuf*, uchar*, int);
 uchar *dwarfgetnref(DwarfBuf*, ulong);
 char *dwarfgetstring(DwarfBuf*);
-int dwarfcomputecfa(Dwarf *d, DwarfExpr *cfa, PROSSYM_REGISTERS registers, ulong *cfaLocation);
-int dwarfregunwind(Dwarf *d, ulong pc, ulong fde, DwarfExpr *cfa, PROSSYM_REGISTERS registers);
-int dwarfargvalue(Dwarf *d, DwarfSym *proc, ulong pc, ulong cfa, PROSSYM_REGISTERS registers, DwarfParam *parameters);
-int dwarfgetparams(Dwarf *d, DwarfSym *s, ulong pc, int pnum, DwarfParam *paramblocks);
+
 
 typedef struct DwarfAbbrev DwarfAbbrev;
 typedef struct DwarfAttr DwarfAttr;
@@ -463,7 +449,6 @@ struct Dwarf
        DwarfBlock pubtypes;
        DwarfBlock ranges;
        DwarfBlock str;
-       DwarfBlock loc;
 
        /* little cache */
        struct {
@@ -473,15 +458,14 @@ struct Dwarf
        } acache;
 };
 
-struct DwarfStack
-{
-    ulong storage[16]; // own storage
-    ulong *data;
-    ulong length, max;
-};
-
 DwarfAbbrev *dwarfgetabbrev(Dwarf*, ulong, ulong);
 
 int dwarfgetinfounit(Dwarf*, ulong, DwarfBlock*);
 
+extern int dwarf386nregs;
+extern char *dwarf386regs[];
+extern char *dwarf386fp;
+
+#define SYMBOL_SIZE 18
 #define MAXIMUM_DWARF_NAME_SIZE 64
+#define MAXIMUM_COFF_SYMBOL_LENGTH 256
index 365d442..d21ca6a 100644 (file)
@@ -25,119 +25,117 @@ DwarfAbbrev *dwarfgetabbrev(Dwarf*, ulong, ulong);
 static int
 loadabbrevs(Dwarf *d, ulong off, DwarfAbbrev **aa)
 {
-    int nattr, nabbrev;
-    DwarfAbbrev *abbrev;
-    DwarfAttr *attr;
-
-    if(d->acache.off == off && d->acache.na){
-        *aa = d->acache.a;
-        return d->acache.na;
-    }
-
-    /* two passes - once to count, then allocate, then a second to copy */
-    if(parseabbrevs(d, off, nil, nil, &nabbrev, &nattr) < 0) {
-        return -1;
-    }
-
-    abbrev = malloc(nabbrev*sizeof(DwarfAbbrev) + nattr*sizeof(DwarfAttr));
-    attr = (DwarfAttr*)(abbrev+nabbrev);
-
-    if(parseabbrevs(d, off, abbrev, attr, nil, nil) < 0){
-        free(abbrev);
-        return -1;
-    }
-
-    free(d->acache.a);
-    d->acache.a = abbrev;
-    d->acache.na = nabbrev;
-    d->acache.off = off;
-
-    *aa = abbrev;
-    return nabbrev;
+       int nattr, nabbrev;
+       DwarfAbbrev *abbrev;
+       DwarfAttr *attr;
+
+       if(d->acache.off == off && d->acache.na){
+               *aa = d->acache.a;
+               return d->acache.na;
+       }
+
+       /* two passes - once to count, then allocate, then a second to copy */
+       if(parseabbrevs(d, off, nil, nil, &nabbrev, &nattr) < 0) {
+               return -1;
+       }
+
+       abbrev = malloc(nabbrev*sizeof(DwarfAbbrev) + nattr*sizeof(DwarfAttr));
+       attr = (DwarfAttr*)(abbrev+nabbrev);
+
+       if(parseabbrevs(d, off, abbrev, attr, nil, nil) < 0){
+               free(abbrev);
+               return -1;
+       }
+
+       free(d->acache.a);
+       d->acache.a = abbrev;
+       d->acache.na = nabbrev;
+       d->acache.off = off;
+
+       *aa = abbrev;
+       return nabbrev;
 }
 
 static int
 parseabbrevs(Dwarf *d, ulong off, DwarfAbbrev *abbrev, DwarfAttr *attr, int *pnabbrev, int *pnattr)
 {
-    int i, nabbrev, nattr, haskids;
-    ulong num, tag, name, form;
-    DwarfBuf b;
-
-    if(off >= d->abbrev.len){
-        werrstr("bad abbrev section offset 0x%lux >= 0x%lux", off, d->abbrev.len);
-        return -1;
-    }
-
-    memset(&b, 0, sizeof b);
-    b.p = d->abbrev.data + off;
-    b.ep = d->abbrev.data + d->abbrev.len;
-
-    nabbrev = 0;
-    nattr = 0;
-    for(;;){
-        if(b.p == nil){
-            werrstr("malformed abbrev data");
-            return -1;
-        }
-        num = dwarfget128(&b);
-        if(num == 0)
-            break;
-        tag = dwarfget128(&b);
-        DPRINT("num %d tag %x @ %x", num, tag, b.p - d->abbrev.data);
-        haskids = dwarfget1(&b);
-        for(i=0;; i++){
-            name = dwarfget128(&b);
-            form = dwarfget128(&b);
-            assert(form < 0x3000);
-            if(name == 0 && form == 0)
-                break;
-            if(attr){
-                attr[i].name = name;
-                attr[i].form = form;
-            }
-        }
-        if(abbrev){
-            abbrev->num = num;
-            abbrev->tag = tag;
-            abbrev->haskids = haskids;
-            abbrev->attr = attr;
-            abbrev->nattr = i;
-            abbrev++;
-            attr += i;
-        }
-        nabbrev++;
-        nattr += i;
-    }
-    if(pnabbrev)
-        *pnabbrev = nabbrev;
-    if(pnattr)
-        *pnattr = nattr;
-    return 0;
+       int i, nabbrev, nattr, haskids;
+       ulong num, tag, name, form;
+       DwarfBuf b;
+
+       if(off >= d->abbrev.len){
+               werrstr("bad abbrev section offset 0x%lux >= 0x%lux\n", off, d->abbrev.len);
+               return -1;
+       }
+
+       memset(&b, 0, sizeof b);
+       b.p = d->abbrev.data + off;
+       b.ep = d->abbrev.data + d->abbrev.len;
+
+       nabbrev = 0;
+       nattr = 0;
+       for(;;){
+               if(b.p == nil){
+                       werrstr("malformed abbrev data");
+                       return -1;
+               }
+               num = dwarfget128(&b);
+               if(num == 0)
+                       break;
+               tag = dwarfget128(&b);
+               haskids = dwarfget1(&b);
+               for(i=0;; i++){
+                       name = dwarfget128(&b);
+                       form = dwarfget128(&b);
+                       if(name == 0 && form == 0)
+                               break;
+                       if(attr){
+                               attr[i].name = name;
+                               attr[i].form = form;
+                       }
+               }
+               if(abbrev){
+                       abbrev->num = num;
+                       abbrev->tag = tag;
+                       abbrev->haskids = haskids;
+                       abbrev->attr = attr;
+                       abbrev->nattr = i;
+                       abbrev++;
+                       attr += i;
+               }
+               nabbrev++;
+               nattr += i;
+       }
+       if(pnabbrev)
+               *pnabbrev = nabbrev;
+       if(pnattr)
+               *pnattr = nattr;
+       return 0;
 }
 
 static DwarfAbbrev*
 findabbrev(DwarfAbbrev *a, int na, ulong num)
 {
-    int i;
-
-    for(i=0; i<na; i++)
-        if(a[i].num == num)
-            return &a[i];
-    assert(0);
-    werrstr("abbrev not found");
-    return nil;
+       int i;
+
+       for(i=0; i<na; i++)
+               if(a[i].num == num)
+                       return &a[i];
+       werrstr("abbrev not found");
+       return nil;
 }
 
 DwarfAbbrev*
 dwarfgetabbrev(Dwarf *d, ulong off, ulong num)
 {
-    DwarfAbbrev *a;
-    int na;
-
-    if((na = loadabbrevs(d, off, &a)) < 0){
-        werrstr("loadabbrevs: %r");
-        return nil;
-    }
-    return findabbrev(a, na, num);
+       DwarfAbbrev *a;
+       int na;
+
+       if((na = loadabbrevs(d, off, &a)) < 0){
+               werrstr("loadabbrevs: %r");
+               return nil;
+       }
+       return findabbrev(a, na, num);
 }
 
+
index cda4cd6..e9e82c1 100644 (file)
 int
 dwarfaddrtounit(Dwarf *d, ulong addr, ulong *unit)
 {
-    DwarfBuf b;
-    int segsize, i;
-    ulong len, id, off, base, size;
-    uchar *start, *end;
+       DwarfBuf b;
+       int segsize, i;
+       ulong len, id, off, base, size;
+       uchar *start, *end;
 
-    memset(&b, 0, sizeof b);
-    b.d = d;
-    b.p = d->aranges.data;
-    b.ep = b.p + d->aranges.len;
+       memset(&b, 0, sizeof b);
+       b.d = d;
+       b.p = d->aranges.data;
+       b.ep = b.p + d->aranges.len;
 
-    while(b.p < b.ep){
-        start = b.p;
-        len = dwarfget4(&b);
-        if (!len) { b.ep = b.p - 4; return -1; }
-        if((id = dwarfget2(&b)) != 2){
-            if(b.p == nil){
-            underflow:
-                werrstr("buffer underflow reading address ranges header");
-            }else
-                werrstr("bad dwarf version 0x%x in address ranges header", id);
-            return -1;
-        }
-        off = dwarfget4(&b);
-        b.addrsize = dwarfget1(&b);
-        if(d->addrsize == 0)
-            d->addrsize = b.addrsize;
-        segsize = dwarfget1(&b);
-        USED(segsize); /* what am i supposed to do with this? */
-        if(b.p == nil)
-            goto underflow;
-        if((i = (b.p-start) % (2*b.addrsize)) != 0)
-            b.p += 2*b.addrsize - i;
-        end = start+4+len;
-        while(b.p!=nil && b.p<end){
-            base = dwarfgetaddr(&b);
-            size = dwarfgetaddr(&b);
-            if (!size) continue;
-            if(b.p == nil)
-                goto underflow;
-            if(base <= addr && addr < base+size){
-                *unit = off;
-                return 0;
-            }
-        }
-        if(b.p == nil)
-            goto underflow;
-        b.p = end;
-    }
-    werrstr("address 0x%lux is not listed in dwarf debugging symbols", addr);
-    return -1;
+       while(b.p < b.ep){
+               start = b.p;
+               len = dwarfget4(&b);
+               if (!len) { b.ep = b.p - 4; return -1; }
+               if((id = dwarfget2(&b)) != 2){
+                       if(b.p == nil){
+                       underflow:
+                               werrstr("buffer underflow reading address ranges header");
+                       }else
+                               werrstr("bad dwarf version 0x%x in address ranges header", id);
+                       return -1;
+               }
+               off = dwarfget4(&b);
+               b.addrsize = dwarfget1(&b);
+               if(d->addrsize == 0)
+                       d->addrsize = b.addrsize;
+               segsize = dwarfget1(&b);
+               USED(segsize);  /* what am i supposed to do with this? */
+               if(b.p == nil)
+                       goto underflow;
+               if((i = (b.p-start) % (2*b.addrsize)) != 0)
+                       b.p += 2*b.addrsize - i;
+               end = start+4+len;
+               while(b.p!=nil && b.p<end){
+                       base = dwarfgetaddr(&b);
+                       size = dwarfgetaddr(&b);
+                       if (!size) continue;
+                       if(b.p == nil)
+                               goto underflow;
+                       if(base <= addr && addr < base+size){
+                               *unit = off;
+                               return 0;
+                       }
+               }
+               if(b.p == nil)
+                       goto underflow;
+               b.p = end;
+       }
+       werrstr("address 0x%lux is not listed in dwarf debugging symbols", addr);
+       return -1;
 }
+
+
index 3c0c349..4197058 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
-#include "pe.h"
 #include "dwarf.h"
 
-#define trace 1
+#define trace 0
 
 typedef struct State State;
 struct State
@@ -72,7 +71,7 @@ dwarfunwind(Dwarf *d, ulong pc, DwarfExpr *cfa, DwarfExpr *ra, DwarfExpr *r, int
        memset(r, 0, nr*sizeof(r[0]));
        for(i=0; i<nr; i++)
                r[i].type = RuleSame;
-       if(trace) werrstr("s.init %p-%p, fde %p-%p", s.init.p, s.init.ep, fde.p, fde.ep);
+       if(trace) werrstr("s.init %p-%p, fde %p-%p\n", s.init.p, s.init.ep, fde.p, fde.ep);
        b = s.init;
        if(dexec(&b, &s, 0) < 0)
                goto err;
@@ -80,9 +79,9 @@ dwarfunwind(Dwarf *d, ulong pc, DwarfExpr *cfa, DwarfExpr *ra, DwarfExpr *r, int
        s.initr = initr;
        memmove(initr, r, nr*sizeof(initr[0]));
 
-       if(trace) werrstr("s.loc 0x%lx pc 0x%lx", s.loc, pc);
+       if(trace) werrstr("s.loc 0x%lux pc 0x%lux\n", s.loc, pc);
        while(s.loc < pc){
-               if(trace) werrstr("s.loc 0x%lx pc 0x%lx", s.loc, pc);
+               if(trace) werrstr("s.loc 0x%lux pc 0x%lux\n", s.loc, pc);
                if(dexec(&fde, &s, 1) < 0)
                        goto err;
        }
@@ -140,16 +139,15 @@ findfde(Dwarf *d, ulong pc, State *s, DwarfBuf *fde)
                id = dwarfget4(&b);
                if(id == 0xFFFFFFFF){   /* CIE */
                        vers = dwarfget1(&b);
-                       if (trace) werrstr("CIE len %x id %x vers %x", len, id, vers);
                        if(vers != 1 && vers != 2 && vers != 3){
                                if(++nbad == 1)
-                                       werrstr("unknown cie version %d (wanted 1-3)", vers);
+                                       werrstr("unknown cie version %d (wanted 1-3)\n", vers);
                                continue;
                        }
                        aug = dwarfgetstring(&b);
                        if(aug && *aug){
                                if(++nbad == 1)
-                                       werrstr("unknown augmentation: %s", aug);
+                                       werrstr("unknown augmentation: %s\n", aug);
                                continue;
                        }
                        s->iquantum = dwarfget128(&b);
@@ -165,7 +163,6 @@ findfde(Dwarf *d, ulong pc, State *s, DwarfBuf *fde)
                }else{  /* FDE */
                        base = dwarfgetaddr(&b);
                        size = dwarfgetaddr(&b);
-            if (trace) werrstr("FDE: base %x-%x (want pc %x)", base, base+size, pc);
                        fde->p = b.p;
                        fde->ep = next;
                        s->loc = base;
@@ -174,7 +171,7 @@ findfde(Dwarf *d, ulong pc, State *s, DwarfBuf *fde)
                                return 0;
                }
        }
-       werrstr("cannot find call frame information for pc 0x%lx", pc);
+       werrstr("cannot find call frame information for pc 0x%lux", pc);
        return -1;
 
 }
@@ -183,7 +180,7 @@ static int
 checkreg(State *s, long r)
 {
        if(r < 0 || r >= s->nr){
-               werrstr("bad register number 0x%lx", r);
+               werrstr("bad register number 0x%lux", r);
                return -1;
        }
        return 0;
@@ -200,21 +197,20 @@ dexec(DwarfBuf *b, State *s, int locstop)
                if(b->p == b->ep){
                        if(s->initr)
                                s->loc = s->endloc;
-            werrstr("end dexec");
                        return 0;
                }
                c = dwarfget1(b);
                if(b->p == nil){
                        werrstr("ran out of instructions during cfa program");
-                       if(trace) werrstr("%r");
+                       if(trace) werrstr("%r\n");
                        return -1;
                }
-               if(trace) werrstr("+ loc=0x%x op 0x%x ", s->loc, c);
+               if(trace) werrstr("+ loc=0x%lux op 0x%ux ", s->loc, c);
                switch(c>>6){
                case 1: /* advance location */
                        arg1 = c&0x3F;
                advance:
-                       if(trace) werrstr("loc += %ld", arg1*s->iquantum);
+                       if(trace) werrstr("loc += %ld\n", arg1*s->iquantum);
                        s->loc += arg1 * s->iquantum;
                        if(locstop)
                                return 0;
@@ -224,7 +220,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                        arg1 = c&0x3F;
                        arg2 = dwarfget128(b);
                offset:
-                       if(trace) werrstr("r%ld += %ld", arg1, arg2*s->dquantum);
+                       if(trace) werrstr("r%ld += %ld\n", arg1, arg2*s->dquantum);
                        if(checkreg(s, arg1) < 0)
                                return -1;
                        s->r[arg1].type = RuleCfaOffset;
@@ -234,7 +230,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                case 3: /* restore initial setting */
                        arg1 = c&0x3F;
                restore:
-                       if(trace) werrstr("r%ld = init", arg1);
+                       if(trace) werrstr("r%ld = init\n", arg1);
                        if(checkreg(s, arg1) < 0)
                                return -1;
                        s->r[arg1] = s->initr[arg1];
@@ -243,12 +239,12 @@ dexec(DwarfBuf *b, State *s, int locstop)
 
                switch(c){
                case 0: /* nop */
-                       if(trace) werrstr("nop");
+                       if(trace) werrstr("nop\n");
                        continue;
 
                case 0x01:      /* set location */
                        s->loc = dwarfgetaddr(b);
-                       if(trace) werrstr("loc = 0x%lx", s->loc);
+                       if(trace) werrstr("loc = 0x%lux\n", s->loc);
                        if(locstop)
                                return 0;
                        continue;
@@ -276,7 +272,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
 
                case 0x07:      /* undefined */
                        arg1 = dwarfget128(b);
-                       if(trace) werrstr("r%ld = undef", arg1);
+                       if(trace) werrstr("r%ld = undef\n", arg1);
                        if(checkreg(s, arg1) < 0)
                                return -1;
                        s->r[arg1].type = RuleUndef;
@@ -284,7 +280,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
 
                case 0x08:      /* same value */
                        arg1 = dwarfget128(b);
-                       if(trace) werrstr("r%ld = same", arg1);
+                       if(trace) werrstr("r%ld = same\n", arg1);
                        if(checkreg(s, arg1) < 0)
                                return -1;
                        s->r[arg1].type = RuleSame;
@@ -293,7 +289,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                case 0x09:      /* register */
                        arg1 = dwarfget128(b);
                        arg2 = dwarfget128(b);
-                       if(trace) werrstr("r%ld = r%ld", arg1, arg2);
+                       if(trace) werrstr("r%ld = r%ld\n", arg1, arg2);
                        if(checkreg(s, arg1) < 0 || checkreg(s, arg2) < 0)
                                return -1;
                        s->r[arg1].type = RuleRegister;
@@ -302,7 +298,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
 
                case 0x0A:      /* remember state */
                        e = malloc(s->nr*sizeof(e[0]));
-                       if(trace) werrstr("push");
+                       if(trace) werrstr("push\n");
                        if(e == nil)
                                return -1;
                        void *newstack = malloc(s->nstack*sizeof(s->stack[0]));
@@ -323,7 +319,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                        continue;
 
                case 0x0B:      /* restore state */
-                       if(trace) werrstr("pop");
+                       if(trace) werrstr("pop\n");
                        if(s->nstack == 0){
                                werrstr("restore state underflow");
                                return -1;
@@ -338,7 +334,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                        arg1 = dwarfget128(b);
                        arg2 = dwarfget128(b);
                defcfa:
-                       if(trace) werrstr("cfa %ld(r%ld)", arg2, arg1);
+                       if(trace) werrstr("cfa %ld(r%ld)\n", arg2, arg1);
                        if(checkreg(s, arg1) < 0)
                                return -1;
                        s->cfa->type = RuleRegOff;
@@ -348,7 +344,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
 
                case 0x0D:      /* def cfa register */
                        arg1 = dwarfget128(b);
-                       if(trace) werrstr("cfa reg r%ld", arg1);
+                       if(trace) werrstr("cfa reg r%ld\n", arg1);
                        if(s->cfa->type != RuleRegOff){
                                werrstr("change CFA register but CFA not in register+offset form");
                                return -1;
@@ -361,7 +357,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                case 0x0E:      /* def cfa offset */
                        arg1 = dwarfget128(b);
                cfaoffset:
-                       if(trace) werrstr("cfa off %ld", arg1);
+                       if(trace) werrstr("cfa off %ld\n", arg1);
                        if(s->cfa->type != RuleRegOff){
                                werrstr("change CFA offset but CFA not in register+offset form");
                                return -1;
@@ -370,7 +366,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
                        continue;
 
                case 0x0F:      /* def cfa expression */
-                       if(trace) werrstr("cfa expr");
+                       if(trace) werrstr("cfa expr\n");
                        s->cfa->type = RuleLocation;
                        s->cfa->loc.len = dwarfget128(b);
                        s->cfa->loc.data = dwarfgetnref(b, s->cfa->loc.len);
@@ -378,7 +374,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
 
                case 0x10:      /* def reg expression */
                        arg1 = dwarfget128(b);
-                       if(trace) werrstr("reg expr r%ld", arg1);
+                       if(trace) werrstr("reg expr r%ld\n", arg1);
                        if(checkreg(s, arg1) < 0)
                                return -1;
                        s->r[arg1].type = RuleLocation;
@@ -401,98 +397,11 @@ dexec(DwarfBuf *b, State *s, int locstop)
                        goto cfaoffset;
 
                default:        /* unknown */
-                       werrstr("unknown opcode 0x%x in cfa program", c);
+                       werrstr("unknown opcode 0x%ux in cfa program", c);
                        return -1;
                }
        }
        /* not reached */
 }
 
-int dwarfcomputecfa(Dwarf *d, DwarfExpr *cfa, PROSSYM_REGISTERS registers, ulong *cfaLocation)
-{
-    switch (cfa->type) {
-    case RuleRegOff:
-        *cfaLocation = registers->Registers[cfa->reg] + cfa->offset;
-        werrstr("cfa reg %d (%x) offset %x = %x", cfa->reg, (ulong)registers->Registers[cfa->reg], cfa->offset, cfaLocation);
-        break;
-    default:
-        werrstr("cfa->type %x", cfa->type);
-        return -1;
-    }
-
-    return 0;
-}
 
-int dwarfregunwind(Dwarf *d, ulong pc, ulong fde, DwarfExpr *cfa, PROSSYM_REGISTERS registers)
-{
-       int i;
-       State s = { };
-       DwarfExpr initr[sizeof(registers->Registers) / sizeof(registers->Registers[0])] = { };
-       DwarfExpr r[sizeof(registers->Registers) / sizeof(registers->Registers[0])] = { };
-    DwarfExpr ra;
-
-       int nr = s.nr = sizeof(registers->Registers) / sizeof(registers->Registers[0]);
-       s.initr = initr;
-       s.r = r;
-       for (i = 0; i < sizeof(r) / sizeof(r[0]); i++) {
-               r[i].type = RuleRegister;
-               r[i].offset = registers->Registers[i];
-               r[i].reg = i;
-       }
-
-    int res = dwarfunwind(d, pc, cfa, &ra, initr, sizeof(initr) / sizeof(initr[0]));
-    if (res == -1) return -1;
-
-    ulong cfaLocation;
-
-    if (dwarfcomputecfa(d, cfa, registers, &cfaLocation) == -1)
-        return -1;
-
-    for (i = 0; i < nr; i++) {
-        switch (r[i].type) {
-        case RuleUndef:
-            werrstr("Undefined register slot %d", i);
-            assert(FALSE);
-            break;
-        case RuleSame:
-            break;
-        case RuleRegister:
-            registers->Registers[i] = registers->Registers[r[i].reg];
-            break;
-        case RuleRegOff: {
-            BOOLEAN success = 
-                RosSymCallbacks.MemGetProc
-                (d->pe->fd, 
-                 &registers->Registers[i],
-                 r[i].offset + registers->Registers[r[i].reg],
-                 d->addrsize);            
-            if (!success) return -1;
-        } break;
-        case RuleCfaOffset:
-        {
-            BOOLEAN success = 
-                RosSymCallbacks.MemGetProc
-                (d->pe->fd, 
-                 &registers->Registers[i],
-                 r[i].offset + cfaLocation,
-                 d->addrsize);
-            werrstr("reg[%d] = %x: cfa offset (cfa %x, offset %x) -> @%x", i, (ulong)registers->Registers[i], cfaLocation, initr[i].offset, r[i].offset + cfaLocation);
-            if (!success) return -1;
-        } break;
-        default:
-            werrstr("We don't yet support cfa rule %d in slot %d", r[i].type, i);
-            assert(FALSE);
-            break;
-        }
-    }
-
-    ulong cfaSpace[4];
-    for (i = 0; i < sizeof(cfaSpace) / sizeof(cfaSpace[0]); i++) {
-        RosSymCallbacks.MemGetProc
-            (d->pe->fd, &cfaSpace[i], cfaLocation + (i * 4), d->addrsize);
-    }
-    werrstr("CFA(%x) [%08x, %08x, %08x, %08x]", 
-            cfaLocation, cfaSpace[0], cfaSpace[1], cfaSpace[2], cfaSpace[3]);
-
-    return 0;
-}
index 7787163..d32177c 100644 (file)
@@ -139,7 +139,7 @@ dwarfgetaddr(DwarfBuf *b)
                return dwarfget8(b);
        default:
                if(++nbad == 1)
-                       werrstr("dwarf: unexpected address size %lud in dwarfgetaddr", b->addrsize);
+                       werrstr("dwarf: unexpected address size %lud in dwarfgetaddr\n", b->addrsize);
                b->p = nil;
                return 0;
        }
@@ -190,7 +190,7 @@ dwarfget128(DwarfBuf *b)
        while(b->p<b->ep && *b->p&0x80)
                b->p++;
        if(++nbad == 1)
-               werrstr("dwarf: overflow during parsing of uleb128 integer");
+               werrstr("dwarf: overflow during parsing of uleb128 integer\n");
        return c;
 }
 
index 397702f..cc25499 100644 (file)
 #include <debug.h>
 
 #include "dwarf.h"
-#include "pe.h"
 #include <windef.h>
 
 enum
 {
-    DwarfAttrSibling = 0x01,
-    DwarfAttrLocation = 0x02,
-    DwarfAttrName = 0x03,
-    DwarfAttrOrdering = 0x09,
-    DwarfAttrByteSize = 0x0B,
-    DwarfAttrBitOffset = 0x0C,
-    DwarfAttrBitSize = 0x0D,
-    DwarfAttrStmtList = 0x10,
-    DwarfAttrLowpc = 0x11,
-    DwarfAttrHighpc = 0x12,
-    DwarfAttrLanguage = 0x13,
-    DwarfAttrDiscr = 0x15,
-    DwarfAttrDiscrValue = 0x16,
-    DwarfAttrVisibility = 0x17,
-    DwarfAttrImport = 0x18,
-    DwarfAttrStringLength = 0x19,
-    DwarfAttrCommonRef = 0x1A,
-    DwarfAttrCompDir = 0x1B,
-    DwarfAttrConstValue = 0x1C,
-    DwarfAttrContainingType = 0x1D,
-    DwarfAttrDefaultValue = 0x1E,
-    DwarfAttrInline = 0x20,
-    DwarfAttrIsOptional = 0x21,
-    DwarfAttrLowerBound = 0x22,
-    DwarfAttrProducer = 0x25,
-    DwarfAttrPrototyped = 0x27,
-    DwarfAttrReturnAddr = 0x2A,
-    DwarfAttrStartScope = 0x2C,
-    DwarfAttrStrideSize = 0x2E,
-    DwarfAttrUpperBound = 0x2F,
-    DwarfAttrAbstractOrigin = 0x31,
-    DwarfAttrAccessibility = 0x32,
-    DwarfAttrAddrClass = 0x33,
-    DwarfAttrArtificial = 0x34,
-    DwarfAttrBaseTypes = 0x35,
-    DwarfAttrCalling = 0x36,
-    DwarfAttrCount = 0x37,
-    DwarfAttrDataMemberLoc = 0x38,
-    DwarfAttrDeclColumn = 0x39,
-    DwarfAttrDeclFile = 0x3A,
-    DwarfAttrDeclLine = 0x3B,
-    DwarfAttrDeclaration = 0x3C,
-    DwarfAttrDiscrList = 0x3D,
-    DwarfAttrEncoding = 0x3E,
-    DwarfAttrExternal = 0x3F,
-    DwarfAttrFrameBase = 0x40,
-    DwarfAttrFriend = 0x41,
-    DwarfAttrIdentifierCase = 0x42,
-    DwarfAttrMacroInfo = 0x43,
-    DwarfAttrNamelistItem = 0x44,
-    DwarfAttrPriority = 0x45,
-    DwarfAttrSegment = 0x46,
-    DwarfAttrSpecification = 0x47,
-    DwarfAttrStaticLink = 0x48,
-    DwarfAttrType = 0x49,
-    DwarfAttrUseLocation = 0x4A,
-    DwarfAttrVarParam = 0x4B,
-    DwarfAttrVirtuality = 0x4C,
-    DwarfAttrVtableElemLoc = 0x4D,
-    DwarfAttrAllocated = 0x4E,
-    DwarfAttrAssociated = 0x4F,
-    DwarfAttrDataLocation = 0x50,
-    DwarfAttrStride = 0x51,
-    DwarfAttrEntrypc = 0x52,
-    DwarfAttrUseUTF8 = 0x53,
-    DwarfAttrExtension = 0x54,
-    DwarfAttrRanges = 0x55,
-    DwarfAttrTrampoline = 0x56,
-    DwarfAttrCallColumn = 0x57,
-    DwarfAttrCallFile = 0x58,
-    DwarfAttrCallLine = 0x59,
-    DwarfAttrDescription = 0x5A,
-    DwarfAttrMax,
-
-    FormAddr = 0x01,
-    FormDwarfBlock2 = 0x03,
-    FormDwarfBlock4 = 0x04,
-    FormData2 = 0x05,
-    FormData4 = 0x06,
-    FormData8 = 0x07,
-    FormString = 0x08,
-    FormDwarfBlock = 0x09,
-    FormDwarfBlock1 = 0x0A,
-    FormData1 = 0x0B,
-    FormFlag = 0x0C,
-    FormSdata = 0x0D,
-    FormStrp = 0x0E,
-    FormUdata = 0x0F,
-    FormRefAddr = 0x10,
-    FormRef1 = 0x11,
-    FormRef2 = 0x12,
-    FormRef4 = 0x13,
-    FormRef8 = 0x14,
-    FormRefUdata = 0x15,
-    FormIndirect = 0x16
+       DwarfAttrSibling = 0x01,
+       DwarfAttrLocation = 0x02,
+       DwarfAttrName = 0x03,
+       DwarfAttrOrdering = 0x09,
+       DwarfAttrByteSize = 0x0B,
+       DwarfAttrBitOffset = 0x0C,
+       DwarfAttrBitSize = 0x0D,
+       DwarfAttrStmtList = 0x10,
+       DwarfAttrLowpc = 0x11,
+       DwarfAttrHighpc = 0x12,
+       DwarfAttrLanguage = 0x13,
+       DwarfAttrDiscr = 0x15,
+       DwarfAttrDiscrValue = 0x16,
+       DwarfAttrVisibility = 0x17,
+       DwarfAttrImport = 0x18,
+       DwarfAttrStringLength = 0x19,
+       DwarfAttrCommonRef = 0x1A,
+       DwarfAttrCompDir = 0x1B,
+       DwarfAttrConstValue = 0x1C,
+       DwarfAttrContainingType = 0x1D,
+       DwarfAttrDefaultValue = 0x1E,
+       DwarfAttrInline = 0x20,
+       DwarfAttrIsOptional = 0x21,
+       DwarfAttrLowerBound = 0x22,
+       DwarfAttrProducer = 0x25,
+       DwarfAttrPrototyped = 0x27,
+       DwarfAttrReturnAddr = 0x2A,
+       DwarfAttrStartScope = 0x2C,
+       DwarfAttrStrideSize = 0x2E,
+       DwarfAttrUpperBound = 0x2F,
+       DwarfAttrAbstractOrigin = 0x31,
+       DwarfAttrAccessibility = 0x32,
+       DwarfAttrAddrClass = 0x33,
+       DwarfAttrArtificial = 0x34,
+       DwarfAttrBaseTypes = 0x35,
+       DwarfAttrCalling = 0x36,
+       DwarfAttrCount = 0x37,
+       DwarfAttrDataMemberLoc = 0x38,
+       DwarfAttrDeclColumn = 0x39,
+       DwarfAttrDeclFile = 0x3A,
+       DwarfAttrDeclLine = 0x3B,
+       DwarfAttrDeclaration = 0x3C,
+       DwarfAttrDiscrList = 0x3D,
+       DwarfAttrEncoding = 0x3E,
+       DwarfAttrExternal = 0x3F,
+       DwarfAttrFrameBase = 0x40,
+       DwarfAttrFriend = 0x41,
+       DwarfAttrIdentifierCase = 0x42,
+       DwarfAttrMacroInfo = 0x43,
+       DwarfAttrNamelistItem = 0x44,
+       DwarfAttrPriority = 0x45,
+       DwarfAttrSegment = 0x46,
+       DwarfAttrSpecification = 0x47,
+       DwarfAttrStaticLink = 0x48,
+       DwarfAttrType = 0x49,
+       DwarfAttrUseLocation = 0x4A,
+       DwarfAttrVarParam = 0x4B,
+       DwarfAttrVirtuality = 0x4C,
+       DwarfAttrVtableElemLoc = 0x4D,
+       DwarfAttrAllocated = 0x4E,
+       DwarfAttrAssociated = 0x4F,
+       DwarfAttrDataLocation = 0x50,
+       DwarfAttrStride = 0x51,
+       DwarfAttrEntrypc = 0x52,
+       DwarfAttrUseUTF8 = 0x53,
+       DwarfAttrExtension = 0x54,
+       DwarfAttrRanges = 0x55,
+       DwarfAttrTrampoline = 0x56,
+       DwarfAttrCallColumn = 0x57,
+       DwarfAttrCallFile = 0x58,
+       DwarfAttrCallLine = 0x59,
+       DwarfAttrDescription = 0x5A,
+       DwarfAttrMax,
+
+       FormAddr = 0x01,
+       FormDwarfBlock2 = 0x03,
+       FormDwarfBlock4 = 0x04,
+       FormData2 = 0x05,
+       FormData4 = 0x06,
+       FormData8 = 0x07,
+       FormString = 0x08,
+       FormDwarfBlock = 0x09,
+       FormDwarfBlock1 = 0x0A,
+       FormData1 = 0x0B,
+       FormFlag = 0x0C,
+       FormSdata = 0x0D,
+       FormStrp = 0x0E,
+       FormUdata = 0x0F,
+       FormRefAddr = 0x10,
+       FormRef1 = 0x11,
+       FormRef2 = 0x12,
+       FormRef4 = 0x13,
+       FormRef8 = 0x14,
+       FormRefUdata = 0x15,
+       FormIndirect = 0x16
 };
 
-static int parseattrs(Dwarf *d, DwarfBuf*, ulong, ulong, DwarfAbbrev*, DwarfAttrs*);
+static int parseattrs(DwarfBuf*, ulong, DwarfAbbrev*, DwarfAttrs*);
 static int getulong(DwarfBuf*, int, ulong, ulong*, int*);
 static int getuchar(DwarfBuf*, int, uchar*);
-static int getstring(Dwarf *d, DwarfBuf*, int, char**);
+static int getstring(DwarfBuf*, int, char**);
 static int getblock(DwarfBuf*, int, DwarfBlock*);
-static int skipform(Dwarf *d, DwarfBuf*, int);
+static int skipform(DwarfBuf*, int);
+static int constblock(Dwarf*, DwarfBlock*, ulong*);
 
 int
 dwarflookupnameinunit(Dwarf *d, ulong unit, char *name, DwarfSym *s)
 {
-    DwarfSym compunit = { };
-    if(dwarfenumunit(d, unit, &compunit) < 0)
-        return -1;
-    while(dwarfnextsymat(d, &compunit, s) == 1)
-        if(s->attrs.name && strcmp(s->attrs.name, name) == 0)
-            return 0;
-    werrstr("symbol '%s' not found", name);
-    return -1;
+       if(dwarfenumunit(d, unit, s) < 0)
+               return -1;
+
+       dwarfnextsymat(d, s, 0);        /* s is now the CompileUnit */
+       while(dwarfnextsymat(d, s, 1) == 1)
+               if(s->attrs.name && strcmp(s->attrs.name, name) == 0)
+                       return 0;
+       werrstr("symbol '%s' not found", name);
+       return -1;
 }
+       
 
 int
 dwarflookupsubname(Dwarf *d, DwarfSym *parent, char *name, DwarfSym *s)
 {
-    *s = *parent;
-    while(dwarfnextsymat(d, parent, s))
-        if(s->attrs.name && strcmp(s->attrs.name, name) == 0)
-            return 0;
-    werrstr("symbol '%s' not found", name);
-    return -1;
-}
-
-int
-dwarflookupchildtag(Dwarf *d, DwarfSym *parent, ulong tag, DwarfSym *s)
-{
-    int rsym = dwarfnextsymat(d, parent, s);
-    while (rsym == 0 && s->attrs.tag != tag) {
-        if (s->attrs.haskids) {
-            DwarfSym p = *s;
-            int csym = dwarflookupchildtag(d, &p, tag, s);
-            if (csym == 0) {
-                return csym;
-            }
-        }
-        rsym = dwarfnextsym(d, s);
-    }
-    return rsym;
+       *s = *parent;
+       while(dwarfnextsymat(d, s, parent->depth+1))
+               if(s->attrs.name && strcmp(s->attrs.name, name) == 0)
+                       return 0;
+       werrstr("symbol '%s' not found", name);
+       return -1;
 }
 
 int
 dwarflookuptag(Dwarf *d, ulong unit, ulong tag, DwarfSym *s)
 {
-    DwarfSym compunit = { };
-    if (dwarfenumunit(d, unit, &compunit) < 0) {
-        return -1;
-    }
-    do {
-        if (compunit.attrs.tag == tag) {
-            *s = compunit;
-            return 0;
-        }
-        if (dwarflookupchildtag(d, &compunit, tag, s) == 0)
-            return 0;
-    } while(dwarfnextsym(d, &compunit) == 0);
-    werrstr("symbol with tag 0x%lux not found", tag);
-    return -1;
+       if(dwarfenumunit(d, unit, s) < 0) {
+               return -1;
+       }
+
+       dwarfnextsymat(d, s, 0);        /* s is now the CompileUnit */
+       if(s->attrs.tag == tag) {
+               return 0;
+       }
+       while(dwarfnextsymat(d, s, 1) == 1)
+               if(s->attrs.tag == tag) {
+                       return 0;
+               }
+       werrstr("symbol with tag 0x%lux not found", tag);
+       return -1;
 }
 
 int
 dwarfseeksym(Dwarf *d, ulong unit, ulong off, DwarfSym *s)
 {
-    DwarfSym compunit = { };
-    if(dwarfenumunit(d, unit, &compunit) < 0)
-        return -1;
-    s->b.p = d->info.data + unit + off;
-    if(dwarfnextsymat(d, &compunit, s) == -1)
-        return -1;
-    werrstr("dwarfseeksym: unit %x off %x, tag %x", unit, off, s->attrs.tag);
-    return 0;
+       if(dwarfenumunit(d, unit, s) < 0)
+               return -1;
+       s->b.p = d->info.data + unit + off;
+       if(dwarfnextsymat(d, s, 0) != 1)
+               return -1;
+       return 0;
 }
 
 int
 dwarflookupfn(Dwarf *d, ulong unit, ulong pc, DwarfSym *s)
 {
-    DwarfSym compunit = { };
-    if(dwarfenumunit(d, unit, &compunit) < 0)
-        return -1;
-    while(dwarfnextsymat(d, &compunit, s) == 0){
-        if(s->attrs.tag != TagSubprogram)
-            continue;
-        if(s->attrs.lowpc <= pc && pc < s->attrs.highpc)
-            return 0;
-    }
-    werrstr("fn containing pc 0x%lux not found", pc);
-    return -1;
+       if(dwarfenumunit(d, unit, s) < 0)
+               return -1;
+
+       if(dwarfnextsymat(d, s, 0) != 1)
+               return -1;
+       /* s is now the CompileUnit */
+
+       while(dwarfnextsymat(d, s, 1) == 1){
+               if(s->attrs.tag != TagSubprogram)
+                       continue;
+               if(s->attrs.lowpc <= pc && pc < s->attrs.highpc)
+                       return 0;
+       } 
+       werrstr("fn containing pc 0x%lux not found", pc);
+       return -1;
 }
 
 int
 dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
 {
-    int i;
-    ulong aoff, len;
-
-    if(unit >= d->info.len){
-        werrstr("dwarf unit address 0x%x >= 0x%x out of range", unit, d->info.len);
-        return -1;
-    }
-    memset(s, 0, sizeof *s);
-    memset(&s->b, 0, sizeof s->b);
-
-    s->b.d = d;
-    s->b.p = d->info.data + unit;
-    s->b.ep = d->info.data + d->info.len;
-    len = dwarfget4(&s->b);
+       int i;
+       ulong aoff, len;
+
+       if(unit >= d->info.len){
+               werrstr("dwarf unit address 0x%x >= 0x%x out of range", unit, d->info.len);
+               return -1;
+       }
+       memset(s, 0, sizeof *s);
+       memset(&s->b, 0, sizeof s->b);
+
+       s->b.d = d;
+       s->b.p = d->info.data + unit;
+       s->b.ep = d->info.data + d->info.len;
+       len = dwarfget4(&s->b);
+       s->nextunit = unit + 4 + len;
+
+       if(s->b.ep - s->b.p < len){
+       badheader:
+               werrstr("bad dwarf unit header at unit 0x%lux", unit);
+               return -1;
+       }
+       s->b.ep = s->b.p+len;
+       if((i=dwarfget2(&s->b)) != 2)
+               goto badheader;
+       aoff = dwarfget4(&s->b);
+       s->b.addrsize = dwarfget1(&s->b);
+       if(d->addrsize == 0)
+               d->addrsize = s->b.addrsize;
+       if(s->b.p == nil)
+               goto badheader;
+
+       s->aoff = aoff;
        s->unit = unit;
-    s->nextunit = unit + 4 + len;
-    s->b.ep = d->info.data + s->nextunit;
-
-    if(s->b.ep - s->b.p < len){
-    badheader:
-        werrstr("bad dwarf unit header at unit 0x%lux end %x start %x len %x", unit, s->b.ep - d->info.data, s->b.p - d->info.data, len);
-        return -1;
-    }
-    s->b.ep = s->b.p+len;
-    if((i=dwarfget2(&s->b)) != 2)
-        goto badheader;
-    aoff = dwarfget4(&s->b);
-    s->b.addrsize = dwarfget1(&s->b);
-    if(d->addrsize == 0)
-        d->addrsize = s->b.addrsize;
-    if(s->b.p == nil)
-        goto badheader;
-
-    s->aoff = aoff;
-
-    return dwarfnextsym(d, s);
+       s->depth = 0;
+       return 0;
+}
+
+int
+dwarfenum(Dwarf *d, DwarfSym *s)
+{
+       if(dwarfenumunit(d, 0, s) < 0)
+               return -1;
+       s->allunits = 1;
+       return 0;
 }
 
 int
 dwarfnextsym(Dwarf *d, DwarfSym *s)
 {
-    ulong num;
-    DwarfAbbrev *a;
-
-    num = dwarfget128(&s->b);
-    s->num = num;
-    if(num == 0){
-        return -1;
-    }
-
-    a = dwarfgetabbrev(d, s->aoff, num);
-    if(a == nil){
-        werrstr("getabbrev %ud %ud for %ud,%ud", s->aoff, num, s->unit);
-        return -1;
-    }
-
-    if(parseattrs(d, &s->b, s->attrs.tag, s->unit, a, &s->attrs) < 0) {
-        return -1;
-    }
-
-    if (s->attrs.haskids) {
-        DwarfSym childSkip = { };
-        s->childoff = s->b.p - d->info.data;
-        int r = dwarfnextsymat(d, s, &childSkip);
-        while (r == 0) {
-            r = dwarfnextsym(d, &childSkip);
-        }
-        s->b = childSkip.b;
-    } else {
-        s->childoff = 0;
-    }
-    return 0;
+       ulong num;
+       DwarfAbbrev *a;
+
+       if(s->attrs.haskids)
+               s->depth++;
+top:
+       if(s->b.p >= s->b.ep){
+               if(s->allunits && s->nextunit < d->info.len){
+                       if(dwarfenumunit(d, s->nextunit, s) < 0) {
+                               return -1;
+                       }
+                       s->allunits = 1;
+                       goto top;
+               }
+               return 0;
+       }
+
+       s->uoff = s->b.p - (d->info.data+s->unit);
+       num = dwarfget128(&s->b);
+       if(num == 0){
+               if(s->depth == 0) {
+                       return 0;
+               }
+               if(s->depth > 0)
+                       s->depth--;
+               goto top;
+       }
+
+       a = dwarfgetabbrev(d, s->aoff, num);
+       if(a == nil){
+               werrstr("getabbrev %ud %ud for %ud,%ud: %r\n", s->aoff, num, s->unit, s->uoff);
+               return -1;
+       }
+       if(parseattrs(&s->b, s->unit, a, &s->attrs) < 0) {
+               return -1;
+       }
+       return 1;
 }
 
 int
-dwarfnextsymat(Dwarf *d, DwarfSym *parent, DwarfSym *child)
+dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
 {
-    uint sib;
-
-    if (!parent->attrs.haskids || !parent->childoff)
-        return -1;
-
-       child->unit = parent->unit;
-    child->aoff = parent->aoff;
-    child->depth = parent->depth + 1;
-    if(child->attrs.have.sibling){
-        sib = child->attrs.sibling;
-        if(sib < d->info.len && d->info.data+sib > child->b.p)
-            child->b.p = d->info.data+sib;
-        else if (sib >= d->info.len) {
-            werrstr("sibling reported as out of bounds %d vs %d", sib, d->info.len);
-            return -1;
-        } else if (d->info.data+sib+parent->unit < child->b.p) {
-            werrstr("subsequent sibling is listed before prev %d vs %d", sib+parent->unit, child->b.p - d->info.data);
-            return -1;
-        }
-    }
-
-    // Uninitialized
-    if (!child->b.d) {
-        child->b = parent->b;
-        child->b.p = parent->childoff + parent->b.d->info.data;
-    }
-
-    return dwarfnextsym(d, child);
+       int r;
+       DwarfSym t;
+       uint sib;
+
+       if(s->depth == depth && s->attrs.have.sibling){
+               sib = s->attrs.sibling;
+               if(sib < d->info.len && d->info.data+sib >= s->b.p)
+                       s->b.p = d->info.data+sib;
+               s->attrs.haskids = 0;
+       }
+
+       /*
+        * The funny game with t and s make sure that 
+        * if we get to the end of a run of a particular
+        * depth, we leave s so that a call to nextsymat with depth-1
+        * will actually produce the desired guy.  We could change
+        * the interface to dwarfnextsym instead, but I'm scared 
+        * to touch it.
+        */
+       t = *s;
+       for(;;){
+               if((r = dwarfnextsym(d, &t)) != 1) {
+                       return r;
+               }
+               if(t.depth < depth){
+                       /* went too far - nothing to see */
+                       return 0;
+               }
+               *s = t;
+               if(t.depth == depth) {
+                       return 1;
+               }
+       }
 }
 
 typedef struct Parse Parse;
 struct Parse {
-    int name;
-    int off;
-    int haveoff;
-    int type;
+       int name;
+       int off;
+       int haveoff;
+       int type;
 };
 
 #define OFFSET(x) offsetof(DwarfAttrs, x), offsetof(DwarfAttrs, have.x)
 
 static Parse plist[] = {       /* Font Tab 4 */
-    { DwarfAttrAbstractOrigin, OFFSET(abstractorigin),         TReference },
-    { DwarfAttrAccessibility,  OFFSET(accessibility),          TConstant },
-    { DwarfAttrAddrClass,              OFFSET(addrclass),                      TConstant },
-    { DwarfAttrArtificial,             OFFSET(isartificial),           TFlag },
-    { DwarfAttrBaseTypes,              OFFSET(basetypes),                      TReference },
-    { DwarfAttrBitOffset,              OFFSET(bitoffset),                      TConstant },
-    { DwarfAttrBitSize,                OFFSET(bitsize),                        TConstant },
-    { DwarfAttrByteSize,               OFFSET(bytesize),                       TConstant },
-    { DwarfAttrCalling,                OFFSET(calling),                        TConstant },
-    { DwarfAttrCommonRef,              OFFSET(commonref),                      TReference },
-    { DwarfAttrCompDir,                OFFSET(compdir),                        TString },
-    { DwarfAttrConstValue,             OFFSET(constvalue),                     TString|TConstant|TBlock },
-    { DwarfAttrContainingType, OFFSET(containingtype),         TReference },
-    { DwarfAttrCount,                  OFFSET(count),                          TConstant|TReference },
-    { DwarfAttrDataMemberLoc,  OFFSET(datamemberloc),          TBlock|TConstant|TReference },
-    { DwarfAttrDeclColumn,             OFFSET(declcolumn),                     TConstant },
-    { DwarfAttrDeclFile,               OFFSET(declfile),                       TConstant },
-    { DwarfAttrDeclLine,               OFFSET(declline),                       TConstant },
-    { DwarfAttrDeclaration,    OFFSET(isdeclaration),          TFlag },
-    { DwarfAttrDefaultValue,   OFFSET(defaultvalue),           TReference },
-    { DwarfAttrDiscr,                  OFFSET(discr),                          TReference },
-    { DwarfAttrDiscrList,              OFFSET(discrlist),                      TBlock },
-    { DwarfAttrDiscrValue,             OFFSET(discrvalue),                     TConstant },
-    { DwarfAttrEncoding,               OFFSET(encoding),                       TConstant },
-    { DwarfAttrExternal,               OFFSET(isexternal),                     TFlag },
-    { DwarfAttrFrameBase,              OFFSET(framebase),                      TBlock|TConstant },
-    { DwarfAttrFriend,                 OFFSET(friend),                         TReference },
-    { DwarfAttrHighpc,                 OFFSET(highpc),                         TAddress },
-    { DwarfAttrEntrypc,         OFFSET(entrypc),            TAddress },
-    { DwarfAttrIdentifierCase, OFFSET(identifiercase),         TConstant },
-    { DwarfAttrImport,                 OFFSET(import),                         TReference },
-    { DwarfAttrInline,                 OFFSET(inlined),                        TConstant },
-    { DwarfAttrIsOptional,             OFFSET(isoptional),                     TFlag },
-    { DwarfAttrLanguage,               OFFSET(language),                       TConstant },
-    { DwarfAttrLocation,               OFFSET(location),                       TReference|TBlock },
-    { DwarfAttrLowerBound,             OFFSET(lowerbound),                     TConstant|TReference },
-    { DwarfAttrLowpc,                  OFFSET(lowpc),                          TAddress },
-    { DwarfAttrMacroInfo,              OFFSET(macroinfo),                      TConstant },
-    { DwarfAttrName,                   OFFSET(name),                           TString },
-    { DwarfAttrNamelistItem,   OFFSET(namelistitem),           TBlock },
-    { DwarfAttrOrdering,               OFFSET(ordering),                       TConstant },
-    { DwarfAttrPriority,               OFFSET(priority),                       TReference },
-    { DwarfAttrProducer,               OFFSET(producer),                       TString },
-    { DwarfAttrPrototyped,             OFFSET(isprototyped),           TFlag },
-    { DwarfAttrRanges,                 OFFSET(ranges),                         TReference },
-    { DwarfAttrReturnAddr,             OFFSET(returnaddr),                     TBlock|TConstant },
-    { DwarfAttrSegment,                OFFSET(segment),                        TBlock|TConstant },
-    { DwarfAttrSibling,                OFFSET(sibling),                        TReference },
-    { DwarfAttrSpecification,  OFFSET(specification),          TReference },
-    { DwarfAttrStartScope,             OFFSET(startscope),                     TConstant },
-    { DwarfAttrStaticLink,             OFFSET(staticlink),                     TBlock|TConstant },
-    { DwarfAttrStmtList,               OFFSET(stmtlist),                       TConstant },
-    { DwarfAttrStrideSize,             OFFSET(stridesize),                     TConstant },
-    { DwarfAttrStringLength,   OFFSET(stringlength),           TBlock|TConstant },
-    { DwarfAttrType,                   OFFSET(type),                           TReference },
-    { DwarfAttrUpperBound,             OFFSET(upperbound),                     TConstant|TReference },
-    { DwarfAttrUseLocation,    OFFSET(uselocation),            TBlock|TConstant },
-    { DwarfAttrVarParam,               OFFSET(isvarparam),                     TFlag },
-    { DwarfAttrVirtuality,             OFFSET(virtuality),                     TConstant },
-    { DwarfAttrVisibility,             OFFSET(visibility),                     TConstant },
-    { DwarfAttrVtableElemLoc,  OFFSET(vtableelemloc),          TBlock|TReference },
-    { }
+       { DwarfAttrAbstractOrigin,      OFFSET(abstractorigin),         TReference },
+       { DwarfAttrAccessibility,       OFFSET(accessibility),          TConstant },
+       { DwarfAttrAddrClass,           OFFSET(addrclass),                      TConstant },
+       { DwarfAttrArtificial,          OFFSET(isartificial),           TFlag },
+       { DwarfAttrBaseTypes,           OFFSET(basetypes),                      TReference },
+       { DwarfAttrBitOffset,           OFFSET(bitoffset),                      TConstant },
+       { DwarfAttrBitSize,             OFFSET(bitsize),                        TConstant },
+       { DwarfAttrByteSize,            OFFSET(bytesize),                       TConstant },
+       { DwarfAttrCalling,             OFFSET(calling),                        TConstant },
+       { DwarfAttrCommonRef,           OFFSET(commonref),                      TReference },
+       { DwarfAttrCompDir,             OFFSET(compdir),                        TString },
+       { DwarfAttrConstValue,          OFFSET(constvalue),                     TString|TConstant|TBlock },
+       { DwarfAttrContainingType,      OFFSET(containingtype),         TReference },
+       { DwarfAttrCount,                       OFFSET(count),                          TConstant|TReference },
+       { DwarfAttrDataMemberLoc,       OFFSET(datamemberloc),          TBlock|TConstant|TReference },
+       { DwarfAttrDeclColumn,          OFFSET(declcolumn),                     TConstant },
+       { DwarfAttrDeclFile,            OFFSET(declfile),                       TConstant },
+       { DwarfAttrDeclLine,            OFFSET(declline),                       TConstant },
+       { DwarfAttrDeclaration, OFFSET(isdeclaration),          TFlag },
+       { DwarfAttrDefaultValue,        OFFSET(defaultvalue),           TReference },
+       { DwarfAttrDiscr,                       OFFSET(discr),                          TReference },
+       { DwarfAttrDiscrList,           OFFSET(discrlist),                      TBlock },
+       { DwarfAttrDiscrValue,          OFFSET(discrvalue),                     TConstant },
+       { DwarfAttrEncoding,            OFFSET(encoding),                       TConstant },
+       { DwarfAttrExternal,            OFFSET(isexternal),                     TFlag },
+       { DwarfAttrFrameBase,           OFFSET(framebase),                      TBlock|TConstant },
+       { DwarfAttrFriend,                      OFFSET(friend),                         TReference },
+       { DwarfAttrHighpc,                      OFFSET(highpc),                         TAddress },
+       { DwarfAttrEntrypc,         OFFSET(entrypc),            TAddress },
+       { DwarfAttrIdentifierCase,      OFFSET(identifiercase),         TConstant },
+       { DwarfAttrImport,                      OFFSET(import),                         TReference },
+       { DwarfAttrInline,                      OFFSET(inlined),                        TConstant },
+       { DwarfAttrIsOptional,          OFFSET(isoptional),                     TFlag },
+       { DwarfAttrLanguage,            OFFSET(language),                       TConstant },
+       { DwarfAttrLocation,            OFFSET(location),                       TBlock|TConstant },
+       { DwarfAttrLowerBound,          OFFSET(lowerbound),                     TConstant|TReference },
+       { DwarfAttrLowpc,                       OFFSET(lowpc),                          TAddress },
+       { DwarfAttrMacroInfo,           OFFSET(macroinfo),                      TConstant },
+       { DwarfAttrName,                        OFFSET(name),                           TString },
+       { DwarfAttrNamelistItem,        OFFSET(namelistitem),           TBlock },
+       { DwarfAttrOrdering,            OFFSET(ordering),                       TConstant },
+       { DwarfAttrPriority,            OFFSET(priority),                       TReference },
+       { DwarfAttrProducer,            OFFSET(producer),                       TString },
+       { DwarfAttrPrototyped,          OFFSET(isprototyped),           TFlag },
+       { DwarfAttrRanges,                      OFFSET(ranges),                         TReference },
+       { DwarfAttrReturnAddr,          OFFSET(returnaddr),                     TBlock|TConstant },
+       { DwarfAttrSegment,             OFFSET(segment),                        TBlock|TConstant },
+       { DwarfAttrSibling,             OFFSET(sibling),                        TReference },
+       { DwarfAttrSpecification,       OFFSET(specification),          TReference },
+       { DwarfAttrStartScope,          OFFSET(startscope),                     TConstant },
+       { DwarfAttrStaticLink,          OFFSET(staticlink),                     TBlock|TConstant },
+       { DwarfAttrStmtList,            OFFSET(stmtlist),                       TConstant },
+       { DwarfAttrStrideSize,          OFFSET(stridesize),                     TConstant },
+       { DwarfAttrStringLength,        OFFSET(stringlength),           TBlock|TConstant },
+       { DwarfAttrType,                        OFFSET(type),                           TReference },
+       { DwarfAttrUpperBound,          OFFSET(upperbound),                     TConstant|TReference },
+       { DwarfAttrUseLocation, OFFSET(uselocation),            TBlock|TConstant },
+       { DwarfAttrVarParam,            OFFSET(isvarparam),                     TFlag },
+       { DwarfAttrVirtuality,          OFFSET(virtuality),                     TConstant },
+       { DwarfAttrVisibility,          OFFSET(visibility),                     TConstant },
+       { DwarfAttrVtableElemLoc,       OFFSET(vtableelemloc),          TBlock|TReference },
+       { }
 };
 
 static Parse ptab[DwarfAttrMax];
 
 static int
-parseattrs(Dwarf *d, DwarfBuf *b, ulong tag, ulong unit, DwarfAbbrev *a, DwarfAttrs *attrs)
+parseattrs(DwarfBuf *b, ulong unit, DwarfAbbrev *a, DwarfAttrs *attrs)
 {
-    int i, f, n, got;
-    static int nbad;
-    void *v;
-
-    /* initialize ptab first time through for quick access */
-    if(ptab[DwarfAttrName].name != DwarfAttrName)
-        for(i=0; plist[i].name; i++)
-            ptab[plist[i].name] = plist[i];
-
-    memset(attrs, 0, sizeof *attrs);
-    attrs->tag = a->tag;
-    attrs->haskids = a->haskids;
-
-    for(i=0; i<a->nattr; i++){
-        n = a->attr[i].name;
-        f = a->attr[i].form;
-        if(n < 0 || n >= DwarfAttrMax || ptab[n].name==0) {
-            if (skipform(d, b, f) < 0) {
-                if(++nbad == 1)
-                    werrstr("dwarf parse attrs: cannot skip form %d", f);
-                return -1;
-            }
-            continue;
-        }
-        v = (char*)attrs + ptab[n].off;
-        got = 0;
-        if(f == FormIndirect)
-            f = dwarfget128(b);
-        if((ptab[n].type&(TConstant|TReference|TAddress))
-           && getulong(b, f, unit, v, &got) >= 0)
-            ;
-        else if((ptab[n].type&TFlag) && getuchar(b, f, v) >= 0)
-            got = TFlag;
-        else if((ptab[n].type&TString) && getstring(d, b, f, v) >= 0)
-            got = TString;
-        else if((ptab[n].type&TBlock) && getblock(b, f, v) >= 0)
-            got = TBlock;
-        else {
-            if(skipform(d, b, f) < 0){
-                if(++nbad == 1)
-                    werrstr("dwarf parse attrs: cannot skip form %d", f);
-                return -1;
-            }
-        }
-#if 0
-        if(got == TBlock && (ptab[n].type&TConstant))
-            got = constblock(b->d, v, v);
-#endif
-        *((uchar*)attrs+ptab[n].haveoff) = got;
-    }
-    return 0;
+       int i, f, n, got;
+       static int nbad;
+       void *v;
+
+       /* initialize ptab first time through for quick access */
+       if(ptab[DwarfAttrName].name != DwarfAttrName)
+               for(i=0; plist[i].name; i++)
+                       ptab[plist[i].name] = plist[i];
+
+       memset(attrs, 0, sizeof *attrs);
+       attrs->tag = a->tag;
+       attrs->haskids = a->haskids;
+
+       for(i=0; i<a->nattr; i++){
+               n = a->attr[i].name;
+               f = a->attr[i].form;
+               if(n < 0 || n >= DwarfAttrMax || ptab[n].name==0){
+                       if(++nbad == 1)
+                               werrstr("dwarf parse attrs: unexpected attribute name 0x%x", n);
+                       continue; //return -1;
+               }
+               v = (char*)attrs + ptab[n].off;
+               got = 0;
+               if(f == FormIndirect)
+                       f = dwarfget128(b);
+               if((ptab[n].type&(TConstant|TReference|TAddress))
+               && getulong(b, f, unit, v, &got) >= 0)
+                       ;
+               else if((ptab[n].type&TFlag) && getuchar(b, f, v) >= 0)
+                       got = TFlag;
+               else if((ptab[n].type&TString) && getstring(b, f, v) >= 0)
+                       got = TString;
+               else if((ptab[n].type&TBlock) && getblock(b, f, v) >= 0)
+                       got = TBlock;
+               else{
+                       if(skipform(b, f) < 0){
+                               if(++nbad == 1)
+                                       werrstr("dwarf parse attrs: cannot skip form %d", f);
+                               return -1;
+                       }
+               }
+               if(got == TBlock && (ptab[n].type&TConstant))
+                       got = constblock(b->d, v, v);
+               *((uchar*)attrs+ptab[n].haveoff) = got;
+       }
+       return 0;
 }
 
 static int
 getulong(DwarfBuf *b, int form, ulong unit, ulong *u, int *type)
 {
-    static int nbad;
-    uvlong uv;
+       static int nbad;
+       uvlong uv;
 
-    switch(form){
-    default:
-        return -1;
+       switch(form){
+       default:
+               return -1;
 
        /* addresses */
-    case FormAddr:
-        *type = TAddress;
-        *u = dwarfgetaddr(b);
-        return 0;
+       case FormAddr:
+               *type = TAddress;
+               *u = dwarfgetaddr(b);
+               return 0;
 
        /* references */
-    case FormRefAddr:
-        /* absolute ref in .debug_info */
-        *type = TReference;
-        *u = dwarfgetaddr(b);
-        return 0;
-    case FormRef1:
-        *u = dwarfget1(b);
-        goto relativeref;
-    case FormRef2:
-        *u = dwarfget2(b);
-        goto relativeref;
-    case FormRef4:
-        *u = dwarfget4(b);
-        goto relativeref;
-    case FormRef8:
-        *u = dwarfget8(b);
-        goto relativeref;
-    case FormRefUdata:
-        *u = dwarfget128(b);
-    relativeref:
-        *u += unit;
-        *type = TReference;
-        return 0;
+       case FormRefAddr:
+               /* absolute ref in .debug_info */
+               *type = TReference;
+               *u = dwarfgetaddr(b);
+               return 0;
+       case FormRef1:
+               *u = dwarfget1(b);
+               goto relativeref;
+       case FormRef2:
+               *u = dwarfget2(b);
+               goto relativeref;
+       case FormRef4:
+               *u = dwarfget4(b);
+               goto relativeref;
+       case FormRef8:
+               *u = dwarfget8(b);
+               goto relativeref;
+       case FormRefUdata:
+               *u = dwarfget128(b);
+       relativeref:
+               *u += unit;
+               *type = TReference;
+               return 0;
 
        /* constants */
-    case FormData1:
-        *u = dwarfget1(b);
-        goto constant;
-    case FormData2:
-        *u = dwarfget2(b);
-        goto constant;
-    case FormData4:
-        *u = dwarfget4(b);
-        goto constant;
-    case FormData8:
-        uv = dwarfget8(b);
-        *u = uv;
-        if(uv != *u && ++nbad == 1)
-            werrstr("dwarf: truncating 64-bit attribute constants");
-        goto constant;
-    case FormSdata:
-        *u = dwarfget128s(b);
-        goto constant;
-    case FormUdata:
-        *u = dwarfget128(b);
-    constant:
-        *type = TConstant;
-        return 0;
-    }
+       case FormData1:
+               *u = dwarfget1(b);
+               goto constant;
+       case FormData2:
+               *u = dwarfget2(b);
+               goto constant;
+       case FormData4:
+               *u = dwarfget4(b);
+               goto constant;
+       case FormData8:
+               uv = dwarfget8(b);
+               *u = uv;
+               if(uv != *u && ++nbad == 1)
+                       werrstr("dwarf: truncating 64-bit attribute constants");
+               goto constant;
+       case FormSdata:
+               *u = dwarfget128s(b);
+               goto constant;
+       case FormUdata:
+               *u = dwarfget128(b);
+       constant:
+               *type = TConstant;
+               return 0;
+       }
 }
 
 static int
 getuchar(DwarfBuf *b, int form, uchar *u)
 {
-    switch(form){
-    default:
-        return -1;
-
-    case FormFlag:
-        *u = dwarfget1(b);
-        return 0;
-    }
+       switch(form){
+       default:
+               return -1;
+
+       case FormFlag:
+               *u = dwarfget1(b);
+               return 0;
+       }
 }
 
 static int
-getstring(Dwarf *d, DwarfBuf *b, int form, char **s)
+getstring(DwarfBuf *b, int form, char **s)
 {
-    static int nbad;
-    ulong u, x;
-
-    switch(form){
-    default:
-        return -1;
-
-    case FormString:
-        x = b->p - d->info.data;
-        *s = dwarfgetstring(b);
-        for (u = 0; (*s)[u]; u++) {
-            assert(isprint((*s)[u]));
-        }
-        return 0;
-
-    case FormStrp:
-        u = dwarfget4(b);
-        if(u >= b->d->str.len){
-            if(++nbad == 1)
-                werrstr("dwarf: bad string pointer 0x%lux in attribute", u);
-            /* don't return error - maybe can proceed */
-            *s = nil;
-        }else
-            *s = (char*)b->d->str.data + u;
-        return 0;
-
-    }
+       static int nbad;
+       ulong u;
+
+       switch(form){
+       default:
+               return -1;
+
+       case FormString:
+               *s = dwarfgetstring(b);
+               return 0;
+
+       case FormStrp:
+               u = dwarfget4(b);
+               if(u >= b->d->str.len){
+                       if(++nbad == 1)
+                               werrstr("dwarf: bad string pointer 0x%lux in attribute", u);
+                       /* don't return error - maybe can proceed */
+                       *s = nil;
+               }else
+                       *s = (char*)b->d->str.data + u;
+               return 0;
+
+       }
 }
 
 static int
 getblock(DwarfBuf *b, int form, DwarfBlock *bl)
 {
-    ulong n;
-
-    switch(form){
-    default:
-        return -1;
-    case FormDwarfBlock:
-        n = dwarfget128(b);
-        goto copyn;
-    case FormDwarfBlock1:
-        n = dwarfget1(b);
-        goto copyn;
-    case FormDwarfBlock2:
-        n = dwarfget2(b);
-        goto copyn;
-    case FormDwarfBlock4:
-        n = dwarfget4(b);
-    copyn:
-        bl->data = dwarfgetnref(b, n);
-        bl->len = n;
-        if(bl->data == nil)
-            return -1;
-        return 0;
-    }
+       ulong n;
+
+       switch(form){
+       default:
+               return -1;
+       case FormDwarfBlock:
+               n = dwarfget128(b);
+               goto copyn;
+       case FormDwarfBlock1:
+               n = dwarfget1(b);
+               goto copyn;
+       case FormDwarfBlock2:
+               n = dwarfget2(b);
+               goto copyn;
+       case FormDwarfBlock4:
+               n = dwarfget4(b);
+       copyn:
+               bl->data = dwarfgetnref(b, n);
+               bl->len = n;
+               if(bl->data == nil)
+                       return -1;
+               return 0;
+       }
 }
 
-/* last resort */
 static int
-skipform(Dwarf *d, DwarfBuf *b, int form)
+constblock(Dwarf *d, DwarfBlock *bl, ulong *pval)
 {
-    int type;
-    DwarfVal val;
-
-    if(getulong(b, form, 0, &val.c, &type) < 0
-       && getuchar(b, form, (uchar*)&val) < 0
-       && getstring(d, b, form, &val.s) < 0
-       && getblock(b, form, &val.b) < 0)
-        return -1;
-    return 0;
-}
-
-void stackinit(DwarfStack *stack)
-{
-    memset(stack, 0, sizeof(*stack));
-    stack->data = stack->storage;
-    stack->length = 0; stack->max = sizeof(stack->storage) / sizeof(stack->storage[0]);
-}
-
-void stackpush(DwarfStack *stack, ulong value)
-{
-    if (stack->length == stack->max) {
-        ulong *newstack = malloc(sizeof(ulong)*stack->max*2);
-        memcpy(newstack, stack->data, sizeof(ulong)*stack->length);
-        if (stack->data != stack->storage)
-            free(stack->data);
-        stack->data = newstack;
-        stack->max *= 2;
-    }
-    werrstr("stack[%d] = %x", stack->length, value);
-    stack->data[stack->length++] = value;
-}
-
-ulong stackpop(DwarfStack *stack) 
-{
-    ASSERT(stack->length > 0);
-    ulong val = stack->data[--stack->length];
-    werrstr("pop stack[%d] -> %x", stack->length, val);
-    return val;
-}
-
-void stackfree(DwarfStack *stack)
-{
-    if (stack->data != stack->storage)
-        free(stack->data);
-}
-
-// Returns -1 on failure
-int dwarfgetarg(Dwarf *d, const char *name, DwarfBuf *buf, ulong cfa, PROSSYM_REGISTERS registers, ulong *result)
-{
-    int ret = 0;
-    DwarfStack stack = { };
-    stackinit(&stack);
-    while (buf->p < buf->ep) {
-        int opcode = dwarfget1(buf);
-        werrstr("opcode %x", opcode);
-        switch (opcode) {
-        case 0:
-            buf->p = buf->ep;
-            break;
-        case OpAddr:
-            if (d->addrsize == 4) {
-                stackpush(&stack, dwarfget4(buf));
-                break;
-            } else {
-                werrstr("%s: we only support 4 byte addrs", name);
-                goto fatal;
-            }
-        case OpConst1s: {
-            signed char c = dwarfget1(buf);
-            stackpush(&stack, c);
-        } break;
-        case OpConst1u:
-            stackpush(&stack, dwarfget1(buf));
-            break;
-        case OpConst2s: {
-            signed short s = dwarfget2(buf);
-            stackpush(&stack, s);
-        } break;
-        case OpConst2u:
-            stackpush(&stack, dwarfget2(buf));
-            break;
-        case OpConst4s: {
-            signed int i = dwarfget4(buf);
-            stackpush(&stack, i);
-        } break;
-        case OpConst4u:
-            stackpush(&stack, dwarfget4(buf));
-            break;
-        case OpConst8s:
-        case OpConst8u:
-            werrstr("const 8 not yet supported");
-            goto fatal;
-        case OpConsts:
-            stackpush(&stack, dwarfget128s(buf));
-            break;
-        case OpConstu:
-            stackpush(&stack, dwarfget128(buf));
-            break;
-        case OpDup: {
-            ulong popped = stackpop(&stack);
-            stackpush(&stack, popped);
-            stackpush(&stack, popped);
-        } break;
-        case OpDrop:
-            stackpop(&stack);
-            break;
-        case OpOver: {
-            if (stack.length < 2) goto fatal;
-            stackpush(&stack, stack.data[stack.length-2]);
-        } break;
-        case OpPick: {
-            ulong arg = dwarfget1(buf);
-            if (arg >= stack.length) goto fatal;
-            arg = stack.data[stack.length-1-arg];
-            stackpush(&stack, arg);
-        } break;
-        case OpSwap: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b);
-            stackpush(&stack, a);
-        } break;
-        case OpRot: {
-            ulong a = stackpop(&stack), b = stackpop(&stack), c = stackpop(&stack);
-            stackpush(&stack, b);
-            stackpush(&stack, c);
-            stackpush(&stack, a);
-        } break;
-        case OpXderef:
-        case OpXderefSize:
-            werrstr("Xderef not yet supported");
-            goto fatal;
-        case OpAbs: {
-            long a = stackpop(&stack);
-            stackpush(&stack, a < 0 ? -a : a);
-        } break;
-        case OpAnd:
-            stackpush(&stack, stackpop(&stack) & stackpop(&stack));
-            break;
-        case OpDiv: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b / a);
-        } break;
-        case OpMinus: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b - a);
-        } break;
-        case OpMod: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b % a);
-        } break;
-        case OpMul:
-            stackpush(&stack, stackpop(&stack) * stackpop(&stack));
-            break;
-        case OpNeg:
-            stackpush(&stack, -stackpop(&stack));
-            break;
-        case OpNot:
-            stackpush(&stack, ~stackpop(&stack));
-            break;
-        case OpOr:
-            stackpush(&stack, stackpop(&stack) | stackpop(&stack));
-            break;
-        case OpPlus:
-            stackpush(&stack, stackpop(&stack) + stackpop(&stack));
-            break;
-        case OpPlusUconst:
-            stackpush(&stack, stackpop(&stack) + dwarfget128(buf));
-            break;
-        case OpShl: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b << a);
-        } break;
-        case OpShr: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b >> a);
-        } break;
-        case OpShra: {
-            ulong a = stackpop(&stack);
-            long b = stackpop(&stack);
-            if (b < 0)
-                b = -(-b >> a);
-            else
-                b = b >> a;
-            stackpush(&stack, b);
-        } break;
-        case OpXor:
-            stackpush(&stack, stackpop(&stack) ^ stackpop(&stack));
-            break;
-        case OpSkip:
-            buf->p += dwarfget2(buf);
-            break;
-        case OpBra: {
-            ulong a = dwarfget2(buf);
-            if (stackpop(&stack))
-                buf->p += a;
-        } break;
-        case OpEq:
-            stackpush(&stack, stackpop(&stack) == stackpop(&stack));
-            break;
-        case OpGe: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b >= a);
-        } break;
-        case OpGt: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b > a);
-        } break;
-        case OpLe: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b <= a);
-        } break;
-        case OpLt: {
-            ulong a = stackpop(&stack), b = stackpop(&stack);
-            stackpush(&stack, b < a);
-        } break;
-        case OpNe:
-            stackpush(&stack, stackpop(&stack) != stackpop(&stack));
-            break;
-        case OpNop:
-            break;
-        case OpDeref: {
-            ulong val, addr = stackpop(&stack);
-            if (!RosSymCallbacks.MemGetProc
-                (d->pe->fd,
-                 &val,
-                 addr,
-                 d->addrsize))
-                goto fatal;
-            stackpush(&stack, val);
-        } break;
-        case OpDerefSize: {
-            ulong val, addr = stackpop(&stack), size = dwarfget1(buf);
-            if (!RosSymCallbacks.MemGetProc
-                (d->pe->fd,
-                 &val,
-                 addr,
-                 size))
-                goto fatal;
-            stackpush(&stack, val);
-        } break;
-        case OpFbreg: {
-            ulong val, addr = cfa, offset = dwarfget128s(buf);
-            werrstr("FBREG cfa %x offset %x", cfa, offset);
-            if (!RosSymCallbacks.MemGetProc
-                (d->pe->fd,
-                 &val,
-                 addr+offset,
-                 d->addrsize))
-                goto fatal;
-            stackpush(&stack, val);
-        } break;
-        case OpPiece:
-            werrstr("OpPiece not supported");
-            goto fatal;
-        default:
-            if (opcode >= OpLit0 && opcode < OpReg0)
-                stackpush(&stack, opcode - OpLit0);
-            else if (opcode >= OpReg0 && opcode < OpBreg0) {
-                ulong reg = opcode - OpReg0;
-                werrstr("REG[%d] value %x", reg, (ulong)registers->Registers[reg]);
-                stackpush(&stack, registers->Registers[reg]);
-            } else if (opcode >= OpBreg0 && opcode < OpRegx) {
-                ulong val, 
-                    reg = opcode - OpBreg0, 
-                    addr = registers->Registers[reg],
-                    offset = dwarfget128s(buf);
-                werrstr("BREG[%d] reg %x offset %x", reg, addr, offset);
-                if (!RosSymCallbacks.MemGetProc
-                    (d->pe->fd,
-                     &val,
-                     addr + offset,
-                     d->addrsize))
-                    goto fatal;
-                stackpush(&stack, val);
-            } else {
-                werrstr("opcode %x not supported", opcode);
-                goto fatal;
-            }
-            break;
-        }
-    }
-    if (stack.length < 1) goto fatal;
-    *result = stackpop(&stack);
-    werrstr("%s: value %x", name, *result);
-    goto finish;
-
-fatal:
-    ret = -1;
-
-finish:
-    stackfree(&stack);
-    return ret;
+       DwarfBuf b;
+
+       memset(&b, 0, sizeof b);
+       b.p = bl->data;
+       b.ep = bl->data+bl->len;
+       b.d = d;
+
+       switch(dwarfget1(&b)){
+       case OpAddr:
+               *pval = dwarfgetaddr(&b);
+               return TConstant;
+       case OpConst1u:
+               *pval = dwarfget1(&b);
+               return TConstant;
+       case OpConst1s:
+               *pval = (schar)dwarfget1(&b);
+               return TConstant;
+       case OpConst2u:
+               *pval = dwarfget2(&b);
+               return TConstant;
+       case OpConst2s:
+               *pval = (s16int)dwarfget2(&b);
+               return TConstant;
+       case OpConst4u:
+               *pval = dwarfget4(&b);
+               return TConstant;
+       case OpConst4s:
+               *pval = (s32int)dwarfget4(&b);
+               return TConstant;
+       case OpConst8u:
+               *pval = (u64int)dwarfget8(&b);
+               return TConstant;
+       case OpConst8s:
+               *pval = (s64int)dwarfget8(&b);
+               return TConstant;
+       case OpConstu:
+               *pval = dwarfget128(&b);
+               return TConstant;
+       case OpConsts:
+               *pval = dwarfget128s(&b);
+               return TConstant;
+       case OpPlusUconst:
+               *pval = dwarfget128(&b);
+               return TConstant;
+       default:
+               return TBlock;
+       }
 }
 
-int dwarfargvalue(Dwarf *d, DwarfSym *proc, ulong pc, ulong cfa, PROSSYM_REGISTERS registers, DwarfParam *parameter)
+/* last resort */
+static int
+skipform(DwarfBuf *b, int form)
 {
-    int gotarg;
-    DwarfSym unit = { };
-
-    if (dwarfenumunit(d, proc->unit, &unit) == -1)
-        return -1;
-
-    werrstr("lookup in unit %x-%x, pc %x", unit.attrs.lowpc, unit.attrs.highpc, pc);
-    pc -= unit.attrs.lowpc;
-    
-    werrstr("paramblock %s -> unit %x type %x fde %x len %d registers %x", 
-            parameter->name, 
-            parameter->unit, 
-            parameter->type, 
-            parameter->fde, 
-            parameter->len, 
-            registers);
-
-    // Seek our range in loc
-    DwarfBuf locbuf;
-    DwarfBuf instream = { };
-
-    locbuf.d = d;
-    locbuf.addrsize = d->addrsize;
-    
-    if (parameter->loctype == TConstant) {
-        locbuf.p = d->loc.data + parameter->fde;
-        locbuf.ep = d->loc.data + d->loc.len;
-        ulong start, end, len;
-        do {
-            len = 0;
-            start = dwarfget4(&locbuf);
-            end = dwarfget4(&locbuf);
-            if (start && end) {
-                len = dwarfget2(&locbuf);
-                instream = locbuf;
-                instream.ep = instream.p + len;
-                locbuf.p = instream.ep;
-            }
-            werrstr("ip %x s %x e %x (%x bytes)", pc, start, end, len);
-        } while (start && end && (start > pc || end <= pc));
-    } else if (parameter->loctype == TBlock) {
-        instream = locbuf;
-        instream.p = (void *)parameter->fde;
-        instream.ep = instream.p + parameter->len;
-    } else {
-        werrstr("Wrong block type for parameter %s", parameter->name);
-        return -1;
-    }
-
-    gotarg = dwarfgetarg(d, parameter->name, &instream, cfa, registers, &parameter->value);
-    if (gotarg == -1)
-        return -1;
-    
-    return 0;
+       int type;
+       DwarfVal val;
+
+       if(getulong(b, form, 0, &val.c, &type) < 0
+       && getuchar(b, form, (uchar*)&val) < 0
+       && getstring(b, form, &val.s) < 0
+       && getblock(b, form, &val.b) < 0)
+               return -1;
+       return 0;
 }
 
-int
-dwarfgetparams(Dwarf *d, DwarfSym *s, ulong pc, int pnum, DwarfParam *paramblocks)
-{
-       int ip = 0;
-       DwarfSym param = { };
-       int res = dwarfnextsymat(d, s, &param);
-       while (res == 0 && ip < pnum) {
-               if (param.attrs.tag == TagFormalParameter &&
-                       param.attrs.have.name && 
-                       param.attrs.have.location) {
-                       paramblocks[ip].name = malloc(strlen(param.attrs.name)+1);
-                       strcpy(paramblocks[ip].name, param.attrs.name);
-                       paramblocks[ip].unit = param.unit;
-                       paramblocks[ip].type = param.attrs.type;
-            paramblocks[ip].loctype = param.attrs.have.location;
-            paramblocks[ip].len = param.attrs.location.b.len;
-                       paramblocks[ip].fde = param.attrs.location.b.data;
-            werrstr("param[%d] block %s -> type %x loctype %x fde %x len %x", 
-                   ip, 
-                   paramblocks[ip].name, 
-                   paramblocks[ip].type,
-                   paramblocks[ip].loctype, 
-                   paramblocks[ip].fde,
-                   paramblocks[ip].len);
-            ip++;
-               }
-               res = dwarfnextsymat(d, s, &param);
-       }
-       return ip;
-}
index b3ea2cd..9a5f20c 100644 (file)
@@ -31,8 +31,7 @@ dwarfopen(Pe *pe)
        || pe->loadsection(pe, ".debug_aranges", &d->aranges) < 0
        || pe->loadsection(pe, ".debug_line", &d->line) < 0
        || pe->loadsection(pe, ".debug_pubnames", &d->pubnames) < 0
-       || pe->loadsection(pe, ".debug_info", &d->info) < 0
-    || pe->loadsection(pe, ".debug_loc", &d->loc) < 0)
+       || pe->loadsection(pe, ".debug_info", &d->info) < 0)
                goto err;
        pe->loadsection(pe, ".debug_frame", &d->frame);
        pe->loadsection(pe, ".debug_ranges", &d->ranges);
@@ -50,7 +49,6 @@ err:
        free(d->ranges.data);
        free(d->str.data);
        free(d->info.data);
-    free(d->loc.data);
        free(d);
        return nil;
 }
index ec41e10..4edb556 100644 (file)
 
 enum
 {
-    Isstmt = 1<<0,
-    BasicDwarfBlock = 1<<1,
-    EndSequence = 1<<2,
-    PrologueEnd = 1<<3,
-    EpilogueBegin = 1<<4
+       Isstmt = 1<<0,
+       BasicDwarfBlock = 1<<1,
+       EndSequence = 1<<2,
+       PrologueEnd = 1<<3,
+       EpilogueBegin = 1<<4
 };
 
 typedef struct State State;
 struct State
 {
-    ulong addr;
-    ulong file;
-    ulong line;
-    ulong column;
-    ulong flags;
-    ulong isa;
+