diff options
| author | ruki <[email protected]> | 2018-04-28 00:47:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-04-27 22:45:56 +0800 |
| commit | 119dd6ff5786ef7a390b98b0558554029113f0dd (patch) | |
| tree | 2fa5d1196a8951c0f8e4ad67c8b443b47280a0ab | |
| parent | 7d486e88c2b3301449974e0e97168bc0f0fd6c64 (diff) | |
add wdk tests
| -rw-r--r-- | tests/projects/c++/console/src/main.cpp (renamed from tests/projects/console_c++/src/main.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/console/test.lua (renamed from tests/projects/console_c++/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/console/xmake.lua (renamed from tests/projects/console_c++/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/header.h (renamed from tests/projects/precompiled_header_c++/src/header.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/main.cpp (renamed from tests/projects/precompiled_header_c++/src/main.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test.c (renamed from tests/projects/precompiled_header_c++/src/test.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test.cpp (renamed from tests/projects/precompiled_header_c++/src/test.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test2.cpp (renamed from tests/projects/precompiled_header_c++/src/test2.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test3.cpp (renamed from tests/projects/precompiled_header_c++/src/test3.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test4.cpp (renamed from tests/projects/precompiled_header_c++/src/test4.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test5.cpp (renamed from tests/projects/precompiled_header_c++/src/test5.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test6.cpp (renamed from tests/projects/precompiled_header_c++/src/test6.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test7.cpp (renamed from tests/projects/precompiled_header_c++/src/test7.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/src/test8.cpp (renamed from tests/projects/precompiled_header_c++/src/test8.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/test.lua (renamed from tests/projects/console_c/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/precompiled_header/xmake.lua (renamed from tests/projects/precompiled_header_c++/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/shared_library/src/interface.cpp (renamed from tests/projects/shared_library_c++/src/interface.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/shared_library/src/interface.h (renamed from tests/projects/shared_library_c++/src/interface.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/shared_library/src/test.cpp (renamed from tests/projects/shared_library_c++/src/test.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/shared_library/test.lua (renamed from tests/projects/merge_object/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/shared_library/xmake.lua (renamed from tests/projects/shared_library_c++/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/static_library/src/interface.cpp (renamed from tests/projects/static_library_c++/src/interface.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/static_library/src/interface.h (renamed from tests/projects/static_library_c++/src/interface.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/static_library/src/test.cpp (renamed from tests/projects/static_library_c++/src/test.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/static_library/test.lua (renamed from tests/projects/merge_static_library/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/static_library/xmake.lua (renamed from tests/projects/static_library_c++/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/console/src/main.c (renamed from tests/projects/console_c/src/main.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/console/test.lua (renamed from tests/projects/precompiled_header_c++/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/console/xmake.lua (renamed from tests/projects/console_c/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/header.h (renamed from tests/projects/precompiled_header_c/src/header.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/main.c (renamed from tests/projects/precompiled_header_c/src/main.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test.c (renamed from tests/projects/precompiled_header_c/src/test.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test.cpp (renamed from tests/projects/precompiled_header_c/src/test.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test2.c (renamed from tests/projects/precompiled_header_c/src/test2.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test3.c (renamed from tests/projects/precompiled_header_c/src/test3.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test4.c (renamed from tests/projects/precompiled_header_c/src/test4.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test5.c (renamed from tests/projects/precompiled_header_c/src/test5.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test6.c (renamed from tests/projects/precompiled_header_c/src/test6.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test7.c (renamed from tests/projects/precompiled_header_c/src/test7.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/src/test8.c (renamed from tests/projects/precompiled_header_c/src/test8.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/test.lua (renamed from tests/projects/precompiled_header_c/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/precompiled_header/xmake.lua (renamed from tests/projects/precompiled_header_c/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/shared_library/src/interface.c (renamed from tests/projects/merge_object/src/interface.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/shared_library/src/interface.h (renamed from tests/projects/shared_library_c/src/interface.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c/shared_library/src/test.c (renamed from tests/projects/merge_object/src/test.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/shared_library/test.lua (renamed from tests/projects/shared_library_c++/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/shared_library/xmake.lua (renamed from tests/projects/shared_library_c/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static library with spaces/s r c/interface.c (renamed from tests/projects/shared_library_c/src/interface.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static library with spaces/s r c/interface.h (renamed from tests/projects/merge_object/src/interface.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static library with spaces/s r c/test.c (renamed from tests/projects/shared_library_c/src/test.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static library with spaces/test.lua (renamed from tests/projects/shared_library_c/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static library with spaces/xmake.lua (renamed from tests/projects/static library c/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static_library/src/interface.c (renamed from tests/projects/static library c/s r c/interface.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static_library/src/interface.h (renamed from tests/projects/static library c/s r c/interface.h) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static_library/src/test.c (renamed from tests/projects/static library c/s r c/test.c) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static_library/test.lua (renamed from tests/projects/static library c/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c/static_library/xmake.lua (renamed from tests/projects/static_library_c/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/cuda_drvapi_dynlink.c (renamed from tests/projects/cuda_console/inc/cuda_drvapi_dynlink.c) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/drvapi_error_string.h (renamed from tests/projects/cuda_console/inc/drvapi_error_string.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink.h (renamed from tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_cuda.h (renamed from tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_cuda.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_d3d.h (renamed from tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_d3d.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_gl.h (renamed from tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_gl.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/dynlink_d3d10.h (renamed from tests/projects/cuda_console/inc/dynlink_d3d10.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/dynlink_d3d11.h (renamed from tests/projects/cuda_console/inc/dynlink_d3d11.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/exception.h (renamed from tests/projects/cuda_console/inc/exception.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_cuda.h (renamed from tests/projects/cuda_console/inc/helper_cuda.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_cuda_drvapi.h (renamed from tests/projects/cuda_console/inc/helper_cuda_drvapi.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_cuda_gl.h (renamed from tests/projects/cuda_console/inc/helper_cuda_gl.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_cusolver.h (renamed from tests/projects/cuda_console/inc/helper_cusolver.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_functions.h (renamed from tests/projects/cuda_console/inc/helper_functions.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_gl.h (renamed from tests/projects/cuda_console/inc/helper_gl.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_image.h (renamed from tests/projects/cuda_console/inc/helper_image.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_math.h (renamed from tests/projects/cuda_console/inc/helper_math.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_string.h (renamed from tests/projects/cuda_console/inc/helper_string.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/helper_timer.h (renamed from tests/projects/cuda_console/inc/helper_timer.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/multithreading.h (renamed from tests/projects/cuda_console/inc/multithreading.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/nvMath.h (renamed from tests/projects/cuda_console/inc/nvMath.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/nvMatrix.h (renamed from tests/projects/cuda_console/inc/nvMatrix.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/nvQuaternion.h (renamed from tests/projects/cuda_console/inc/nvQuaternion.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/nvShaderUtils.h (renamed from tests/projects/cuda_console/inc/nvShaderUtils.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/nvVector.h (renamed from tests/projects/cuda_console/inc/nvVector.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/nvrtc_helper.h (renamed from tests/projects/cuda_console/inc/nvrtc_helper.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/param.h (renamed from tests/projects/cuda_console/inc/param.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/paramgl.h (renamed from tests/projects/cuda_console/inc/paramgl.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/rendercheck_d3d10.h (renamed from tests/projects/cuda_console/inc/rendercheck_d3d10.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/rendercheck_d3d11.h (renamed from tests/projects/cuda_console/inc/rendercheck_d3d11.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/rendercheck_d3d9.h (renamed from tests/projects/cuda_console/inc/rendercheck_d3d9.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/rendercheck_gl.h (renamed from tests/projects/cuda_console/inc/rendercheck_gl.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/rendercheck_gles.h (renamed from tests/projects/cuda_console/inc/rendercheck_gles.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/inc/timer.h (renamed from tests/projects/cuda_console/inc/timer.h) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/src/main.cu (renamed from tests/projects/cuda_console/src/main.cu) | 0 | ||||
| -rw-r--r-- | tests/projects/cuda/console/xmake.lua (renamed from tests/projects/cuda_console/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/console/src/main.d (renamed from tests/projects/console_dlang/src/main.d) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/console/test.lua (renamed from tests/projects/console_dlang/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/console/xmake.lua (renamed from tests/projects/console_dlang/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/shared_library/src/interfaces.d (renamed from tests/projects/shared_library_dlang/src/interfaces.d) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/shared_library/src/main.d (renamed from tests/projects/shared_library_dlang/src/main.d) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/shared_library/test.lua (renamed from tests/projects/console_go/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/shared_library/xmake.lua (renamed from tests/projects/shared_library_dlang/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/static_library/src/interfaces.d (renamed from tests/projects/static_library_dlang/src/interfaces.d) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/static_library/src/main.d (renamed from tests/projects/static_library_dlang/src/main.d) | 0 | ||||
| -rw-r--r-- | tests/projects/dlang/static_library/xmake.lua (renamed from tests/projects/static_library_dlang/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/go/console/src/main.go (renamed from tests/projects/console_go/src/main.go) | 0 | ||||
| -rw-r--r-- | tests/projects/go/console/test.lua (renamed from tests/projects/console_rust/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/go/console/xmake.lua (renamed from tests/projects/console_go/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/go/static_library/src/main.go (renamed from tests/projects/static_library_go/src/main.go) | 0 | ||||
| -rw-r--r-- | tests/projects/go/static_library/src/test.go (renamed from tests/projects/static_library_go/src/test.go) | 0 | ||||
| -rw-r--r-- | tests/projects/go/static_library/src/test/add.go (renamed from tests/projects/static_library_go/src/test/add.go) | 0 | ||||
| -rw-r--r-- | tests/projects/go/static_library/src/test/sub.go (renamed from tests/projects/static_library_go/src/test/sub.go) | 0 | ||||
| -rw-r--r-- | tests/projects/go/static_library/test.lua (renamed from tests/projects/shared_library_dlang/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/go/static_library/xmake.lua (renamed from tests/projects/static_library_go/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/merge_object/xmake.lua | 45 | ||||
| -rw-r--r-- | tests/projects/merge_static_library/src/add.c | 4 | ||||
| -rw-r--r-- | tests/projects/merge_static_library/src/mul.c | 4 | ||||
| -rw-r--r-- | tests/projects/merge_static_library/src/sub.c | 4 | ||||
| -rw-r--r-- | tests/projects/merge_static_library/xmake.lua | 58 | ||||
| -rw-r--r-- | tests/projects/objc++/console/src/main.mm (renamed from tests/projects/console_objc++/src/main.mm) | 0 | ||||
| -rw-r--r-- | tests/projects/objc++/console/test.lua (renamed from tests/projects/console_objc++/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/objc++/console/xmake.lua (renamed from tests/projects/console_objc++/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/objc/console/src/main.m (renamed from tests/projects/console_objc/src/main.m) | 0 | ||||
| -rw-r--r-- | tests/projects/objc/console/test.lua (renamed from tests/projects/console_objc/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/objc/console/xmake.lua (renamed from tests/projects/console_objc/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/console/src/main.cpp (renamed from tests/projects/qt_console/src/main.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/console/xmake.lua (renamed from tests/projects/qt_console/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/quickapp/src/main.cpp (renamed from tests/projects/qt_quickapp/src/main.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/quickapp/src/main.qml (renamed from tests/projects/qt_quickapp/src/main.qml) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/quickapp/src/qml.qrc (renamed from tests/projects/qt_quickapp/src/qml.qrc) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/quickapp/xmake.lua (renamed from tests/projects/qt_quickapp/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/shared_library/src/demo.cpp (renamed from tests/projects/qt_shared_library/src/demo.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/shared_library/src/demo.h (renamed from tests/projects/qt_shared_library/src/demo.h) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/shared_library/src/demo_global.h (renamed from tests/projects/qt_shared_library/src/demo_global.h) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/shared_library/xmake.lua (renamed from tests/projects/qt_shared_library/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/static_library/src/demo.cpp (renamed from tests/projects/qt_static_library/src/demo.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/static_library/src/demo.h (renamed from tests/projects/qt_static_library/src/demo.h) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/static_library/xmake.lua (renamed from tests/projects/qt_static_library/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/widgetapp/src/main.cpp (renamed from tests/projects/qt_widgetapp/src/main.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/widgetapp/src/mainwindow.cpp (renamed from tests/projects/qt_widgetapp/src/mainwindow.cpp) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/widgetapp/src/mainwindow.h (renamed from tests/projects/qt_widgetapp/src/mainwindow.h) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/widgetapp/src/mainwindow.ui (renamed from tests/projects/qt_widgetapp/src/mainwindow.ui) | 0 | ||||
| -rw-r--r-- | tests/projects/qt/widgetapp/xmake.lua (renamed from tests/projects/qt_widgetapp/xmake.lua) | 0 | ||||
| -rwxr-xr-x | tests/projects/requires/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/requires/test.lua | 10 | ||||
| -rw-r--r-- | tests/projects/requires/xmake.lua | 52 | ||||
| -rw-r--r-- | tests/projects/rust/console/src/main.rs (renamed from tests/projects/console_rust/src/main.rs) | 0 | ||||
| -rw-r--r-- | tests/projects/rust/console/test.lua (renamed from tests/projects/static_library_go/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/rust/console/xmake.lua (renamed from tests/projects/console_rust/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/rust/static_library/src/interfaces.rs (renamed from tests/projects/static_library_rust/src/interfaces.rs) | 0 | ||||
| -rw-r--r-- | tests/projects/rust/static_library/src/main.rs (renamed from tests/projects/static_library_rust/src/main.rs) | 0 | ||||
| -rw-r--r-- | tests/projects/rust/static_library/test.lua (renamed from tests/projects/static_library_rust/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/rust/static_library/xmake.lua (renamed from tests/projects/static_library_rust/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/static_library_c++/test.lua | 9 | ||||
| -rw-r--r-- | tests/projects/static_library_c/src/interface.c | 6 | ||||
| -rw-r--r-- | tests/projects/static_library_c/src/interface.h | 8 | ||||
| -rw-r--r-- | tests/projects/static_library_c/src/test.c | 8 | ||||
| -rw-r--r-- | tests/projects/static_library_c/test.lua | 9 | ||||
| -rw-r--r-- | tests/projects/swift/console/src/main.swift (renamed from tests/projects/console_swift/src/main.swift) | 0 | ||||
| -rw-r--r-- | tests/projects/swift/console/test.lua (renamed from tests/projects/console_swift/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/swift/console/xmake.lua (renamed from tests/projects/console_swift/xmake.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/driver/localwpp.ini | 17 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/driver/nonpnp.c | 1309 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/driver/nonpnp.h | 90 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/driver/nonpnp.rc | 10 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/driver/public.h | 53 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/driver/trace.h | 68 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/exe/install.c | 812 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/exe/nonpnp.inf | 8 | ||||
| -rw-r--r-- | tests/projects/wdk/kmdf/ioctl/exe/testapp.c | 643 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/device.c | 202 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/device.h | 48 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/driver.c | 192 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/driver.h | 46 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/echoum.inx | bin | 0 -> 3924 bytes | |||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/queue.c | 538 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/driver/queue.h | 62 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/exe/echoapp.cpp | 652 | ||||
| -rw-r--r-- | tests/projects/wdk/umdf/echo/exe/public.h | 30 |
177 files changed, 4780 insertions, 224 deletions
diff --git a/tests/projects/console_c++/src/main.cpp b/tests/projects/c++/console/src/main.cpp index db2361659..db2361659 100644 --- a/tests/projects/console_c++/src/main.cpp +++ b/tests/projects/c++/console/src/main.cpp diff --git a/tests/projects/console_c++/test.lua b/tests/projects/c++/console/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/console_c++/test.lua +++ b/tests/projects/c++/console/test.lua diff --git a/tests/projects/console_c++/xmake.lua b/tests/projects/c++/console/xmake.lua index 7f2076db5..7f2076db5 100644 --- a/tests/projects/console_c++/xmake.lua +++ b/tests/projects/c++/console/xmake.lua diff --git a/tests/projects/precompiled_header_c++/src/header.h b/tests/projects/c++/precompiled_header/src/header.h index d62b78383..d62b78383 100644 --- a/tests/projects/precompiled_header_c++/src/header.h +++ b/tests/projects/c++/precompiled_header/src/header.h diff --git a/tests/projects/precompiled_header_c++/src/main.cpp b/tests/projects/c++/precompiled_header/src/main.cpp index f0408cdf8..f0408cdf8 100644 --- a/tests/projects/precompiled_header_c++/src/main.cpp +++ b/tests/projects/c++/precompiled_header/src/main.cpp diff --git a/tests/projects/precompiled_header_c++/src/test.c b/tests/projects/c++/precompiled_header/src/test.c index 7f0aa2bf4..7f0aa2bf4 100644 --- a/tests/projects/precompiled_header_c++/src/test.c +++ b/tests/projects/c++/precompiled_header/src/test.c diff --git a/tests/projects/precompiled_header_c++/src/test.cpp b/tests/projects/c++/precompiled_header/src/test.cpp index e9d6c83d9..e9d6c83d9 100644 --- a/tests/projects/precompiled_header_c++/src/test.cpp +++ b/tests/projects/c++/precompiled_header/src/test.cpp diff --git a/tests/projects/precompiled_header_c++/src/test2.cpp b/tests/projects/c++/precompiled_header/src/test2.cpp index 596359cd2..596359cd2 100644 --- a/tests/projects/precompiled_header_c++/src/test2.cpp +++ b/tests/projects/c++/precompiled_header/src/test2.cpp diff --git a/tests/projects/precompiled_header_c++/src/test3.cpp b/tests/projects/c++/precompiled_header/src/test3.cpp index b4ce69b0f..b4ce69b0f 100644 --- a/tests/projects/precompiled_header_c++/src/test3.cpp +++ b/tests/projects/c++/precompiled_header/src/test3.cpp diff --git a/tests/projects/precompiled_header_c++/src/test4.cpp b/tests/projects/c++/precompiled_header/src/test4.cpp index a92803eb7..a92803eb7 100644 --- a/tests/projects/precompiled_header_c++/src/test4.cpp +++ b/tests/projects/c++/precompiled_header/src/test4.cpp diff --git a/tests/projects/precompiled_header_c++/src/test5.cpp b/tests/projects/c++/precompiled_header/src/test5.cpp index 2a3e7066c..2a3e7066c 100644 --- a/tests/projects/precompiled_header_c++/src/test5.cpp +++ b/tests/projects/c++/precompiled_header/src/test5.cpp diff --git a/tests/projects/precompiled_header_c++/src/test6.cpp b/tests/projects/c++/precompiled_header/src/test6.cpp index efbd7c6c1..efbd7c6c1 100644 --- a/tests/projects/precompiled_header_c++/src/test6.cpp +++ b/tests/projects/c++/precompiled_header/src/test6.cpp diff --git a/tests/projects/precompiled_header_c++/src/test7.cpp b/tests/projects/c++/precompiled_header/src/test7.cpp index 24aeff619..24aeff619 100644 --- a/tests/projects/precompiled_header_c++/src/test7.cpp +++ b/tests/projects/c++/precompiled_header/src/test7.cpp diff --git a/tests/projects/precompiled_header_c++/src/test8.cpp b/tests/projects/c++/precompiled_header/src/test8.cpp index 6ad5680a6..6ad5680a6 100644 --- a/tests/projects/precompiled_header_c++/src/test8.cpp +++ b/tests/projects/c++/precompiled_header/src/test8.cpp diff --git a/tests/projects/console_c/test.lua b/tests/projects/c++/precompiled_header/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/console_c/test.lua +++ b/tests/projects/c++/precompiled_header/test.lua diff --git a/tests/projects/precompiled_header_c++/xmake.lua b/tests/projects/c++/precompiled_header/xmake.lua index 685eca1cd..685eca1cd 100644 --- a/tests/projects/precompiled_header_c++/xmake.lua +++ b/tests/projects/c++/precompiled_header/xmake.lua diff --git a/tests/projects/shared_library_c++/src/interface.cpp b/tests/projects/c++/shared_library/src/interface.cpp index 598d07560..598d07560 100644 --- a/tests/projects/shared_library_c++/src/interface.cpp +++ b/tests/projects/c++/shared_library/src/interface.cpp diff --git a/tests/projects/shared_library_c++/src/interface.h b/tests/projects/c++/shared_library/src/interface.h index ef24ba3ce..ef24ba3ce 100644 --- a/tests/projects/shared_library_c++/src/interface.h +++ b/tests/projects/c++/shared_library/src/interface.h diff --git a/tests/projects/shared_library_c++/src/test.cpp b/tests/projects/c++/shared_library/src/test.cpp index 72e03272b..72e03272b 100644 --- a/tests/projects/shared_library_c++/src/test.cpp +++ b/tests/projects/c++/shared_library/src/test.cpp diff --git a/tests/projects/merge_object/test.lua b/tests/projects/c++/shared_library/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/merge_object/test.lua +++ b/tests/projects/c++/shared_library/test.lua diff --git a/tests/projects/shared_library_c++/xmake.lua b/tests/projects/c++/shared_library/xmake.lua index 6c2d4deea..6c2d4deea 100644 --- a/tests/projects/shared_library_c++/xmake.lua +++ b/tests/projects/c++/shared_library/xmake.lua diff --git a/tests/projects/static_library_c++/src/interface.cpp b/tests/projects/c++/static_library/src/interface.cpp index 598d07560..598d07560 100644 --- a/tests/projects/static_library_c++/src/interface.cpp +++ b/tests/projects/c++/static_library/src/interface.cpp diff --git a/tests/projects/static_library_c++/src/interface.h b/tests/projects/c++/static_library/src/interface.h index 4a41e9597..4a41e9597 100644 --- a/tests/projects/static_library_c++/src/interface.h +++ b/tests/projects/c++/static_library/src/interface.h diff --git a/tests/projects/static_library_c++/src/test.cpp b/tests/projects/c++/static_library/src/test.cpp index 72e03272b..72e03272b 100644 --- a/tests/projects/static_library_c++/src/test.cpp +++ b/tests/projects/c++/static_library/src/test.cpp diff --git a/tests/projects/merge_static_library/test.lua b/tests/projects/c++/static_library/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/merge_static_library/test.lua +++ b/tests/projects/c++/static_library/test.lua diff --git a/tests/projects/static_library_c++/xmake.lua b/tests/projects/c++/static_library/xmake.lua index 2e3950d4a..2e3950d4a 100644 --- a/tests/projects/static_library_c++/xmake.lua +++ b/tests/projects/c++/static_library/xmake.lua diff --git a/tests/projects/console_c/src/main.c b/tests/projects/c/console/src/main.c index 9ae580511..9ae580511 100644 --- a/tests/projects/console_c/src/main.c +++ b/tests/projects/c/console/src/main.c diff --git a/tests/projects/precompiled_header_c++/test.lua b/tests/projects/c/console/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/precompiled_header_c++/test.lua +++ b/tests/projects/c/console/test.lua diff --git a/tests/projects/console_c/xmake.lua b/tests/projects/c/console/xmake.lua index a9106daff..a9106daff 100644 --- a/tests/projects/console_c/xmake.lua +++ b/tests/projects/c/console/xmake.lua diff --git a/tests/projects/precompiled_header_c/src/header.h b/tests/projects/c/precompiled_header/src/header.h index 29bfc5870..29bfc5870 100644 --- a/tests/projects/precompiled_header_c/src/header.h +++ b/tests/projects/c/precompiled_header/src/header.h diff --git a/tests/projects/precompiled_header_c/src/main.c b/tests/projects/c/precompiled_header/src/main.c index f0408cdf8..f0408cdf8 100644 --- a/tests/projects/precompiled_header_c/src/main.c +++ b/tests/projects/c/precompiled_header/src/main.c diff --git a/tests/projects/precompiled_header_c/src/test.c b/tests/projects/c/precompiled_header/src/test.c index e9d6c83d9..e9d6c83d9 100644 --- a/tests/projects/precompiled_header_c/src/test.c +++ b/tests/projects/c/precompiled_header/src/test.c diff --git a/tests/projects/precompiled_header_c/src/test.cpp b/tests/projects/c/precompiled_header/src/test.cpp index 1cedddad9..1cedddad9 100644 --- a/tests/projects/precompiled_header_c/src/test.cpp +++ b/tests/projects/c/precompiled_header/src/test.cpp diff --git a/tests/projects/precompiled_header_c/src/test2.c b/tests/projects/c/precompiled_header/src/test2.c index 596359cd2..596359cd2 100644 --- a/tests/projects/precompiled_header_c/src/test2.c +++ b/tests/projects/c/precompiled_header/src/test2.c diff --git a/tests/projects/precompiled_header_c/src/test3.c b/tests/projects/c/precompiled_header/src/test3.c index b4ce69b0f..b4ce69b0f 100644 --- a/tests/projects/precompiled_header_c/src/test3.c +++ b/tests/projects/c/precompiled_header/src/test3.c diff --git a/tests/projects/precompiled_header_c/src/test4.c b/tests/projects/c/precompiled_header/src/test4.c index a92803eb7..a92803eb7 100644 --- a/tests/projects/precompiled_header_c/src/test4.c +++ b/tests/projects/c/precompiled_header/src/test4.c diff --git a/tests/projects/precompiled_header_c/src/test5.c b/tests/projects/c/precompiled_header/src/test5.c index 2a3e7066c..2a3e7066c 100644 --- a/tests/projects/precompiled_header_c/src/test5.c +++ b/tests/projects/c/precompiled_header/src/test5.c diff --git a/tests/projects/precompiled_header_c/src/test6.c b/tests/projects/c/precompiled_header/src/test6.c index efbd7c6c1..efbd7c6c1 100644 --- a/tests/projects/precompiled_header_c/src/test6.c +++ b/tests/projects/c/precompiled_header/src/test6.c diff --git a/tests/projects/precompiled_header_c/src/test7.c b/tests/projects/c/precompiled_header/src/test7.c index 24aeff619..24aeff619 100644 --- a/tests/projects/precompiled_header_c/src/test7.c +++ b/tests/projects/c/precompiled_header/src/test7.c diff --git a/tests/projects/precompiled_header_c/src/test8.c b/tests/projects/c/precompiled_header/src/test8.c index 6ad5680a6..6ad5680a6 100644 --- a/tests/projects/precompiled_header_c/src/test8.c +++ b/tests/projects/c/precompiled_header/src/test8.c diff --git a/tests/projects/precompiled_header_c/test.lua b/tests/projects/c/precompiled_header/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/precompiled_header_c/test.lua +++ b/tests/projects/c/precompiled_header/test.lua diff --git a/tests/projects/precompiled_header_c/xmake.lua b/tests/projects/c/precompiled_header/xmake.lua index 3fd1905b0..3fd1905b0 100644 --- a/tests/projects/precompiled_header_c/xmake.lua +++ b/tests/projects/c/precompiled_header/xmake.lua diff --git a/tests/projects/merge_object/src/interface.c b/tests/projects/c/shared_library/src/interface.c index 598d07560..598d07560 100644 --- a/tests/projects/merge_object/src/interface.c +++ b/tests/projects/c/shared_library/src/interface.c diff --git a/tests/projects/shared_library_c/src/interface.h b/tests/projects/c/shared_library/src/interface.h index ef24ba3ce..ef24ba3ce 100644 --- a/tests/projects/shared_library_c/src/interface.h +++ b/tests/projects/c/shared_library/src/interface.h diff --git a/tests/projects/merge_object/src/test.c b/tests/projects/c/shared_library/src/test.c index 9505a2f75..9505a2f75 100644 --- a/tests/projects/merge_object/src/test.c +++ b/tests/projects/c/shared_library/src/test.c diff --git a/tests/projects/shared_library_c++/test.lua b/tests/projects/c/shared_library/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/shared_library_c++/test.lua +++ b/tests/projects/c/shared_library/test.lua diff --git a/tests/projects/shared_library_c/xmake.lua b/tests/projects/c/shared_library/xmake.lua index 50bad8879..50bad8879 100644 --- a/tests/projects/shared_library_c/xmake.lua +++ b/tests/projects/c/shared_library/xmake.lua diff --git a/tests/projects/shared_library_c/src/interface.c b/tests/projects/c/static library with spaces/s r c/interface.c index 598d07560..598d07560 100644 --- a/tests/projects/shared_library_c/src/interface.c +++ b/tests/projects/c/static library with spaces/s r c/interface.c diff --git a/tests/projects/merge_object/src/interface.h b/tests/projects/c/static library with spaces/s r c/interface.h index 10ec0f856..10ec0f856 100644 --- a/tests/projects/merge_object/src/interface.h +++ b/tests/projects/c/static library with spaces/s r c/interface.h diff --git a/tests/projects/shared_library_c/src/test.c b/tests/projects/c/static library with spaces/s r c/test.c index 9505a2f75..9505a2f75 100644 --- a/tests/projects/shared_library_c/src/test.c +++ b/tests/projects/c/static library with spaces/s r c/test.c diff --git a/tests/projects/shared_library_c/test.lua b/tests/projects/c/static library with spaces/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/shared_library_c/test.lua +++ b/tests/projects/c/static library with spaces/test.lua diff --git a/tests/projects/static library c/xmake.lua b/tests/projects/c/static library with spaces/xmake.lua index 318c286ee..318c286ee 100644 --- a/tests/projects/static library c/xmake.lua +++ b/tests/projects/c/static library with spaces/xmake.lua diff --git a/tests/projects/static library c/s r c/interface.c b/tests/projects/c/static_library/src/interface.c index 598d07560..598d07560 100644 --- a/tests/projects/static library c/s r c/interface.c +++ b/tests/projects/c/static_library/src/interface.c diff --git a/tests/projects/static library c/s r c/interface.h b/tests/projects/c/static_library/src/interface.h index 10ec0f856..10ec0f856 100644 --- a/tests/projects/static library c/s r c/interface.h +++ b/tests/projects/c/static_library/src/interface.h diff --git a/tests/projects/static library c/s r c/test.c b/tests/projects/c/static_library/src/test.c index 9505a2f75..9505a2f75 100644 --- a/tests/projects/static library c/s r c/test.c +++ b/tests/projects/c/static_library/src/test.c diff --git a/tests/projects/static library c/test.lua b/tests/projects/c/static_library/test.lua index 1ff9219ba..1ff9219ba 100644 --- a/tests/projects/static library c/test.lua +++ b/tests/projects/c/static_library/test.lua diff --git a/tests/projects/static_library_c/xmake.lua b/tests/projects/c/static_library/xmake.lua index 842921894..842921894 100644 --- a/tests/projects/static_library_c/xmake.lua +++ b/tests/projects/c/static_library/xmake.lua diff --git a/tests/projects/cuda_console/inc/cuda_drvapi_dynlink.c b/tests/projects/cuda/console/inc/cuda_drvapi_dynlink.c index bd7f69d3d..bd7f69d3d 100644 --- a/tests/projects/cuda_console/inc/cuda_drvapi_dynlink.c +++ b/tests/projects/cuda/console/inc/cuda_drvapi_dynlink.c diff --git a/tests/projects/cuda_console/inc/drvapi_error_string.h b/tests/projects/cuda/console/inc/drvapi_error_string.h index f29d10d70..f29d10d70 100644 --- a/tests/projects/cuda_console/inc/drvapi_error_string.h +++ b/tests/projects/cuda/console/inc/drvapi_error_string.h diff --git a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink.h b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink.h index f4549d0fc..f4549d0fc 100644 --- a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink.h +++ b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink.h diff --git a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_cuda.h b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_cuda.h index 602f61efc..602f61efc 100644 --- a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_cuda.h +++ b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_cuda.h diff --git a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_d3d.h b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_d3d.h index f533c517e..f533c517e 100644 --- a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_d3d.h +++ b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_d3d.h diff --git a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_gl.h b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_gl.h index 6b711c2bd..6b711c2bd 100644 --- a/tests/projects/cuda_console/inc/dynlink/cuda_drvapi_dynlink_gl.h +++ b/tests/projects/cuda/console/inc/dynlink/cuda_drvapi_dynlink_gl.h diff --git a/tests/projects/cuda_console/inc/dynlink_d3d10.h b/tests/projects/cuda/console/inc/dynlink_d3d10.h index 83adb5d9c..83adb5d9c 100644 --- a/tests/projects/cuda_console/inc/dynlink_d3d10.h +++ b/tests/projects/cuda/console/inc/dynlink_d3d10.h diff --git a/tests/projects/cuda_console/inc/dynlink_d3d11.h b/tests/projects/cuda/console/inc/dynlink_d3d11.h index cf1b4654a..cf1b4654a 100644 --- a/tests/projects/cuda_console/inc/dynlink_d3d11.h +++ b/tests/projects/cuda/console/inc/dynlink_d3d11.h diff --git a/tests/projects/cuda_console/inc/exception.h b/tests/projects/cuda/console/inc/exception.h index adda4bce6..adda4bce6 100644 --- a/tests/projects/cuda_console/inc/exception.h +++ b/tests/projects/cuda/console/inc/exception.h diff --git a/tests/projects/cuda_console/inc/helper_cuda.h b/tests/projects/cuda/console/inc/helper_cuda.h index 75e3eb242..75e3eb242 100644 --- a/tests/projects/cuda_console/inc/helper_cuda.h +++ b/tests/projects/cuda/console/inc/helper_cuda.h diff --git a/tests/projects/cuda_console/inc/helper_cuda_drvapi.h b/tests/projects/cuda/console/inc/helper_cuda_drvapi.h index 1d35305f1..1d35305f1 100644 --- a/tests/projects/cuda_console/inc/helper_cuda_drvapi.h +++ b/tests/projects/cuda/console/inc/helper_cuda_drvapi.h diff --git a/tests/projects/cuda_console/inc/helper_cuda_gl.h b/tests/projects/cuda/console/inc/helper_cuda_gl.h index 1923b8da0..1923b8da0 100644 --- a/tests/projects/cuda_console/inc/helper_cuda_gl.h +++ b/tests/projects/cuda/console/inc/helper_cuda_gl.h diff --git a/tests/projects/cuda_console/inc/helper_cusolver.h b/tests/projects/cuda/console/inc/helper_cusolver.h index d614d1f4e..d614d1f4e 100644 --- a/tests/projects/cuda_console/inc/helper_cusolver.h +++ b/tests/projects/cuda/console/inc/helper_cusolver.h diff --git a/tests/projects/cuda_console/inc/helper_functions.h b/tests/projects/cuda/console/inc/helper_functions.h index 11538ba72..11538ba72 100644 --- a/tests/projects/cuda_console/inc/helper_functions.h +++ b/tests/projects/cuda/console/inc/helper_functions.h diff --git a/tests/projects/cuda_console/inc/helper_gl.h b/tests/projects/cuda/console/inc/helper_gl.h index 83addd433..83addd433 100644 --- a/tests/projects/cuda_console/inc/helper_gl.h +++ b/tests/projects/cuda/console/inc/helper_gl.h diff --git a/tests/projects/cuda_console/inc/helper_image.h b/tests/projects/cuda/console/inc/helper_image.h index 4e8b25cdf..4e8b25cdf 100644 --- a/tests/projects/cuda_console/inc/helper_image.h +++ b/tests/projects/cuda/console/inc/helper_image.h diff --git a/tests/projects/cuda_console/inc/helper_math.h b/tests/projects/cuda/console/inc/helper_math.h index c9c07c3e7..c9c07c3e7 100644 --- a/tests/projects/cuda_console/inc/helper_math.h +++ b/tests/projects/cuda/console/inc/helper_math.h diff --git a/tests/projects/cuda_console/inc/helper_string.h b/tests/projects/cuda/console/inc/helper_string.h index c4cc273fc..c4cc273fc 100644 --- a/tests/projects/cuda_console/inc/helper_string.h +++ b/tests/projects/cuda/console/inc/helper_string.h diff --git a/tests/projects/cuda_console/inc/helper_timer.h b/tests/projects/cuda/console/inc/helper_timer.h index 39ddc77f2..39ddc77f2 100644 --- a/tests/projects/cuda_console/inc/helper_timer.h +++ b/tests/projects/cuda/console/inc/helper_timer.h diff --git a/tests/projects/cuda_console/inc/multithreading.h b/tests/projects/cuda/console/inc/multithreading.h index f31b72737..f31b72737 100644 --- a/tests/projects/cuda_console/inc/multithreading.h +++ b/tests/projects/cuda/console/inc/multithreading.h diff --git a/tests/projects/cuda_console/inc/nvMath.h b/tests/projects/cuda/console/inc/nvMath.h index a9b91522e..a9b91522e 100644 --- a/tests/projects/cuda_console/inc/nvMath.h +++ b/tests/projects/cuda/console/inc/nvMath.h diff --git a/tests/projects/cuda_console/inc/nvMatrix.h b/tests/projects/cuda/console/inc/nvMatrix.h index 31ad6ecc5..31ad6ecc5 100644 --- a/tests/projects/cuda_console/inc/nvMatrix.h +++ b/tests/projects/cuda/console/inc/nvMatrix.h diff --git a/tests/projects/cuda_console/inc/nvQuaternion.h b/tests/projects/cuda/console/inc/nvQuaternion.h index 9b5d9b93e..9b5d9b93e 100644 --- a/tests/projects/cuda_console/inc/nvQuaternion.h +++ b/tests/projects/cuda/console/inc/nvQuaternion.h diff --git a/tests/projects/cuda_console/inc/nvShaderUtils.h b/tests/projects/cuda/console/inc/nvShaderUtils.h index 3c41c763f..3c41c763f 100644 --- a/tests/projects/cuda_console/inc/nvShaderUtils.h +++ b/tests/projects/cuda/console/inc/nvShaderUtils.h diff --git a/tests/projects/cuda_console/inc/nvVector.h b/tests/projects/cuda/console/inc/nvVector.h index f0c25759e..f0c25759e 100644 --- a/tests/projects/cuda_console/inc/nvVector.h +++ b/tests/projects/cuda/console/inc/nvVector.h diff --git a/tests/projects/cuda_console/inc/nvrtc_helper.h b/tests/projects/cuda/console/inc/nvrtc_helper.h index 14abc65f4..14abc65f4 100644 --- a/tests/projects/cuda_console/inc/nvrtc_helper.h +++ b/tests/projects/cuda/console/inc/nvrtc_helper.h diff --git a/tests/projects/cuda_console/inc/param.h b/tests/projects/cuda/console/inc/param.h index 22962c07e..22962c07e 100644 --- a/tests/projects/cuda_console/inc/param.h +++ b/tests/projects/cuda/console/inc/param.h diff --git a/tests/projects/cuda_console/inc/paramgl.h b/tests/projects/cuda/console/inc/paramgl.h index 1c42b0b89..1c42b0b89 100644 --- a/tests/projects/cuda_console/inc/paramgl.h +++ b/tests/projects/cuda/console/inc/paramgl.h diff --git a/tests/projects/cuda_console/inc/rendercheck_d3d10.h b/tests/projects/cuda/console/inc/rendercheck_d3d10.h index 594429c7f..594429c7f 100644 --- a/tests/projects/cuda_console/inc/rendercheck_d3d10.h +++ b/tests/projects/cuda/console/inc/rendercheck_d3d10.h diff --git a/tests/projects/cuda_console/inc/rendercheck_d3d11.h b/tests/projects/cuda/console/inc/rendercheck_d3d11.h index c2f21f0a6..c2f21f0a6 100644 --- a/tests/projects/cuda_console/inc/rendercheck_d3d11.h +++ b/tests/projects/cuda/console/inc/rendercheck_d3d11.h diff --git a/tests/projects/cuda_console/inc/rendercheck_d3d9.h b/tests/projects/cuda/console/inc/rendercheck_d3d9.h index c577abcde..c577abcde 100644 --- a/tests/projects/cuda_console/inc/rendercheck_d3d9.h +++ b/tests/projects/cuda/console/inc/rendercheck_d3d9.h diff --git a/tests/projects/cuda_console/inc/rendercheck_gl.h b/tests/projects/cuda/console/inc/rendercheck_gl.h index 3c5c036a9..3c5c036a9 100644 --- a/tests/projects/cuda_console/inc/rendercheck_gl.h +++ b/tests/projects/cuda/console/inc/rendercheck_gl.h diff --git a/tests/projects/cuda_console/inc/rendercheck_gles.h b/tests/projects/cuda/console/inc/rendercheck_gles.h index a35984b06..a35984b06 100644 --- a/tests/projects/cuda_console/inc/rendercheck_gles.h +++ b/tests/projects/cuda/console/inc/rendercheck_gles.h diff --git a/tests/projects/cuda_console/inc/timer.h b/tests/projects/cuda/console/inc/timer.h index d856eb1f3..d856eb1f3 100644 --- a/tests/projects/cuda_console/inc/timer.h +++ b/tests/projects/cuda/console/inc/timer.h diff --git a/tests/projects/cuda_console/src/main.cu b/tests/projects/cuda/console/src/main.cu index a02371a2d..a02371a2d 100644 --- a/tests/projects/cuda_console/src/main.cu +++ b/tests/projects/cuda/console/src/main.cu diff --git a/tests/projects/cuda_console/xmake.lua b/tests/projects/cuda/console/xmake.lua index a1590891e..a1590891e 100644 --- a/tests/projects/cuda_console/xmake.lua +++ b/tests/projects/cuda/console/xmake.lua diff --git a/tests/projects/console_dlang/src/main.d b/tests/projects/dlang/console/src/main.d index 524c4f94c..524c4f94c 100644 --- a/tests/projects/console_dlang/src/main.d +++ b/tests/projects/dlang/console/src/main.d diff --git a/tests/projects/console_dlang/test.lua b/tests/projects/dlang/console/test.lua index 82d2b61eb..82d2b61eb 100644 --- a/tests/projects/console_dlang/test.lua +++ b/tests/projects/dlang/console/test.lua diff --git a/tests/projects/console_dlang/xmake.lua b/tests/projects/dlang/console/xmake.lua index 2f040a763..2f040a763 100644 --- a/tests/projects/console_dlang/xmake.lua +++ b/tests/projects/dlang/console/xmake.lua diff --git a/tests/projects/shared_library_dlang/src/interfaces.d b/tests/projects/dlang/shared_library/src/interfaces.d index 3386c9124..3386c9124 100644 --- a/tests/projects/shared_library_dlang/src/interfaces.d +++ b/tests/projects/dlang/shared_library/src/interfaces.d diff --git a/tests/projects/shared_library_dlang/src/main.d b/tests/projects/dlang/shared_library/src/main.d index 3137de217..3137de217 100644 --- a/tests/projects/shared_library_dlang/src/main.d +++ b/tests/projects/dlang/shared_library/src/main.d diff --git a/tests/projects/console_go/test.lua b/tests/projects/dlang/shared_library/test.lua index 82d2b61eb..82d2b61eb 100644 --- a/tests/projects/console_go/test.lua +++ b/tests/projects/dlang/shared_library/test.lua diff --git a/tests/projects/shared_library_dlang/xmake.lua b/tests/projects/dlang/shared_library/xmake.lua index c7fac23ca..c7fac23ca 100644 --- a/tests/projects/shared_library_dlang/xmake.lua +++ b/tests/projects/dlang/shared_library/xmake.lua diff --git a/tests/projects/static_library_dlang/src/interfaces.d b/tests/projects/dlang/static_library/src/interfaces.d index 3386c9124..3386c9124 100644 --- a/tests/projects/static_library_dlang/src/interfaces.d +++ b/tests/projects/dlang/static_library/src/interfaces.d diff --git a/tests/projects/static_library_dlang/src/main.d b/tests/projects/dlang/static_library/src/main.d index 3137de217..3137de217 100644 --- a/tests/projects/static_library_dlang/src/main.d +++ b/tests/projects/dlang/static_library/src/main.d diff --git a/tests/projects/static_library_dlang/xmake.lua b/tests/projects/dlang/static_library/xmake.lua index 1fd0d1ee9..1fd0d1ee9 100644 --- a/tests/projects/static_library_dlang/xmake.lua +++ b/tests/projects/dlang/static_library/xmake.lua diff --git a/tests/projects/console_go/src/main.go b/tests/projects/go/console/src/main.go index 8ea127243..8ea127243 100644 --- a/tests/projects/console_go/src/main.go +++ b/tests/projects/go/console/src/main.go diff --git a/tests/projects/console_rust/test.lua b/tests/projects/go/console/test.lua index 82d2b61eb..82d2b61eb 100644 --- a/tests/projects/console_rust/test.lua +++ b/tests/projects/go/console/test.lua diff --git a/tests/projects/console_go/xmake.lua b/tests/projects/go/console/xmake.lua index d69c3d457..d69c3d457 100644 --- a/tests/projects/console_go/xmake.lua +++ b/tests/projects/go/console/xmake.lua diff --git a/tests/projects/static_library_go/src/main.go b/tests/projects/go/static_library/src/main.go index f2b477453..f2b477453 100644 --- a/tests/projects/static_library_go/src/main.go +++ b/tests/projects/go/static_library/src/main.go diff --git a/tests/projects/static_library_go/src/test.go b/tests/projects/go/static_library/src/test.go index cf10523f9..cf10523f9 100644 --- a/tests/projects/static_library_go/src/test.go +++ b/tests/projects/go/static_library/src/test.go diff --git a/tests/projects/static_library_go/src/test/add.go b/tests/projects/go/static_library/src/test/add.go index 98ffef600..98ffef600 100644 --- a/tests/projects/static_library_go/src/test/add.go +++ b/tests/projects/go/static_library/src/test/add.go diff --git a/tests/projects/static_library_go/src/test/sub.go b/tests/projects/go/static_library/src/test/sub.go index a24a9abb7..a24a9abb7 100644 --- a/tests/projects/static_library_go/src/test/sub.go +++ b/tests/projects/go/static_library/src/test/sub.go diff --git a/tests/projects/shared_library_dlang/test.lua b/tests/projects/go/static_library/test.lua index 82d2b61eb..82d2b61eb 100644 --- a/tests/projects/shared_library_dlang/test.lua +++ b/tests/projects/go/static_library/test.lua diff --git a/tests/projects/static_library_go/xmake.lua b/tests/projects/go/static_library/xmake.lua index 603b661a9..603b661a9 100644 --- a/tests/projects/static_library_go/xmake.lua +++ b/tests/projects/go/static_library/xmake.lua diff --git a/tests/projects/merge_object/xmake.lua b/tests/projects/merge_object/xmake.lua deleted file mode 100644 index b8f971536..000000000 --- a/tests/projects/merge_object/xmake.lua +++ /dev/null @@ -1,45 +0,0 @@ --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("merge_object") - - -- set kind - set_kind("static") - - -- add files - add_files("src/interface.c") - --- add target -target("test") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("merge_object") - - -- add files - add_files("src/test.c") - add_files("build/.objs/merge_object/src/interface.c.o") - diff --git a/tests/projects/merge_static_library/src/add.c b/tests/projects/merge_static_library/src/add.c deleted file mode 100644 index be1e084fc..000000000 --- a/tests/projects/merge_static_library/src/add.c +++ /dev/null @@ -1,4 +0,0 @@ -int add(int a, int b) -{ - return a + b; -} diff --git a/tests/projects/merge_static_library/src/mul.c b/tests/projects/merge_static_library/src/mul.c deleted file mode 100644 index c4292f9aa..000000000 --- a/tests/projects/merge_static_library/src/mul.c +++ /dev/null @@ -1,4 +0,0 @@ -int mul(int a, int b) -{ - return a * b; -} diff --git a/tests/projects/merge_static_library/src/sub.c b/tests/projects/merge_static_library/src/sub.c deleted file mode 100644 index b151ec4bc..000000000 --- a/tests/projects/merge_static_library/src/sub.c +++ /dev/null @@ -1,4 +0,0 @@ -int sub(int a, int b) -{ - return a - b; -} diff --git a/tests/projects/merge_static_library/xmake.lua b/tests/projects/merge_static_library/xmake.lua deleted file mode 100644 index bd36a983a..000000000 --- a/tests/projects/merge_static_library/xmake.lua +++ /dev/null @@ -1,58 +0,0 @@ --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("add") - - -- set kind - set_kind("static") - - -- add files - add_files("src/add.c") - --- add target -target("sub") - - -- set kind - set_kind("static") - - -- add files - add_files("src/sub.c") - --- add target -target("mul") - - -- set kind - set_kind("static") - - -- add deps - add_deps("add", "sub") - - -- add files - add_files("src/mul.c") - add_files("build/libadd.a") - add_files("build/libsub.a") - - -- add link directory - add_linkdirs("$(buildir)") - diff --git a/tests/projects/console_objc++/src/main.mm b/tests/projects/objc++/console/src/main.mm index 61a3f5875..61a3f5875 100644 --- a/tests/projects/console_objc++/src/main.mm +++ b/tests/projects/objc++/console/src/main.mm diff --git a/tests/projects/console_objc++/test.lua b/tests/projects/objc++/console/test.lua index be0449702..be0449702 100644 --- a/tests/projects/console_objc++/test.lua +++ b/tests/projects/objc++/console/test.lua diff --git a/tests/projects/console_objc++/xmake.lua b/tests/projects/objc++/console/xmake.lua index a9229c7f3..a9229c7f3 100644 --- a/tests/projects/console_objc++/xmake.lua +++ b/tests/projects/objc++/console/xmake.lua diff --git a/tests/projects/console_objc/src/main.m b/tests/projects/objc/console/src/main.m index 61a3f5875..61a3f5875 100644 --- a/tests/projects/console_objc/src/main.m +++ b/tests/projects/objc/console/src/main.m diff --git a/tests/projects/console_objc/test.lua b/tests/projects/objc/console/test.lua index be0449702..be0449702 100644 --- a/tests/projects/console_objc/test.lua +++ b/tests/projects/objc/console/test.lua diff --git a/tests/projects/console_objc/xmake.lua b/tests/projects/objc/console/xmake.lua index 146262351..146262351 100644 --- a/tests/projects/console_objc/xmake.lua +++ b/tests/projects/objc/console/xmake.lua diff --git a/tests/projects/qt_console/src/main.cpp b/tests/projects/qt/console/src/main.cpp index de25444ff..de25444ff 100644 --- a/tests/projects/qt_console/src/main.cpp +++ b/tests/projects/qt/console/src/main.cpp diff --git a/tests/projects/qt_console/xmake.lua b/tests/projects/qt/console/xmake.lua index 249f52cdd..249f52cdd 100644 --- a/tests/projects/qt_console/xmake.lua +++ b/tests/projects/qt/console/xmake.lua diff --git a/tests/projects/qt_quickapp/src/main.cpp b/tests/projects/qt/quickapp/src/main.cpp index 6333b85c4..6333b85c4 100644 --- a/tests/projects/qt_quickapp/src/main.cpp +++ b/tests/projects/qt/quickapp/src/main.cpp diff --git a/tests/projects/qt_quickapp/src/main.qml b/tests/projects/qt/quickapp/src/main.qml index 188049dae..188049dae 100644 --- a/tests/projects/qt_quickapp/src/main.qml +++ b/tests/projects/qt/quickapp/src/main.qml diff --git a/tests/projects/qt_quickapp/src/qml.qrc b/tests/projects/qt/quickapp/src/qml.qrc index 5f6483ac3..5f6483ac3 100644 --- a/tests/projects/qt_quickapp/src/qml.qrc +++ b/tests/projects/qt/quickapp/src/qml.qrc diff --git a/tests/projects/qt_quickapp/xmake.lua b/tests/projects/qt/quickapp/xmake.lua index 111b0d6be..111b0d6be 100644 --- a/tests/projects/qt_quickapp/xmake.lua +++ b/tests/projects/qt/quickapp/xmake.lua diff --git a/tests/projects/qt_shared_library/src/demo.cpp b/tests/projects/qt/shared_library/src/demo.cpp index bd791c271..bd791c271 100644 --- a/tests/projects/qt_shared_library/src/demo.cpp +++ b/tests/projects/qt/shared_library/src/demo.cpp diff --git a/tests/projects/qt_shared_library/src/demo.h b/tests/projects/qt/shared_library/src/demo.h index d88dc29ee..d88dc29ee 100644 --- a/tests/projects/qt_shared_library/src/demo.h +++ b/tests/projects/qt/shared_library/src/demo.h diff --git a/tests/projects/qt_shared_library/src/demo_global.h b/tests/projects/qt/shared_library/src/demo_global.h index 25abfb05c..25abfb05c 100644 --- a/tests/projects/qt_shared_library/src/demo_global.h +++ b/tests/projects/qt/shared_library/src/demo_global.h diff --git a/tests/projects/qt_shared_library/xmake.lua b/tests/projects/qt/shared_library/xmake.lua index 803065b72..803065b72 100644 --- a/tests/projects/qt_shared_library/xmake.lua +++ b/tests/projects/qt/shared_library/xmake.lua diff --git a/tests/projects/qt_static_library/src/demo.cpp b/tests/projects/qt/static_library/src/demo.cpp index a702ad253..a702ad253 100644 --- a/tests/projects/qt_static_library/src/demo.cpp +++ b/tests/projects/qt/static_library/src/demo.cpp diff --git a/tests/projects/qt_static_library/src/demo.h b/tests/projects/qt/static_library/src/demo.h index 51eb9be55..51eb9be55 100644 --- a/tests/projects/qt_static_library/src/demo.h +++ b/tests/projects/qt/static_library/src/demo.h diff --git a/tests/projects/qt_static_library/xmake.lua b/tests/projects/qt/static_library/xmake.lua index ce755850a..ce755850a 100644 --- a/tests/projects/qt_static_library/xmake.lua +++ b/tests/projects/qt/static_library/xmake.lua diff --git a/tests/projects/qt_widgetapp/src/main.cpp b/tests/projects/qt/widgetapp/src/main.cpp index b48f94ec8..b48f94ec8 100644 --- a/tests/projects/qt_widgetapp/src/main.cpp +++ b/tests/projects/qt/widgetapp/src/main.cpp diff --git a/tests/projects/qt_widgetapp/src/mainwindow.cpp b/tests/projects/qt/widgetapp/src/mainwindow.cpp index 49d64fce7..49d64fce7 100644 --- a/tests/projects/qt_widgetapp/src/mainwindow.cpp +++ b/tests/projects/qt/widgetapp/src/mainwindow.cpp diff --git a/tests/projects/qt_widgetapp/src/mainwindow.h b/tests/projects/qt/widgetapp/src/mainwindow.h index a3948a917..a3948a917 100644 --- a/tests/projects/qt_widgetapp/src/mainwindow.h +++ b/tests/projects/qt/widgetapp/src/mainwindow.h diff --git a/tests/projects/qt_widgetapp/src/mainwindow.ui b/tests/projects/qt/widgetapp/src/mainwindow.ui index 6050363fa..6050363fa 100644 --- a/tests/projects/qt_widgetapp/src/mainwindow.ui +++ b/tests/projects/qt/widgetapp/src/mainwindow.ui diff --git a/tests/projects/qt_widgetapp/xmake.lua b/tests/projects/qt/widgetapp/xmake.lua index 1d1a3ba3a..1d1a3ba3a 100644 --- a/tests/projects/qt_widgetapp/xmake.lua +++ b/tests/projects/qt/widgetapp/xmake.lua diff --git a/tests/projects/requires/src/main.c b/tests/projects/requires/src/main.c deleted file mode 100755 index 9ae580511..000000000 --- a/tests/projects/requires/src/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main(int argc, char** argv) -{ - printf("hello world!\n"); - return 0; -} diff --git a/tests/projects/requires/test.lua b/tests/projects/requires/test.lua deleted file mode 100644 index eacf35408..000000000 --- a/tests/projects/requires/test.lua +++ /dev/null @@ -1,10 +0,0 @@ --- imports -import("..build") - --- main entry -function main() - - -- TODO - -- build project --- build() -end diff --git a/tests/projects/requires/xmake.lua b/tests/projects/requires/xmake.lua deleted file mode 100644 index 9b2acfc4a..000000000 --- a/tests/projects/requires/xmake.lua +++ /dev/null @@ -1,52 +0,0 @@ --- define package -package("mbedtls") - set_urls("https://github.com/ARMmbed/mbedtls.git") - add_deps("https://github.com/glennrp/libpng.git@libpng >=1.6.28") -package_end() - --- group packages -package("zlib-mbedtls") - add_deps("zlib >=1.2.11", {system = false}) - add_deps("mbedtls", {optional = true}) -package_end() - --- requires -add_requires("zlib-mbedtls") -add_requires("[email protected] ~1.6.0", {alias = "tbox"}) -add_requires("unknown", {optional = true}) - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("console_c") - - -- set kind - set_kind("binary") - - -- add files - add_files("src/*.c") - - -- add packages - add_packages("tbox", "zlib-mbedtls") - diff --git a/tests/projects/console_rust/src/main.rs b/tests/projects/rust/console/src/main.rs index e8d2ae9b2..e8d2ae9b2 100644 --- a/tests/projects/console_rust/src/main.rs +++ b/tests/projects/rust/console/src/main.rs diff --git a/tests/projects/static_library_go/test.lua b/tests/projects/rust/console/test.lua index 82d2b61eb..82d2b61eb 100644 --- a/tests/projects/static_library_go/test.lua +++ b/tests/projects/rust/console/test.lua diff --git a/tests/projects/console_rust/xmake.lua b/tests/projects/rust/console/xmake.lua index 57d18582b..57d18582b 100644 --- a/tests/projects/console_rust/xmake.lua +++ b/tests/projects/rust/console/xmake.lua diff --git a/tests/projects/static_library_rust/src/interfaces.rs b/tests/projects/rust/static_library/src/interfaces.rs index 277008ba4..277008ba4 100644 --- a/tests/projects/static_library_rust/src/interfaces.rs +++ b/tests/projects/rust/static_library/src/interfaces.rs diff --git a/tests/projects/static_library_rust/src/main.rs b/tests/projects/rust/static_library/src/main.rs index 0cd4449d1..0cd4449d1 100644 --- a/tests/projects/static_library_rust/src/main.rs +++ b/tests/projects/rust/static_library/src/main.rs diff --git a/tests/projects/static_library_rust/test.lua b/tests/projects/rust/static_library/test.lua index 82d2b61eb..82d2b61eb 100644 --- a/tests/projects/static_library_rust/test.lua +++ b/tests/projects/rust/static_library/test.lua diff --git a/tests/projects/static_library_rust/xmake.lua b/tests/projects/rust/static_library/xmake.lua index d665e86e9..d665e86e9 100644 --- a/tests/projects/static_library_rust/xmake.lua +++ b/tests/projects/rust/static_library/xmake.lua diff --git a/tests/projects/static_library_c++/test.lua b/tests/projects/static_library_c++/test.lua deleted file mode 100644 index 1ff9219ba..000000000 --- a/tests/projects/static_library_c++/test.lua +++ /dev/null @@ -1,9 +0,0 @@ --- imports -import("..build") - --- main entry -function main() - - -- build project - build() -end diff --git a/tests/projects/static_library_c/src/interface.c b/tests/projects/static_library_c/src/interface.c deleted file mode 100644 index 598d07560..000000000 --- a/tests/projects/static_library_c/src/interface.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "interface.h" - -int add(int a, int b) -{ - return a + b; -} diff --git a/tests/projects/static_library_c/src/interface.h b/tests/projects/static_library_c/src/interface.h deleted file mode 100644 index 10ec0f856..000000000 --- a/tests/projects/static_library_c/src/interface.h +++ /dev/null @@ -1,8 +0,0 @@ -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -int add(int a, int b); diff --git a/tests/projects/static_library_c/src/test.c b/tests/projects/static_library_c/src/test.c deleted file mode 100644 index 9505a2f75..000000000 --- a/tests/projects/static_library_c/src/test.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "interface.h" -#include <stdio.h> - -int main(int argc, char** argv) -{ - printf("add(1, 2) = %d\n", add(1, 2)); - return 0; -} diff --git a/tests/projects/static_library_c/test.lua b/tests/projects/static_library_c/test.lua deleted file mode 100644 index 1ff9219ba..000000000 --- a/tests/projects/static_library_c/test.lua +++ /dev/null @@ -1,9 +0,0 @@ --- imports -import("..build") - --- main entry -function main() - - -- build project - build() -end diff --git a/tests/projects/console_swift/src/main.swift b/tests/projects/swift/console/src/main.swift index ee21045f4..ee21045f4 100644 --- a/tests/projects/console_swift/src/main.swift +++ b/tests/projects/swift/console/src/main.swift diff --git a/tests/projects/console_swift/test.lua b/tests/projects/swift/console/test.lua index be0449702..be0449702 100644 --- a/tests/projects/console_swift/test.lua +++ b/tests/projects/swift/console/test.lua diff --git a/tests/projects/console_swift/xmake.lua b/tests/projects/swift/console/xmake.lua index 8a368c0af..8a368c0af 100644 --- a/tests/projects/console_swift/xmake.lua +++ b/tests/projects/swift/console/xmake.lua diff --git a/tests/projects/wdk/kmdf/ioctl/driver/localwpp.ini b/tests/projects/wdk/kmdf/ioctl/driver/localwpp.ini new file mode 100644 index 000000000..c290070a7 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/driver/localwpp.ini @@ -0,0 +1,17 @@ +// +// This defines how to log a len/buffer pair. +// This function should be in trace.h +// + +DEFINE_CPLX_TYPE(HEXDUMP, WPP_LOGHEXDUMP, xstr_t, ItemHEXDump,"s", _HEX_, 0,2); + +// DEFINE_CPLX_TYPE( +// name, // i.e. HEXDUMP // %!HEXDUMP! +// macro, // i.e. WPP_LOGHEXDUMP // Marshalling macro, defined in trace.h +// structure, // i.e. xstr_t // Argument type (structure to be created by above macro) +// item type, // i.e. ItemHEXDump // MOF type that TracePrt can understand +// format specifier, // i.e. "s" // a format specifier that TracePrt can understand +// ???? // i.e. _HEX_ // Type signature (becomes a part of function name) +// ???? // i.e. 0 // Weight (0 is variable data length) +// ???? // i.e. 2 // Slots used by this entry (optional, 1 default) +// ) diff --git a/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.c b/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.c new file mode 100644 index 000000000..f2db8e1af --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.c @@ -0,0 +1,1309 @@ +/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+Module Name:
+
+ nonpnp.c
+
+Abstract:
+
+ Purpose of this driver is to demonstrate how to write a legacy (NON WDM)
+ driver using framework, show how to handle 4 different ioctls -
+ METHOD_NEITHER - in particular and also show how to read & write to file
+ from KernelMode using Zw functions.
+
+ For a non-framework version of sample on how to handle IOCTLs in driver,
+ study src\general\IOCTL in the DDK.
+
+Environment:
+
+ Kernel mode only.
+
+--*/
+
+#include "nonpnp.h"
+
+//
+// The trace message header file must be included in a source file
+// before any WPP macro calls and after defining a WPP_CONTROL_GUIDS
+// macro. During the compilation, WPP scans the source files for
+// TraceEvents() calls and builds a .tmh file which stores a unique
+// data GUID for each message, the text resource string for each message,
+// and the data types of the variables passed in for each message.
+// This file is automatically generated and used during post-processing.
+//
+#include "nonpnp.tmh"
+
+
+#ifdef ALLOC_PRAGMA
+#pragma alloc_text( INIT, DriverEntry )
+#pragma alloc_text( PAGE, NonPnpDeviceAdd)
+#pragma alloc_text( PAGE, NonPnpEvtDriverContextCleanup)
+#pragma alloc_text( PAGE, NonPnpEvtDriverUnload)
+#pragma alloc_text( PAGE, NonPnpEvtDeviceIoInCallerContext)
+#pragma alloc_text( PAGE, NonPnpEvtDeviceFileCreate)
+#pragma alloc_text( PAGE, NonPnpEvtFileClose)
+#pragma alloc_text( PAGE, FileEvtIoRead)
+#pragma alloc_text( PAGE, FileEvtIoWrite)
+#pragma alloc_text( PAGE, FileEvtIoDeviceControl)
+#endif // ALLOC_PRAGMA
+
+
+NTSTATUS
+DriverEntry(
+ IN OUT PDRIVER_OBJECT DriverObject,
+ IN PUNICODE_STRING RegistryPath
+ )
+/*++
+
+Routine Description:
+ This routine is called by the Operating System to initialize the driver.
+
+ It creates the device object, fills in the dispatch entry points and
+ completes the initialization.
+
+Arguments:
+ DriverObject - a pointer to the object that represents this device
+ driver.
+
+ RegistryPath - a pointer to our Services key in the registry.
+
+Return Value:
+ STATUS_SUCCESS if initialized; an error otherwise.
+
+--*/
+{
+ NTSTATUS status;
+ WDF_DRIVER_CONFIG config;
+ WDFDRIVER hDriver;
+ PWDFDEVICE_INIT pInit = NULL;
+ WDF_OBJECT_ATTRIBUTES attributes;
+
+ KdPrint(("Driver Frameworks NONPNP Legacy Driver Example\n"));
+
+
+ WDF_DRIVER_CONFIG_INIT(
+ &config,
+ WDF_NO_EVENT_CALLBACK // This is a non-pnp driver.
+ );
+
+ //
+ // Tell the framework that this is non-pnp driver so that it doesn't
+ // set the default AddDevice routine.
+ //
+ config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
+
+ //
+ // NonPnp driver must explicitly register an unload routine for
+ // the driver to be unloaded.
+ //
+ config.EvtDriverUnload = NonPnpEvtDriverUnload;
+
+ //
+ // Register a cleanup callback so that we can call WPP_CLEANUP when
+ // the framework driver object is deleted during driver unload.
+ //
+ WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
+ attributes.EvtCleanupCallback = NonPnpEvtDriverContextCleanup;
+
+ //
+ // Create a framework driver object to represent our driver.
+ //
+ status = WdfDriverCreate(DriverObject,
+ RegistryPath,
+ &attributes,
+ &config,
+ &hDriver);
+ if (!NT_SUCCESS(status)) {
+ KdPrint (("NonPnp: WdfDriverCreate failed with status 0x%x\n", status));
+ return status;
+ }
+
+ //
+ // Since we are calling WPP_CLEANUP in the DriverContextCleanup
+ // callback we should initialize WPP Tracing after WDFDRIVER
+ // object is created to ensure that we cleanup WPP properly
+ // if we return failure status from DriverEntry. This
+ // eliminates the need to call WPP_CLEANUP in every path
+ // of DriverEntry.
+ //
+ WPP_INIT_TRACING( DriverObject, RegistryPath );
+
+ //
+ // On Win2K system, you will experience some delay in getting trace events
+ // due to the way the ETW is activated to accept trace messages.
+ //
+ KdPrint(("NonPnp: DriverEntry: tracing enabled\n"));
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT,
+ "Driver Frameworks NONPNP Legacy Driver Example");
+
+ //
+ //
+ // In order to create a control device, we first need to allocate a
+ // WDFDEVICE_INIT structure and set all properties.
+ //
+ pInit = WdfControlDeviceInitAllocate(
+ hDriver,
+ &SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R
+ );
+
+ if (pInit == NULL) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ return status;
+ }
+
+ //
+ // Call NonPnpDeviceAdd to create a deviceobject to represent our
+ // software device.
+ //
+ status = NonPnpDeviceAdd(hDriver, pInit);
+
+ return status;
+}
+
+NTSTATUS
+NonPnpDeviceAdd(
+ IN WDFDRIVER Driver,
+ IN PWDFDEVICE_INIT DeviceInit
+ )
+/*++
+
+Routine Description:
+
+ Called by the DriverEntry to create a control-device. This call is
+ responsible for freeing the memory for DeviceInit.
+
+Arguments:
+
+ DriverObject - a pointer to the object that represents this device
+ driver.
+
+ DeviceInit - Pointer to a driver-allocated WDFDEVICE_INIT structure.
+
+Return Value:
+
+ STATUS_SUCCESS if initialized; an error otherwise.
+
+--*/
+{
+ NTSTATUS status;
+ WDF_OBJECT_ATTRIBUTES attributes;
+ WDF_IO_QUEUE_CONFIG ioQueueConfig;
+ WDF_FILEOBJECT_CONFIG fileConfig;
+ WDFQUEUE queue;
+ WDFDEVICE controlDevice;
+ DECLARE_CONST_UNICODE_STRING(ntDeviceName, NTDEVICE_NAME_STRING) ;
+ DECLARE_CONST_UNICODE_STRING(symbolicLinkName, SYMBOLIC_NAME_STRING) ;
+
+ UNREFERENCED_PARAMETER( Driver );
+
+ PAGED_CODE();
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT,
+ "NonPnpDeviceAdd DeviceInit %p\n", DeviceInit);
+ //
+ // Set exclusive to TRUE so that no more than one app can talk to the
+ // control device at any time.
+ //
+ WdfDeviceInitSetExclusive(DeviceInit, TRUE);
+
+ WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
+
+
+ status = WdfDeviceInitAssignName(DeviceInit, &ntDeviceName);
+
+ if (!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfDeviceInitAssignName failed %!STATUS!", status);
+ goto End;
+ }
+
+ WdfControlDeviceInitSetShutdownNotification(DeviceInit,
+ NonPnpShutdown,
+ WdfDeviceShutdown);
+
+ //
+ // Initialize WDF_FILEOBJECT_CONFIG_INIT struct to tell the
+ // framework whether you are interested in handling Create, Close and
+ // Cleanup requests that gets generated when an application or another
+ // kernel component opens an handle to the device. If you don't register
+ // the framework default behaviour would be to complete these requests
+ // with STATUS_SUCCESS. A driver might be interested in registering these
+ // events if it wants to do security validation and also wants to maintain
+ // per handle (fileobject) context.
+ //
+
+ WDF_FILEOBJECT_CONFIG_INIT(
+ &fileConfig,
+ NonPnpEvtDeviceFileCreate,
+ NonPnpEvtFileClose,
+ WDF_NO_EVENT_CALLBACK // not interested in Cleanup
+ );
+
+ WdfDeviceInitSetFileObjectConfig(DeviceInit,
+ &fileConfig,
+ WDF_NO_OBJECT_ATTRIBUTES);
+
+ //
+ // In order to support METHOD_NEITHER Device controls, or
+ // NEITHER device I/O type, we need to register for the
+ // EvtDeviceIoInProcessContext callback so that we can handle the request
+ // in the calling threads context.
+ //
+ WdfDeviceInitSetIoInCallerContextCallback(DeviceInit,
+ NonPnpEvtDeviceIoInCallerContext);
+
+ //
+ // Specify the size of device context
+ //
+ WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
+ CONTROL_DEVICE_EXTENSION);
+
+ status = WdfDeviceCreate(&DeviceInit,
+ &attributes,
+ &controlDevice);
+ if (!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfDeviceCreate failed %!STATUS!", status);
+ goto End;
+ }
+
+ //
+ // Create a symbolic link for the control object so that usermode can open
+ // the device.
+ //
+
+
+ status = WdfDeviceCreateSymbolicLink(controlDevice,
+ &symbolicLinkName);
+
+ if (!NT_SUCCESS(status)) {
+ //
+ // Control device will be deleted automatically by the framework.
+ //
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfDeviceCreateSymbolicLink failed %!STATUS!", status);
+ goto End;
+ }
+
+ //
+ // Configure a default queue so that requests that are not
+ // configure-fowarded using WdfDeviceConfigureRequestDispatching to goto
+ // other queues get dispatched here.
+ //
+ WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
+ WdfIoQueueDispatchSequential);
+
+ ioQueueConfig.EvtIoRead = FileEvtIoRead;
+ ioQueueConfig.EvtIoWrite = FileEvtIoWrite;
+ ioQueueConfig.EvtIoDeviceControl = FileEvtIoDeviceControl;
+
+ WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
+ //
+ // Since we are using Zw function set execution level to passive so that
+ // framework ensures that our Io callbacks called at only passive-level
+ // even if the request came in at DISPATCH_LEVEL from another driver.
+ //
+ //attributes.ExecutionLevel = WdfExecutionLevelPassive;
+
+ //
+ // By default, Static Driver Verifier (SDV) displays a warning if it
+ // doesn't find the EvtIoStop callback on a power-managed queue.
+ // The 'assume' below causes SDV to suppress this warning. If the driver
+ // has not explicitly set PowerManaged to WdfFalse, the framework creates
+ // power-managed queues when the device is not a filter driver. Normally
+ // the EvtIoStop is required for power-managed queues, but for this driver
+ // it is not needed b/c the driver doesn't hold on to the requests or
+ // forward them to other drivers. This driver completes the requests
+ // directly in the queue's handlers. If the EvtIoStop callback is not
+ // implemented, the framework waits for all driver-owned requests to be
+ // done before moving in the Dx/sleep states or before removing the
+ // device, which is the correct behavior for this type of driver.
+ // If the requests were taking an indeterminate amount of time to complete,
+ // or if the driver forwarded the requests to a lower driver/another stack,
+ // the queue should have an EvtIoStop/EvtIoResume.
+ //
+ __analysis_assume(ioQueueConfig.EvtIoStop != 0);
+ status = WdfIoQueueCreate(controlDevice,
+ &ioQueueConfig,
+ &attributes,
+ &queue // pointer to default queue
+ );
+ __analysis_assume(ioQueueConfig.EvtIoStop == 0);
+ if (!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfIoQueueCreate failed %!STATUS!", status);
+ goto End;
+ }
+
+ //
+ // Control devices must notify WDF when they are done initializing. I/O is
+ // rejected until this call is made.
+ //
+ WdfControlFinishInitializing(controlDevice);
+
+End:
+ //
+ // If the device is created successfully, framework would clear the
+ // DeviceInit value. Otherwise device create must have failed so we
+ // should free the memory ourself.
+ //
+ if (DeviceInit != NULL) {
+ WdfDeviceInitFree(DeviceInit);
+ }
+
+ return status;
+
+}
+
+VOID
+NonPnpEvtDriverContextCleanup(
+ IN WDFOBJECT Driver
+ )
+/*++
+Routine Description:
+
+ Called when the driver object is deleted during driver unload.
+ You can free all the resources created in DriverEntry that are
+ not automatically freed by the framework.
+
+Arguments:
+
+ Driver - Handle to a framework driver object created in DriverEntry
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT,
+ "Entered NonPnpEvtDriverContextCleanup\n");
+
+ PAGED_CODE();
+
+ //
+ // No need to free the controldevice object explicitly because it will
+ // be deleted when the Driver object is deleted due to the default parent
+ // child relationship between Driver and ControlDevice.
+ //
+ WPP_CLEANUP( WdfDriverWdmGetDriverObject( (WDFDRIVER)Driver ) );
+
+}
+
+
+
+VOID
+NonPnpEvtDeviceFileCreate (
+ IN WDFDEVICE Device,
+ IN WDFREQUEST Request,
+ IN WDFFILEOBJECT FileObject
+ )
+/*++
+
+Routine Description:
+
+ The framework calls a driver's EvtDeviceFileCreate callback
+ when it receives an IRP_MJ_CREATE request.
+ The system sends this request when a user application opens the
+ device to perform an I/O operation, such as reading or writing a file.
+ This callback is called synchronously, in the context of the thread
+ that created the IRP_MJ_CREATE request.
+
+Arguments:
+
+ Device - Handle to a framework device object.
+ FileObject - Pointer to fileobject that represents the open handle.
+ CreateParams - Parameters of IO_STACK_LOCATION for create
+
+Return Value:
+
+ NT status code
+
+--*/
+{
+ PUNICODE_STRING fileName;
+ UNICODE_STRING absFileName, directory;
+ OBJECT_ATTRIBUTES fileAttributes;
+ IO_STATUS_BLOCK ioStatus;
+ PCONTROL_DEVICE_EXTENSION devExt;
+ NTSTATUS status;
+ USHORT length = 0;
+
+
+ UNREFERENCED_PARAMETER( FileObject );
+
+ PAGED_CODE ();
+
+ devExt = ControlGetData(Device);
+
+ //
+ // Assume the directory is a temp directory under %windir%
+ //
+ RtlInitUnicodeString(&directory, L"\\SystemRoot\\temp");
+
+ //
+ // Parsed filename has "\" in the begining. The object manager strips
+ // of all "\", except one, after the device name.
+ //
+ fileName = WdfFileObjectGetFileName(FileObject);
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "NonPnpEvtDeviceFileCreate %wZ%wZ",
+ &directory, fileName);
+
+ //
+ // Find the total length of the directory + filename
+ //
+ length = directory.Length + fileName->Length;
+
+ absFileName.Buffer = ExAllocatePoolWithTag(PagedPool, length, POOL_TAG);
+ if(absFileName.Buffer == NULL) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "ExAllocatePoolWithTag failed");
+ goto End;
+ }
+ absFileName.Length = 0;
+ absFileName.MaximumLength = length;
+
+ status = RtlAppendUnicodeStringToString(&absFileName, &directory);
+ if (!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
+ "RtlAppendUnicodeStringToString failed with status %!STATUS!",
+ status);
+ goto End;
+ }
+
+ status = RtlAppendUnicodeStringToString(&absFileName, fileName);
+ if (!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
+ "RtlAppendUnicodeStringToString failed with status %!STATUS!",
+ status);
+ goto End;
+ }
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "Absolute Filename %wZ", &absFileName);
+
+ InitializeObjectAttributes( &fileAttributes,
+ &absFileName,
+ OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
+ NULL, // RootDirectory
+ NULL // SecurityDescriptor
+ );
+
+ status = ZwCreateFile (
+ &devExt->FileHandle,
+ SYNCHRONIZE | GENERIC_WRITE | GENERIC_READ,
+ &fileAttributes,
+ &ioStatus,
+ NULL,// alloc size = none
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ,
+ FILE_OPEN_IF,
+ FILE_SYNCHRONOUS_IO_NONALERT |FILE_NON_DIRECTORY_FILE,
+ NULL,// eabuffer
+ 0// ealength
+ );
+
+ if (!NT_SUCCESS(status)) {
+
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
+ "ZwCreateFile failed with status %!STATUS!", status);
+ devExt->FileHandle = NULL;
+ }
+
+End:
+ if(absFileName.Buffer != NULL) {
+ ExFreePool(absFileName.Buffer);
+ }
+
+ WdfRequestComplete(Request, status);
+
+ return;
+}
+
+
+VOID
+NonPnpEvtFileClose (
+ IN WDFFILEOBJECT FileObject
+ )
+
+/*++
+
+Routine Description:
+
+ EvtFileClose is called when all the handles represented by the FileObject
+ is closed and all the references to FileObject is removed. This callback
+ may get called in an arbitrary thread context instead of the thread that
+ called CloseHandle. If you want to delete any per FileObject context that
+ must be done in the context of the user thread that made the Create call,
+ you should do that in the EvtDeviceCleanp callback.
+
+Arguments:
+
+ FileObject - Pointer to fileobject that represents the open handle.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ PCONTROL_DEVICE_EXTENSION devExt;
+
+ PAGED_CODE ();
+
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "NonPnpEvtFileClose\n");
+
+ devExt = ControlGetData(WdfFileObjectGetDevice(FileObject));
+
+ if(devExt->FileHandle) {
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT,
+ "Closing File Handle %p", devExt->FileHandle);
+ ZwClose(devExt->FileHandle);
+ }
+
+ return;
+}
+
+
+VOID
+FileEvtIoRead(
+ IN WDFQUEUE Queue,
+ IN WDFREQUEST Request,
+ IN size_t Length
+ )
+/*++
+
+Routine Description:
+
+ This event is called when the framework receives IRP_MJ_READ requests.
+ We will just read the file.
+
+Arguments:
+
+ Queue - Handle to the framework queue object that is associated with the
+ I/O request.
+ Request - Handle to a framework request object.
+
+ Length - number of bytes to be read.
+ Queue is by default configured to fail zero length read & write requests.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ NTSTATUS status = STATUS_SUCCESS;
+ PVOID outBuf;
+ IO_STATUS_BLOCK ioStatus;
+ PCONTROL_DEVICE_EXTENSION devExt;
+ FILE_POSITION_INFORMATION position;
+ ULONG_PTR bytesRead = 0;
+ size_t bufLength;
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_RW, "FileEvtIoRead: Request: 0x%p, Queue: 0x%p\n",
+ Request, Queue);
+
+ PAGED_CODE ();
+
+ //
+ // Get the request buffer. Since the device is set to do buffered
+ // I/O, this function will retrieve Irp->AssociatedIrp.SystemBuffer.
+ //
+ status = WdfRequestRetrieveOutputBuffer(Request, 0, &outBuf, &bufLength);
+ if(!NT_SUCCESS(status)) {
+ WdfRequestComplete(Request, status);
+ return;
+
+ }
+
+ devExt = ControlGetData(WdfIoQueueGetDevice(Queue));
+
+ if(devExt->FileHandle) {
+
+ //
+ // Set the file position to the beginning of the file.
+ //
+ position.CurrentByteOffset.QuadPart = 0;
+ status = ZwSetInformationFile(devExt->FileHandle,
+ &ioStatus,
+ &position,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation);
+ if (NT_SUCCESS(status)) {
+
+ status = ZwReadFile (devExt->FileHandle,
+ NULL,// Event,
+ NULL,// PIO_APC_ROUTINE ApcRoutine
+ NULL,// PVOID ApcContext
+ &ioStatus,
+ outBuf,
+ (ULONG)Length,
+ 0, // ByteOffset
+ NULL // Key
+ );
+
+ if (!NT_SUCCESS(status)) {
+
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_RW,
+ "ZwReadFile failed with status 0x%x",
+ status);
+ }
+
+ status = ioStatus.Status;
+ bytesRead = ioStatus.Information;
+ }
+ }
+
+ WdfRequestCompleteWithInformation(Request, status, bytesRead);
+
+}
+
+
+
+VOID
+FileEvtIoWrite(
+ IN WDFQUEUE Queue,
+ IN WDFREQUEST Request,
+ IN size_t Length
+ )
+/*++
+
+Routine Description:
+
+ This event is called when the framework receives IRP_MJ_WRITE requests.
+
+Arguments:
+
+ Queue - Handle to the framework queue object that is associated with the
+ I/O request.
+ Request - Handle to a framework request object.
+
+ Length - number of bytes to be written.
+ Queue is by default configured to fail zero length read & write requests.
+
+
+Return Value:
+
+ None
+--*/
+{
+ NTSTATUS status = STATUS_SUCCESS;
+ PVOID inBuf;
+ IO_STATUS_BLOCK ioStatus;
+ PCONTROL_DEVICE_EXTENSION devExt;
+ FILE_POSITION_INFORMATION position;
+ ULONG_PTR bytesWritten = 0;
+ size_t bufLength;
+
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_RW, "FileEvtIoWrite: Request: 0x%p, Queue: 0x%p\n",
+ Request, Queue);
+ PAGED_CODE ();
+
+ //
+ // Get the request buffer. Since the device is set to do buffered
+ // I/O, this function will retrieve Irp->AssociatedIrp.SystemBuffer.
+ //
+ status = WdfRequestRetrieveInputBuffer(Request, 0, &inBuf, &bufLength);
+ if(!NT_SUCCESS(status)) {
+ WdfRequestComplete(Request, status);
+ return;
+
+ }
+
+ devExt = ControlGetData(WdfIoQueueGetDevice(Queue));
+
+ if(devExt->FileHandle) {
+
+ //
+ // Set the file position to the beginning of the file.
+ //
+ position.CurrentByteOffset.QuadPart = 0;
+
+ status = ZwSetInformationFile(devExt->FileHandle,
+ &ioStatus,
+ &position,
+ sizeof(FILE_POSITION_INFORMATION),
+ FilePositionInformation);
+ if (NT_SUCCESS(status))
+ {
+
+ status = ZwWriteFile(devExt->FileHandle,
+ NULL,// Event,
+ NULL,// PIO_APC_ROUTINE ApcRoutine
+ NULL,// PVOID ApcContext
+ &ioStatus,
+ inBuf,
+ (ULONG)Length,
+ 0, // ByteOffset
+ NULL // Key
+ );
+ if (!NT_SUCCESS(status))
+ {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_RW,
+ "ZwWriteFile failed with status 0x%x",
+ status);
+ }
+
+ status = ioStatus.Status;
+ bytesWritten = ioStatus.Information;
+ }
+ }
+
+ WdfRequestCompleteWithInformation(Request, status, bytesWritten);
+
+}
+
+VOID
+FileEvtIoDeviceControl(
+ IN WDFQUEUE Queue,
+ IN WDFREQUEST Request,
+ IN size_t OutputBufferLength,
+ IN size_t InputBufferLength,
+ IN ULONG IoControlCode
+ )
+/*++
+Routine Description:
+
+ This event is called when the framework receives IRP_MJ_DEVICE_CONTROL
+ requests from the system.
+
+Arguments:
+
+ Queue - Handle to the framework queue object that is associated
+ with the I/O request.
+ Request - Handle to a framework request object.
+
+ OutputBufferLength - length of the request's output buffer,
+ if an output buffer is available.
+ InputBufferLength - length of the request's input buffer,
+ if an input buffer is available.
+
+ IoControlCode - the driver-defined or system-defined I/O control code
+ (IOCTL) that is associated with the request.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ NTSTATUS status = STATUS_SUCCESS;// Assume success
+ PCHAR inBuf = NULL, outBuf = NULL; // pointer to Input and output buffer
+ PCHAR data = "this String is from Device Driver !!!";
+ ULONG datalen = (ULONG) strlen(data)+1;//Length of data including null
+ PCHAR buffer = NULL;
+ PREQUEST_CONTEXT reqContext = NULL;
+ size_t bufSize;
+
+ UNREFERENCED_PARAMETER( Queue );
+
+ PAGED_CODE();
+
+ if(!OutputBufferLength || !InputBufferLength)
+ {
+ WdfRequestComplete(Request, STATUS_INVALID_PARAMETER);
+ return;
+ }
+
+ //
+ // Determine which I/O control code was specified.
+ //
+
+ switch (IoControlCode)
+ {
+ case IOCTL_NONPNP_METHOD_BUFFERED:
+
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Called IOCTL_NONPNP_METHOD_BUFFERED\n");
+
+ //
+ // For bufffered ioctls WdfRequestRetrieveInputBuffer &
+ // WdfRequestRetrieveOutputBuffer return the same buffer
+ // pointer (Irp->AssociatedIrp.SystemBuffer), so read the
+ // content of the buffer before writing to it.
+ //
+ status = WdfRequestRetrieveInputBuffer(Request, 0, &inBuf, &bufSize);
+ if(!NT_SUCCESS(status)) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ break;
+ }
+
+ ASSERT(bufSize == InputBufferLength);
+
+ //
+ // Read the input buffer content.
+ // We are using the following function to print characters instead
+ // TraceEvents with %s format because the string we get may or
+ // may not be null terminated. The buffer may contain non-printable
+ // characters also.
+ //
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data from User : %!HEXDUMP!\n",
+ log_xstr(inBuf, (USHORT)InputBufferLength)));
+ PrintChars(inBuf, InputBufferLength );
+
+
+ status = WdfRequestRetrieveOutputBuffer(Request, 0, &outBuf, &bufSize);
+ if(!NT_SUCCESS(status)) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ break;
+ }
+
+ ASSERT(bufSize == OutputBufferLength);
+
+ //
+ // Writing to the buffer over-writes the input buffer content
+ //
+
+ RtlCopyMemory(outBuf, data, OutputBufferLength);
+
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data to User : %!HEXDUMP!\n",
+ log_xstr(outBuf, (USHORT)datalen)));
+ PrintChars(outBuf, datalen );
+
+ //
+ // Assign the length of the data copied to IoStatus.Information
+ // of the request and complete the request.
+ //
+ WdfRequestSetInformation(Request,
+ OutputBufferLength < datalen? OutputBufferLength:datalen);
+
+ //
+ // When the request is completed the content of the SystemBuffer
+ // is copied to the User output buffer and the SystemBuffer is
+ // is freed.
+ //
+
+ break;
+
+
+ case IOCTL_NONPNP_METHOD_IN_DIRECT:
+
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Called IOCTL_NONPNP_METHOD_IN_DIRECT\n");
+
+ //
+ // Get the Input buffer. WdfRequestRetrieveInputBuffer returns
+ // Irp->AssociatedIrp.SystemBuffer.
+ //
+ status = WdfRequestRetrieveInputBuffer(Request, 0, &inBuf, &bufSize);
+ if(!NT_SUCCESS(status)) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ break;
+ }
+
+ ASSERT(bufSize == InputBufferLength);
+
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data from User : %!HEXDUMP!\n",
+ log_xstr(inBuf, (USHORT)InputBufferLength)));
+ PrintChars(inBuf, InputBufferLength);
+
+ //
+ // Get the output buffer. Framework calls MmGetSystemAddressForMdlSafe
+ // on the Irp->MdlAddress and returns the system address.
+ // Oddity: For this method, this buffer is intended for transfering data
+ // from the application to the driver.
+ //
+
+ status = WdfRequestRetrieveOutputBuffer(Request, 0, &buffer, &bufSize);
+ if(!NT_SUCCESS(status)) {
+ break;
+ }
+
+ ASSERT(bufSize == OutputBufferLength);
+
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data from User in OutputBuffer: %!HEXDUMP!\n",
+ log_xstr(buffer, (USHORT)OutputBufferLength)));
+ PrintChars(buffer, OutputBufferLength);
+
+ //
+ // Return total bytes read from the output buffer.
+ // Note OutputBufferLength = MmGetMdlByteCount(Irp->MdlAddress)
+ //
+
+ WdfRequestSetInformation(Request, OutputBufferLength);
+
+ //
+ // NOTE: Changes made to the SystemBuffer are not copied
+ // to the user input buffer by the I/O manager
+ //
+
+ break;
+
+ case IOCTL_NONPNP_METHOD_OUT_DIRECT:
+
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Called IOCTL_NONPNP_METHOD_OUT_DIRECT\n");
+
+ //
+ // Get the Input buffer. WdfRequestRetrieveInputBuffer returns
+ // Irp->AssociatedIrp.SystemBuffer.
+ //
+ status = WdfRequestRetrieveInputBuffer(Request, 0, &inBuf, &bufSize);
+ if(!NT_SUCCESS(status)) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ break;
+ }
+
+ ASSERT(bufSize == InputBufferLength);
+
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data from User : %!HEXDUMP!\n",
+ log_xstr(inBuf, (USHORT)InputBufferLength)));
+ PrintChars(inBuf, InputBufferLength);
+
+ //
+ // Get the output buffer. Framework calls MmGetSystemAddressForMdlSafe
+ // on the Irp->MdlAddress and returns the system address.
+ // For this method, this buffer is intended for transfering data from the
+ // driver to the application.
+ //
+ status = WdfRequestRetrieveOutputBuffer(Request, 0, &buffer, &bufSize);
+ if(!NT_SUCCESS(status)) {
+ break;
+ }
+
+ ASSERT(bufSize == OutputBufferLength);
+
+ //
+ // Write data to be sent to the user in this buffer
+ //
+ RtlCopyMemory(buffer, data, OutputBufferLength);
+
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data to User : %!HEXDUMP!\n",
+ log_xstr(buffer, (USHORT)datalen)));
+ PrintChars(buffer, datalen);
+
+ WdfRequestSetInformation(Request,
+ OutputBufferLength < datalen? OutputBufferLength: datalen);
+
+ //
+ // NOTE: Changes made to the SystemBuffer are not copied
+ // to the user input buffer by the I/O manager
+ //
+
+ break;
+
+ case IOCTL_NONPNP_METHOD_NEITHER:
+ {
+ size_t inBufLength, outBufLength;
+
+ //
+ // The NonPnpEvtDeviceIoInCallerContext has already probe and locked the
+ // pages and mapped the user buffer into system address space and
+ // stored memory buffer pointers in the request context. We can get the
+ // buffer pointer by calling WdfMemoryGetBuffer.
+ //
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Called IOCTL_NONPNP_METHOD_NEITHER\n");
+
+ reqContext = GetRequestContext(Request);
+
+ inBuf = WdfMemoryGetBuffer(reqContext->InputMemoryBuffer, &inBufLength);
+ outBuf = WdfMemoryGetBuffer(reqContext->OutputMemoryBuffer, &outBufLength);
+
+ if(inBuf == NULL || outBuf == NULL) {
+ status = STATUS_INVALID_PARAMETER;
+ }
+
+ ASSERT(inBufLength == InputBufferLength);
+ ASSERT(outBufLength == OutputBufferLength);
+
+ //
+ // Now you can safely read the data from the buffer in any arbitrary
+ // context.
+ //
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data from User : %!HEXDUMP!\n",
+ log_xstr(inBuf, (USHORT)inBufLength)));
+ PrintChars(inBuf, inBufLength);
+
+ //
+ // Write to the buffer in any arbitrary context.
+ //
+ RtlCopyMemory(outBuf, data, outBufLength);
+
+ Hexdump((TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Data to User : %!HEXDUMP!\n",
+ log_xstr(outBuf, (USHORT)datalen)));
+ PrintChars(outBuf, datalen);
+
+ //
+ // Assign the length of the data copied to IoStatus.Information
+ // of the Irp and complete the Irp.
+ //
+ WdfRequestSetInformation(Request,
+ outBufLength < datalen? outBufLength:datalen);
+
+ break;
+ }
+ default:
+
+ //
+ // The specified I/O control code is unrecognized by this driver.
+ //
+ status = STATUS_INVALID_DEVICE_REQUEST;
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "ERROR: unrecognized IOCTL %x\n", IoControlCode);
+ break;
+ }
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Completing Request %p with status %X",
+ Request, status );
+
+ WdfRequestComplete( Request, status);
+
+}
+
+VOID
+NonPnpEvtDeviceIoInCallerContext(
+ IN WDFDEVICE Device,
+ IN WDFREQUEST Request
+ )
+/*++
+Routine Description:
+
+ This I/O in-process callback is called in the calling threads context/address
+ space before the request is subjected to any framework locking or queueing
+ scheme based on the device pnp/power or locking attributes set by the
+ driver. The process context of the calling app is guaranteed as long as
+ this driver is a top-level driver and no other filter driver is attached
+ to it.
+
+ This callback is only required if you are handling method-neither IOCTLs,
+ or want to process requests in the context of the calling process.
+
+ Driver developers should avoid defining neither IOCTLs and access user
+ buffers, and use much safer I/O tranfer methods such as buffered I/O
+ or direct I/O.
+
+Arguments:
+
+ Device - Handle to a framework device object.
+
+ Request - Handle to a framework request object. Framework calls
+ PreProcess callback only for Read/Write/ioctls and internal
+ ioctl requests.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ NTSTATUS status = STATUS_SUCCESS;
+ PREQUEST_CONTEXT reqContext = NULL;
+ WDF_OBJECT_ATTRIBUTES attributes;
+ WDF_REQUEST_PARAMETERS params;
+ size_t inBufLen, outBufLen;
+ PVOID inBuf, outBuf;
+
+ PAGED_CODE();
+
+ WDF_REQUEST_PARAMETERS_INIT(¶ms);
+
+ WdfRequestGetParameters(Request, ¶ms );
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "Entered NonPnpEvtDeviceIoInCallerContext %p \n",
+ Request);
+
+ //
+ // Check to see whether we have recevied a METHOD_NEITHER IOCTL. if not
+ // just send the request back to framework because we aren't doing
+ // any pre-processing in the context of the calling thread process.
+ //
+ if(!(params.Type == WdfRequestTypeDeviceControl &&
+ params.Parameters.DeviceIoControl.IoControlCode ==
+ IOCTL_NONPNP_METHOD_NEITHER)) {
+ //
+ // Forward it for processing by the I/O package
+ //
+ status = WdfDeviceEnqueueRequest(Device, Request);
+ if( !NT_SUCCESS(status) ) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error forwarding Request 0x%x", status);
+ goto End;
+ }
+
+ return;
+ }
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "EvtIoPreProcess: received METHOD_NEITHER ioctl \n");
+
+ //
+ // In this type of transfer, the I/O manager assigns the user input
+ // to Type3InputBuffer and the output buffer to UserBuffer of the Irp.
+ // The I/O manager doesn't copy or map the buffers to the kernel
+ // buffers.
+ //
+ status = WdfRequestRetrieveUnsafeUserInputBuffer(Request, 0, &inBuf, &inBufLen);
+ if(!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error WdfRequestRetrieveUnsafeUserInputBuffer failed 0x%x", status);
+ goto End;
+ }
+
+ status = WdfRequestRetrieveUnsafeUserOutputBuffer(Request, 0, &outBuf, &outBufLen);
+ if(!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error WdfRequestRetrieveUnsafeUserOutputBuffer failed 0x%x", status);
+ goto End;
+ }
+
+ //
+ // Allocate a context for this request so that we can store the memory
+ // objects created for input and output buffer.
+ //
+ WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, REQUEST_CONTEXT);
+
+ status = WdfObjectAllocateContext(Request, &attributes, &reqContext);
+ if(!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error WdfObjectAllocateContext failed 0x%x", status);
+ goto End;
+ }
+
+ //
+ // WdfRequestProbleAndLockForRead/Write function checks to see
+ // whether the caller in the right thread context, creates an MDL,
+ // probe and locks the pages, and map the MDL to system address
+ // space and finally creates a WDFMEMORY object representing this
+ // system buffer address. This memory object is associated with the
+ // request. So it will be freed when the request is completed. If we
+ // are accessing this memory buffer else where, we should store these
+ // pointers in the request context.
+ //
+
+ #pragma prefast(suppress:6387, "If inBuf==NULL at this point, then inBufLen==0")
+ status = WdfRequestProbeAndLockUserBufferForRead(Request,
+ inBuf,
+ inBufLen,
+ &reqContext->InputMemoryBuffer);
+
+ if(!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error WdfRequestProbeAndLockUserBufferForRead failed 0x%x", status);
+ goto End;
+ }
+
+ #pragma prefast(suppress:6387, "If outBuf==NULL at this point, then outBufLen==0")
+ status = WdfRequestProbeAndLockUserBufferForWrite(Request,
+ outBuf,
+ outBufLen,
+ &reqContext->OutputMemoryBuffer);
+ if(!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error WdfRequestProbeAndLockUserBufferForWrite failed 0x%x", status);
+ goto End;
+ }
+
+ //
+ // Finally forward it for processing by the I/O package
+ //
+ status = WdfDeviceEnqueueRequest(Device, Request);
+ if(!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Error WdfDeviceEnqueueRequest failed 0x%x", status);
+ goto End;
+ }
+
+ return;
+
+End:
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "EvtIoPreProcess failed %x \n", status);
+ WdfRequestComplete(Request, status);
+ return;
+}
+
+VOID
+NonPnpShutdown(
+ WDFDEVICE Device
+ )
+/*++
+
+Routine Description:
+ Callback invoked when the machine is shutting down. If you register for
+ a last chance shutdown notification you cannot do the following:
+ o Call any pageable routines
+ o Access pageable memory
+ o Perform any file I/O operations
+
+ If you register for a normal shutdown notification, all of these are
+ available to you.
+
+ This function implementation does nothing, but if you had any outstanding
+ file handles open, this is where you would close them.
+
+Arguments:
+ Device - The device which registered the notification during init
+
+Return Value:
+ None
+
+ --*/
+
+{
+ UNREFERENCED_PARAMETER(Device);
+ return;
+}
+
+
+VOID
+NonPnpEvtDriverUnload(
+ IN WDFDRIVER Driver
+ )
+/*++
+Routine Description:
+
+ Called by the I/O subsystem just before unloading the driver.
+ You can free the resources created in the DriverEntry either
+ in this routine or in the EvtDriverContextCleanup callback.
+
+Arguments:
+
+ Driver - Handle to a framework driver object created in DriverEntry
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ UNREFERENCED_PARAMETER(Driver);
+
+ PAGED_CODE();
+
+ TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "Entered NonPnpDriverUnload\n");
+
+ return;
+}
+
+VOID
+PrintChars(
+ _In_reads_(CountChars) PCHAR BufferAddress,
+ _In_ size_t CountChars
+ )
+{
+ if (CountChars) {
+
+ while (CountChars--) {
+
+ if (*BufferAddress > 31
+ && *BufferAddress != 127) {
+
+ KdPrint (( "%c", *BufferAddress) );
+
+ } else {
+
+ KdPrint(( ".") );
+
+ }
+ BufferAddress++;
+ }
+ KdPrint (("\n"));
+ }
+ return;
+}
+
diff --git a/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.h b/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.h new file mode 100644 index 000000000..c874e79d2 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.h @@ -0,0 +1,90 @@ +/*++
+
+Copyright (c) 1997 Microsoft Corporation
+
+Module Name:
+
+ nonpnp.h
+
+Abstract:
+
+ Contains function prototypes and includes other neccessary header files.
+
+Environment:
+
+ Kernel mode only.
+
+--*/
+
+#include <ntddk.h>
+#include <wdf.h>
+
+#define NTSTRSAFE_LIB
+#include <ntstrsafe.h>
+#include <wdmsec.h> // for SDDLs
+#include "public.h" // contains IOCTL definitions
+#include "Trace.h" // contains macros for WPP tracing
+
+#define NTDEVICE_NAME_STRING L"\\Device\\NONPNP"
+#define SYMBOLIC_NAME_STRING L"\\DosDevices\\NONPNP"
+#define POOL_TAG 'ELIF'
+
+typedef struct _CONTROL_DEVICE_EXTENSION {
+
+ HANDLE FileHandle; // Store your control data here
+
+} CONTROL_DEVICE_EXTENSION, *PCONTROL_DEVICE_EXTENSION;
+
+WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CONTROL_DEVICE_EXTENSION,
+ ControlGetData)
+
+//
+// Following request context is used only for the method-neither ioctl case.
+//
+typedef struct _REQUEST_CONTEXT {
+
+ WDFMEMORY InputMemoryBuffer;
+ WDFMEMORY OutputMemoryBuffer;
+
+} REQUEST_CONTEXT, *PREQUEST_CONTEXT;
+
+WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(REQUEST_CONTEXT, GetRequestContext)
+
+//
+// Device driver routine declarations.
+//
+
+DRIVER_INITIALIZE DriverEntry;
+
+//
+// Don't use EVT_WDF_DRIVER_DEVICE_ADD for NonPnpDeviceAdd even though
+// the signature is same because this is not an event called by the
+// framework.
+//
+NTSTATUS
+NonPnpDeviceAdd(
+ IN WDFDRIVER Driver,
+ IN PWDFDEVICE_INIT DeviceInit
+ );
+
+EVT_WDF_DRIVER_UNLOAD NonPnpEvtDriverUnload;
+
+EVT_WDF_DEVICE_CONTEXT_CLEANUP NonPnpEvtDriverContextCleanup;
+EVT_WDF_DEVICE_SHUTDOWN_NOTIFICATION NonPnpShutdown;
+
+EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL FileEvtIoDeviceControl;
+EVT_WDF_IO_QUEUE_IO_READ FileEvtIoRead;
+EVT_WDF_IO_QUEUE_IO_WRITE FileEvtIoWrite;
+
+EVT_WDF_IO_IN_CALLER_CONTEXT NonPnpEvtDeviceIoInCallerContext;
+EVT_WDF_DEVICE_FILE_CREATE NonPnpEvtDeviceFileCreate;
+EVT_WDF_FILE_CLOSE NonPnpEvtFileClose;
+
+VOID
+PrintChars(
+ _In_reads_(CountChars) PCHAR BufferAddress,
+ _In_ size_t CountChars
+ );
+
+#pragma warning(disable:4127)
+
diff --git a/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.rc b/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.rc new file mode 100644 index 000000000..cac68f7b2 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/driver/nonpnp.rc @@ -0,0 +1,10 @@ +#include <windows.h>
+
+#include <ntverp.h>
+
+#define VER_FILETYPE VFT_DRV
+#define VER_FILESUBTYPE VFT2_DRV_SYSTEM
+#define VER_FILEDESCRIPTION_STR "Sample Non-PNP Driver using WDF"
+#define VER_INTERNALNAME_STR "NONPNP.sys"
+
+#include "common.ver"
diff --git a/tests/projects/wdk/kmdf/ioctl/driver/public.h b/tests/projects/wdk/kmdf/ioctl/driver/public.h new file mode 100644 index 000000000..02e24be2e --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/driver/public.h @@ -0,0 +1,53 @@ +/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+
+Module Name:
+
+ PUBLIC.H
+
+Abstract:
+
+
+ Defines the IOCTL codes that will be used by this driver. The IOCTL code
+ contains a command identifier, plus other information about the device,
+ the type of access with which the file must have been opened,
+ and the type of buffering.
+
+Environment:
+
+ Kernel mode only.
+
+--*/
+
+//
+// Device type -- in the "User Defined" range."
+//
+#define FILEIO_TYPE 40001
+//
+// The IOCTL function codes from 0x800 to 0xFFF are for customer use.
+//
+#define IOCTL_NONPNP_METHOD_IN_DIRECT \
+ CTL_CODE( FILEIO_TYPE, 0x900, METHOD_IN_DIRECT, FILE_ANY_ACCESS )
+
+#define IOCTL_NONPNP_METHOD_OUT_DIRECT \
+ CTL_CODE( FILEIO_TYPE, 0x901, METHOD_OUT_DIRECT , FILE_ANY_ACCESS )
+
+#define IOCTL_NONPNP_METHOD_BUFFERED \
+ CTL_CODE( FILEIO_TYPE, 0x902, METHOD_BUFFERED, FILE_ANY_ACCESS )
+
+#define IOCTL_NONPNP_METHOD_NEITHER \
+ CTL_CODE( FILEIO_TYPE, 0x903, METHOD_NEITHER , FILE_ANY_ACCESS )
+
+
+#define DRIVER_FUNC_INSTALL 0x01
+#define DRIVER_FUNC_REMOVE 0x02
+
+#define DRIVER_NAME "NONPNP"
+#define DEVICE_NAME "\\\\.\\NONPNP\\nonpnpsamp.log"
diff --git a/tests/projects/wdk/kmdf/ioctl/driver/trace.h b/tests/projects/wdk/kmdf/ioctl/driver/trace.h new file mode 100644 index 000000000..089f213f0 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/driver/trace.h @@ -0,0 +1,68 @@ +/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+Module Name:
+
+ TRACE.h
+
+Abstract:
+
+ Header file for the debug tracing related function defintions and macros.
+
+Environment:
+
+ Kernel mode
+
+--*/
+
+//
+// If software tracing is defined in the sources file..
+// WPP_DEFINE_CONTROL_GUID specifies the GUID used for this driver.
+// *** REPLACE THE GUID WITH YOUR OWN UNIQUE ID ***
+// WPP_DEFINE_BIT allows setting debug bit masks to selectively print.
+// The names defined in the WPP_DEFINE_BIT call define the actual names
+// that are used to control the level of tracing for the control guid
+// specified.
+//
+// {71ae54db-0862-41bf-a24f-5330cec3c7f6}
+//
+#define WPP_CHECK_FOR_NULL_STRING //to prevent exceptions due to NULL strings
+
+#define WPP_CONTROL_GUIDS \
+ WPP_DEFINE_CONTROL_GUID( FileIoTraceGuid, \
+ (71ae54db,0862,41bf,a24f,5330cec3c7f6), \
+ WPP_DEFINE_BIT(DBG_INIT) \
+ WPP_DEFINE_BIT(DBG_RW) \
+ WPP_DEFINE_BIT(DBG_IOCTL) \
+ )
+
+#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
+#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
+
+#pragma warning(disable:4204) // C4204 nonstandard extension used : non-constant aggregate initializer
+
+//
+// Define the 'xstr' structure for logging buffer and length pairs
+// and the 'log_xstr' function which returns it to create one in-place.
+// this enables logging of complex data types.
+//
+typedef struct xstr { char * _buf; short _len; } xstr_t;
+__inline xstr_t log_xstr(void * p, short l) { xstr_t xs = {(char*)p,l}; return xs; }
+
+#pragma warning(default:4204)
+
+//
+// Define the macro required for a hexdump use as:
+//
+// Hexdump((FLAG,"%!HEXDUMP!\n", log_xstr(buffersize,(char *)buffer) ));
+//
+//
+#define WPP_LOGHEXDUMP(x) WPP_LOGPAIR(2, &((x)._len)) WPP_LOGPAIR((x)._len, (x)._buf)
+
+
diff --git a/tests/projects/wdk/kmdf/ioctl/exe/install.c b/tests/projects/wdk/kmdf/ioctl/exe/install.c new file mode 100644 index 000000000..53d1f7678 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/exe/install.c @@ -0,0 +1,812 @@ +/*++
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+Module Name:
+
+ install.c
+
+Abstract:
+
+ Win32 routines to dynamically load and unload a Windows NT kernel-mode
+ driver using the Service Control Manager APIs.
+
+Environment:
+
+ User mode only
+
+--*/
+
+
+#include <DriverSpecs.h>
+_Analysis_mode_(_Analysis_code_type_user_code_)
+
+#include <windows.h>
+#include <strsafe.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "public.h"
+
+#include <wdfinstaller.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) /sizeof(x[0]))
+
+extern
+PCHAR
+GetCoinstallerVersion(
+ VOID
+ ) ;
+
+BOOLEAN
+InstallDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName,
+ IN LPCTSTR ServiceExe
+ );
+
+
+BOOLEAN
+RemoveDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName
+ );
+
+BOOLEAN
+StartDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName
+ );
+
+BOOLEAN
+StopDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName
+ );
+
+#define SYSTEM32_DRIVERS "\\System32\\Drivers\\"
+#define NONPNP_INF_FILENAME L"\\nonpnp.inf"
+#define WDF_SECTION_NAME L"nonpnp.NT.Wdf"
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+PFN_WDFPREDEVICEINSTALLEX pfnWdfPreDeviceInstallEx;
+PFN_WDFPOSTDEVICEINSTALL pfnWdfPostDeviceInstall;
+PFN_WDFPREDEVICEREMOVE pfnWdfPreDeviceRemove;
+PFN_WDFPOSTDEVICEREMOVE pfnWdfPostDeviceRemove;
+
+//-----------------------------------------------------------------------------
+// 4127 -- Conditional Expression is Constant warning
+//-----------------------------------------------------------------------------
+#define WHILE(a) \
+__pragma(warning(suppress:4127)) while(a)
+
+LONG
+GetPathToInf(
+ _Out_writes_(InfFilePathSize) PWCHAR InfFilePath,
+ IN ULONG InfFilePathSize
+ )
+{
+ LONG error = ERROR_SUCCESS;
+
+ if (GetCurrentDirectoryW(InfFilePathSize, InfFilePath) == 0) {
+ error = GetLastError();
+ printf("InstallDriver failed! Error = %d \n", error);
+ return error;
+ }
+ if (FAILED( StringCchCatW(InfFilePath,
+ InfFilePathSize,
+ NONPNP_INF_FILENAME) )) {
+ error = ERROR_BUFFER_OVERFLOW;
+ return error;
+ }
+ return error;
+
+}
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+BOOLEAN
+InstallDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName,
+ IN LPCTSTR ServiceExe
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+Return Value:
+
+--*/
+{
+ SC_HANDLE schService;
+ DWORD err;
+ WCHAR infPath[MAX_PATH];
+ WDF_COINSTALLER_INSTALL_OPTIONS clientOptions;
+
+ WDF_COINSTALLER_INSTALL_OPTIONS_INIT(&clientOptions);
+
+ //
+ // NOTE: This creates an entry for a standalone driver. If this
+ // is modified for use with a driver that requires a Tag,
+ // Group, and/or Dependencies, it may be necessary to
+ // query the registry for existing driver information
+ // (in order to determine a unique Tag, etc.).
+ //
+ //
+ // PRE-INSTALL for WDF support
+ //
+ err = GetPathToInf(infPath, ARRAY_SIZE(infPath) );
+ if (err != ERROR_SUCCESS) {
+ return FALSE;
+ }
+ err = pfnWdfPreDeviceInstallEx(infPath, WDF_SECTION_NAME, &clientOptions);
+
+ if (err != ERROR_SUCCESS) {
+ if (err == ERROR_SUCCESS_REBOOT_REQUIRED) {
+ printf("System needs to be rebooted, before the driver installation can proceed.\n");
+ }
+
+ return FALSE;
+ }
+
+ //
+ // Create a new a service object.
+ //
+
+ schService = CreateService(SchSCManager, // handle of service control manager database
+ DriverName, // address of name of service to start
+ DriverName, // address of display name
+ SERVICE_ALL_ACCESS, // type of access to service
+ SERVICE_KERNEL_DRIVER, // type of service
+ SERVICE_DEMAND_START, // when to start service
+ SERVICE_ERROR_NORMAL, // severity if service fails to start
+ ServiceExe, // address of name of binary file
+ NULL, // service does not belong to a group
+ NULL, // no tag requested
+ NULL, // no dependency names
+ NULL, // use LocalSystem account
+ NULL // no password for service account
+ );
+
+ if (schService == NULL) {
+
+ err = GetLastError();
+
+ if (err == ERROR_SERVICE_EXISTS) {
+
+ //
+ // Ignore this error.
+ //
+
+ return TRUE;
+
+ } else {
+
+ printf("CreateService failed! Error = %d \n", err );
+
+ //
+ // Indicate an error.
+ //
+
+ return FALSE;
+ }
+ }
+
+ //
+ // Close the service object.
+ //
+ CloseServiceHandle(schService);
+
+ //
+ // POST-INSTALL for WDF support
+ //
+ err = pfnWdfPostDeviceInstall( infPath, WDF_SECTION_NAME );
+
+ if (err != ERROR_SUCCESS) {
+ return FALSE;
+ }
+
+ //
+ // Indicate success.
+ //
+
+ return TRUE;
+
+} // InstallDriver
+
+BOOLEAN
+ManageDriver(
+ IN LPCTSTR DriverName,
+ IN LPCTSTR ServiceName,
+ IN USHORT Function
+ )
+{
+
+ SC_HANDLE schSCManager;
+
+ BOOLEAN rCode = TRUE;
+
+ //
+ // Insure (somewhat) that the driver and service names are valid.
+ //
+
+ if (!DriverName || !ServiceName) {
+
+ printf("Invalid Driver or Service provided to ManageDriver() \n");
+
+ return FALSE;
+ }
+
+ //
+ // Connect to the Service Control Manager and open the Services database.
+ //
+
+ schSCManager = OpenSCManager(NULL, // local machine
+ NULL, // local database
+ SC_MANAGER_ALL_ACCESS // access required
+ );
+
+ if (!schSCManager) {
+
+ printf("Open SC Manager failed! Error = %d \n", GetLastError());
+
+ return FALSE;
+ }
+
+ //
+ // Do the requested function.
+ //
+
+ switch( Function ) {
+
+ case DRIVER_FUNC_INSTALL:
+
+ //
+ // Install the driver service.
+ //
+
+ if (InstallDriver(schSCManager,
+ DriverName,
+ ServiceName
+ )) {
+
+ //
+ // Start the driver service (i.e. start the driver).
+ //
+
+ rCode = StartDriver(schSCManager,
+ DriverName
+ );
+
+ } else {
+
+ //
+ // Indicate an error.
+ //
+
+ rCode = FALSE;
+ }
+
+ break;
+
+ case DRIVER_FUNC_REMOVE:
+
+ //
+ // Stop the driver.
+ //
+
+ StopDriver(schSCManager,
+ DriverName
+ );
+
+ //
+ // Remove the driver service.
+ //
+
+ RemoveDriver(schSCManager,
+ DriverName
+ );
+
+ //
+ // Ignore all errors.
+ //
+
+ rCode = TRUE;
+
+ break;
+
+ default:
+
+ printf("Unknown ManageDriver() function. \n");
+
+ rCode = FALSE;
+
+ break;
+ }
+
+ //
+ // Close handle to service control manager.
+ //
+ CloseServiceHandle(schSCManager);
+
+ return rCode;
+
+} // ManageDriver
+
+
+BOOLEAN
+RemoveDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName
+ )
+{
+ SC_HANDLE schService;
+ BOOLEAN rCode;
+ DWORD err;
+ WCHAR infPath[MAX_PATH];
+
+ err = GetPathToInf(infPath, ARRAY_SIZE(infPath) );
+ if (err != ERROR_SUCCESS) {
+ return FALSE;
+ }
+
+ //
+ // PRE-REMOVE of WDF support
+ //
+ err = pfnWdfPreDeviceRemove( infPath, WDF_SECTION_NAME );
+
+ if (err != ERROR_SUCCESS) {
+ return FALSE;
+ }
+
+ //
+ // Open the handle to the existing service.
+ //
+
+ schService = OpenService(SchSCManager,
+ DriverName,
+ SERVICE_ALL_ACCESS
+ );
+
+ if (schService == NULL) {
+
+ printf("OpenService failed! Error = %d \n", GetLastError());
+
+ //
+ // Indicate error.
+ //
+
+ return FALSE;
+ }
+
+ //
+ // Mark the service for deletion from the service control manager database.
+ //
+
+ if (DeleteService(schService)) {
+
+ //
+ // Indicate success.
+ //
+
+ rCode = TRUE;
+
+ } else {
+
+ printf("DeleteService failed! Error = %d \n", GetLastError());
+
+ //
+ // Indicate failure. Fall through to properly close the service handle.
+ //
+
+ rCode = FALSE;
+ }
+
+ //
+ // Close the service object.
+ //
+ CloseServiceHandle(schService);
+
+ //
+ // POST-REMOVE of WDF support
+ //
+ err = pfnWdfPostDeviceRemove(infPath, WDF_SECTION_NAME );
+
+ if (err != ERROR_SUCCESS) {
+ rCode = FALSE;
+ }
+
+ return rCode;
+
+} // RemoveDriver
+
+
+
+BOOLEAN
+StartDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName
+ )
+{
+ SC_HANDLE schService;
+ DWORD err;
+ BOOL ok;
+
+ //
+ // Open the handle to the existing service.
+ //
+ schService = OpenService(SchSCManager,
+ DriverName,
+ SERVICE_ALL_ACCESS
+ );
+
+ if (schService == NULL) {
+ //
+ // Indicate failure.
+ //
+ printf("OpenService failed! Error = %d\n", GetLastError());
+ return FALSE;
+ }
+
+ //
+ // Start the execution of the service (i.e. start the driver).
+ //
+ ok = StartService( schService, 0, NULL );
+
+ if (!ok) {
+
+ err = GetLastError();
+
+ if (err == ERROR_SERVICE_ALREADY_RUNNING) {
+ //
+ // Ignore this error.
+ //
+ return TRUE;
+
+ } else {
+ //
+ // Indicate failure.
+ // Fall through to properly close the service handle.
+ //
+ printf("StartService failure! Error = %d\n", err );
+ return FALSE;
+ }
+ }
+
+ //
+ // Close the service object.
+ //
+ CloseServiceHandle(schService);
+
+ return TRUE;
+
+} // StartDriver
+
+
+
+BOOLEAN
+StopDriver(
+ IN SC_HANDLE SchSCManager,
+ IN LPCTSTR DriverName
+ )
+{
+ BOOLEAN rCode = TRUE;
+ SC_HANDLE schService;
+ SERVICE_STATUS serviceStatus;
+
+ //
+ // Open the handle to the existing service.
+ //
+
+ schService = OpenService(SchSCManager,
+ DriverName,
+ SERVICE_ALL_ACCESS
+ );
+
+ if (schService == NULL) {
+
+ printf("OpenService failed! Error = %d \n", GetLastError());
+
+ return FALSE;
+ }
+
+ //
+ // Request that the service stop.
+ //
+
+ if (ControlService(schService,
+ SERVICE_CONTROL_STOP,
+ &serviceStatus
+ )) {
+
+ //
+ // Indicate success.
+ //
+
+ rCode = TRUE;
+
+ } else {
+
+ printf("ControlService failed! Error = %d \n", GetLastError() );
+
+ //
+ // Indicate failure. Fall through to properly close the service handle.
+ //
+
+ rCode = FALSE;
+ }
+
+ //
+ // Close the service object.
+ //
+ CloseServiceHandle (schService);
+
+ return rCode;
+
+} // StopDriver
+
+
+//
+// Caller must free returned pathname string.
+//
+PCHAR
+BuildDriversDirPath(
+ _In_ PSTR DriverName
+ )
+{
+ size_t remain;
+ size_t len;
+ PCHAR dir;
+
+ if (!DriverName || strlen(DriverName) == 0) {
+ return NULL;
+ }
+
+ remain = MAX_PATH;
+
+ //
+ // Allocate string space
+ //
+ dir = (PCHAR) malloc( remain + 1 );
+
+ if (!dir) {
+ return NULL;
+ }
+
+ //
+ // Get the base windows directory path.
+ //
+ len = GetWindowsDirectory( dir, (UINT) remain );
+
+ if (len == 0 ||
+ (remain - len) < sizeof(SYSTEM32_DRIVERS)) {
+ free(dir);
+ return NULL;
+ }
+ remain -= len;
+
+ //
+ // Build dir to have "%windir%\System32\Drivers\<DriverName>".
+ //
+ if (FAILED( StringCchCat(dir, remain, SYSTEM32_DRIVERS) )) {
+ free(dir);
+ return NULL;
+ }
+
+ remain -= sizeof(SYSTEM32_DRIVERS);
+ len += sizeof(SYSTEM32_DRIVERS);
+ len += strlen(DriverName);
+
+ if (remain < len) {
+ free(dir);
+ return NULL;
+ }
+
+ if (FAILED( StringCchCat(dir, remain, DriverName) )) {
+ free(dir);
+ return NULL;
+ }
+
+ dir[len] = '\0'; // keeps prefast happy
+
+ return dir;
+}
+
+
+BOOLEAN
+SetupDriverName(
+ _Inout_updates_all_(BufferLength) PCHAR DriverLocation,
+ _In_ ULONG BufferLength
+ )
+{
+ HANDLE fileHandle;
+ DWORD driverLocLen = 0;
+ BOOL ok;
+ PCHAR driversDir;
+
+ //
+ // Setup path name to driver file.
+ //
+ driverLocLen =
+ GetCurrentDirectory(BufferLength, DriverLocation);
+
+ if (!driverLocLen) {
+
+ printf("GetCurrentDirectory failed! Error = %d \n",
+ GetLastError());
+
+ return FALSE;
+ }
+
+ if (FAILED( StringCchCat(DriverLocation, BufferLength, "\\" DRIVER_NAME ".sys") )) {
+ return FALSE;
+ }
+
+ //
+ // Insure driver file is in the specified directory.
+ //
+ fileHandle = CreateFile( DriverLocation,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL );
+
+ if (fileHandle == INVALID_HANDLE_VALUE) {
+ //
+ // Indicate failure.
+ //
+ printf("Driver: %s.SYS is not in the %s directory. \n",
+ DRIVER_NAME, DriverLocation );
+ return FALSE;
+ }
+
+ //
+ // Build %windir%\System32\Drivers\<DRIVER_NAME> path.
+ // Copy the driver to %windir%\system32\drivers
+ //
+ driversDir = BuildDriversDirPath( DRIVER_NAME ".sys" );
+
+ if (!driversDir) {
+ printf("BuildDriversDirPath failed!\n");
+ return FALSE;
+ }
+
+ ok = CopyFile( DriverLocation, driversDir, FALSE );
+
+ if(!ok) {
+ printf("CopyFile failed: error(%d) - \"%s\"\n",
+ GetLastError(), driversDir );
+ free(driversDir);
+ return FALSE;
+ }
+
+ if (FAILED( StringCchCopy(DriverLocation, BufferLength, driversDir) )) {
+ free(driversDir);
+ return FALSE;
+ }
+
+ free(driversDir);
+
+ //
+ // Close open file handle.
+ //
+ if (fileHandle) {
+ CloseHandle(fileHandle);
+ }
+
+ //
+ // Indicate success.
+ //
+ return TRUE;
+
+} // SetupDriverName
+
+
+HMODULE
+LoadWdfCoInstaller(
+ VOID
+ )
+{
+ HMODULE library = NULL;
+ DWORD error = ERROR_SUCCESS;
+ CHAR szCurDir[MAX_PATH];
+ CHAR tempCoinstallerName[MAX_PATH];
+ PCHAR coinstallerVersion;
+
+ do {
+
+ if (GetCurrentDirectory(MAX_PATH, szCurDir) == 0) {
+
+ printf("GetCurrentDirectory failed! Error = %d \n", GetLastError());
+ break;
+ }
+ coinstallerVersion = GetCoinstallerVersion();
+ if (FAILED( StringCchPrintf(tempCoinstallerName,
+ MAX_PATH,
+ "\\WdfCoInstaller%s.dll",
+ coinstallerVersion) )) {
+ break;
+ }
+ if (FAILED( StringCchCat(szCurDir, MAX_PATH, tempCoinstallerName) )) {
+ break;
+ }
+
+ library = LoadLibrary(szCurDir);
+
+ if (library == NULL) {
+ error = GetLastError();
+ printf("LoadLibrary(%s) failed: %d\n", szCurDir, error);
+ break;
+ }
+
+ pfnWdfPreDeviceInstallEx =
+ (PFN_WDFPREDEVICEINSTALLEX) GetProcAddress( library, "WdfPreDeviceInstallEx" );
+
+ if (pfnWdfPreDeviceInstallEx == NULL) {
+ error = GetLastError();
+ printf("GetProcAddress(\"WdfPreDeviceInstallEx\") failed: %d\n", error);
+ return NULL;
+ }
+
+ pfnWdfPostDeviceInstall =
+ (PFN_WDFPOSTDEVICEINSTALL) GetProcAddress( library, "WdfPostDeviceInstall" );
+
+ if (pfnWdfPostDeviceInstall == NULL) {
+ error = GetLastError();
+ printf("GetProcAddress(\"WdfPostDeviceInstall\") failed: %d\n", error);
+ return NULL;
+ }
+
+ pfnWdfPreDeviceRemove =
+ (PFN_WDFPREDEVICEREMOVE) GetProcAddress( library, "WdfPreDeviceRemove" );
+
+ if (pfnWdfPreDeviceRemove == NULL) {
+ error = GetLastError();
+ printf("GetProcAddress(\"WdfPreDeviceRemove\") failed: %d\n", error);
+ return NULL;
+ }
+
+ pfnWdfPostDeviceRemove =
+ (PFN_WDFPREDEVICEREMOVE) GetProcAddress( library, "WdfPostDeviceRemove" );
+
+ if (pfnWdfPostDeviceRemove == NULL) {
+ error = GetLastError();
+ printf("GetProcAddress(\"WdfPostDeviceRemove\") failed: %d\n", error);
+ return NULL;
+ }
+
+ } WHILE (0);
+
+ if (error != ERROR_SUCCESS) {
+ if (library) {
+ FreeLibrary( library );
+ }
+ library = NULL;
+ }
+
+ return library;
+}
+
+
+VOID
+UnloadWdfCoInstaller(
+ HMODULE Library
+ )
+{
+ if (Library) {
+ FreeLibrary( Library );
+ }
+}
+
diff --git a/tests/projects/wdk/kmdf/ioctl/exe/nonpnp.inf b/tests/projects/wdk/kmdf/ioctl/exe/nonpnp.inf new file mode 100644 index 000000000..b20a58b48 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/exe/nonpnp.inf @@ -0,0 +1,8 @@ +[Version] +Signature="$WINDOWS NT$" + +[nonpnp.NT.Wdf] +KmdfService = nonpnp, nonpnp_Service_kmdfInst + +[nonpnp_Service_kmdfInst] +KmdfLibraryVersion = 1.11 diff --git a/tests/projects/wdk/kmdf/ioctl/exe/testapp.c b/tests/projects/wdk/kmdf/ioctl/exe/testapp.c new file mode 100644 index 000000000..c12f26073 --- /dev/null +++ b/tests/projects/wdk/kmdf/ioctl/exe/testapp.c @@ -0,0 +1,643 @@ +/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+
+Module Name:
+
+ testapp.c
+
+Abstract:
+
+ Purpose of this app to test the NONPNP sample driver. The app
+ makes four different ioctl calls to test all the buffer types, write
+ some random buffer content to a file created by the driver in \SystemRoot\Temp
+ directory, and reads the same file and matches the content.
+ If -l option is specified, it does the write and read operation in a loop
+ until the app is terminated by pressing ^C.
+
+ Make sure you have the \SystemRoot\Temp directory exists before you run the test.
+
+Environment:
+
+ Win32 console application.
+
+--*/
+
+
+#include <DriverSpecs.h>
+_Analysis_mode_(_Analysis_code_type_user_code_)
+
+#include <windows.h>
+
+#pragma warning(disable:4201) // nameless struct/union
+#include <winioctl.h>
+#pragma warning(default:4201)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <limits.h>
+#include <strsafe.h>
+#include "public.h"
+
+
+BOOLEAN
+ManageDriver(
+ IN LPCTSTR DriverName,
+ IN LPCTSTR ServiceName,
+ IN USHORT Function
+ );
+
+HMODULE
+LoadWdfCoInstaller(
+ VOID
+ );
+
+VOID
+UnloadWdfCoInstaller(
+ HMODULE Library
+ );
+
+BOOLEAN
+SetupDriverName(
+ _Inout_updates_all_(BufferLength) PCHAR DriverLocation,
+ _In_ ULONG BufferLength
+ );
+
+BOOLEAN
+DoFileReadWrite(
+ HANDLE HDevice
+ );
+
+VOID
+DoIoctls(
+ HANDLE hDevice
+ );
+
+// for example, WDF 1.9 is "01009". the size 6 includes the ending NULL marker
+//
+#define MAX_VERSION_SIZE 6
+
+CHAR G_coInstallerVersion[MAX_VERSION_SIZE] = {0};
+BOOLEAN G_fLoop = FALSE;
+BOOL G_versionSpecified = FALSE;
+
+
+
+//-----------------------------------------------------------------------------
+// 4127 -- Conditional Expression is Constant warning
+//-----------------------------------------------------------------------------
+#define WHILE(constant) \
+__pragma(warning(disable: 4127)) while(constant); __pragma(warning(default: 4127))
+
+
+#define USAGE \
+"Usage: nonpnpapp <-V version> <-l> \n" \
+ " -V version {if no version is specified the version specified in the build environment will be used.}\n" \
+ " The version is the version of the KMDF coinstaller to use \n" \
+ " The format of version is MMmmm where MM -- major #, mmm - serial# \n" \
+ " -l { option to continuously read & write to the file} \n"
+
+BOOL
+ValidateCoinstallerVersion(
+ _In_ PSTR Version
+ )
+{ BOOL ok = FALSE;
+ INT i;
+
+ for(i= 0; i<MAX_VERSION_SIZE ;i++){
+ if( ! IsCharAlphaNumericA(Version[i])) {
+ break;
+ }
+ }
+ if (i == (MAX_VERSION_SIZE -sizeof(CHAR))) {
+ ok = TRUE;
+ }
+ return ok;
+}
+
+LONG
+Parse(
+ _In_ int argc,
+ _In_reads_(argc) char *argv[]
+ )
+/*++
+Routine Description:
+
+ Called by main() to parse command line parms
+
+Arguments:
+
+ argc and argv that was passed to main()
+
+Return Value:
+
+ Sets global flags as per user function request
+
+--*/
+{
+ int i;
+ BOOL ok;
+ LONG error = ERROR_SUCCESS;
+
+ for (i=0; i<argc; i++) {
+ if (argv[i][0] == '-' ||
+ argv[i][0] == '/') {
+ switch(argv[i][1]) {
+ case 'V':
+ case 'v':
+ if (( (i+1 < argc ) &&
+ ( argv[i+1][0] != '-' && argv[i+1][0] != '/'))) {
+ //
+ // use version in commandline
+ //
+ i++;
+ ok = ValidateCoinstallerVersion(argv[i]);
+ if (!ok) {
+ printf("Not a valid format for coinstaller version\n"
+ "It should be characters between A-Z, a-z , 0-9\n"
+ "The version format is MMmmm where MM -- major #, mmm - serial#");
+ error = ERROR_INVALID_PARAMETER;
+ break;
+ }
+ if (FAILED( StringCchCopy(G_coInstallerVersion,
+ MAX_VERSION_SIZE,
+ argv[i]) )) {
+ break;
+ }
+ G_versionSpecified = TRUE;
+
+ }
+ else{
+ printf(USAGE);
+ error = ERROR_INVALID_PARAMETER;
+ }
+ break;
+ case 'l':
+ case 'L':
+ G_fLoop = TRUE;
+ break;
+ default:
+ printf(USAGE);
+ error = ERROR_INVALID_PARAMETER;
+
+ }
+ }
+ }
+ return error;
+}
+
+PCHAR
+GetCoinstallerVersion(
+ VOID
+ )
+{
+ if (!G_versionSpecified &&
+ FAILED( StringCchPrintf(G_coInstallerVersion,
+ MAX_VERSION_SIZE,
+ "%02d%03d", // for example, "01009"
+ KMDF_VERSION_MAJOR,
+ KMDF_VERSION_MINOR)))
+ {
+ printf("StringCchCopy failed with error \n");
+ }
+
+ return (PCHAR)&G_coInstallerVersion;
+}
+
+VOID __cdecl
+main(
+ _In_ ULONG argc,
+ _In_reads_(argc) PCHAR argv[]
+ )
+{
+ HANDLE hDevice;
+ DWORD errNum = 0;
+ CHAR driverLocation [MAX_PATH];
+ BOOL ok;
+ HMODULE library = NULL;
+ LONG error;
+ PCHAR coinstallerVersion;
+
+ //
+ // Parse command line args
+ // -l -- loop option
+ //
+ if ( argc > 1 ) {// give usage if invoked with no parms
+ error = Parse(argc, argv);
+ if (error != ERROR_SUCCESS) {
+ return;
+ }
+ }
+
+ if (!G_versionSpecified ) {
+ coinstallerVersion = GetCoinstallerVersion();
+
+ //
+ // if no version is specified or an invalid one is specified use default version
+ //
+ printf("No version specified. Using default version:%s\n",
+ coinstallerVersion);
+
+ } else {
+ coinstallerVersion = (PCHAR)&G_coInstallerVersion;
+ }
+
+ //
+ // open the device
+ //
+ hDevice = CreateFile(DEVICE_NAME,
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if(hDevice == INVALID_HANDLE_VALUE) {
+
+ errNum = GetLastError();
+
+ if (!(errNum == ERROR_FILE_NOT_FOUND ||
+ errNum == ERROR_PATH_NOT_FOUND)) {
+
+ printf("CreateFile failed! ERROR_FILE_NOT_FOUND = %d\n",
+ errNum);
+ return ;
+ }
+
+ //
+ // Load WdfCoInstaller.dll.
+ //
+ library = LoadWdfCoInstaller();
+
+ if (library == NULL) {
+ printf("The WdfCoInstaller%s.dll library needs to be "
+ "in same directory as nonpnpapp.exe\n", coinstallerVersion);
+ return;
+ }
+
+ //
+ // The driver is not started yet so let us the install the driver.
+ // First setup full path to driver name.
+ //
+ ok = SetupDriverName( driverLocation, MAX_PATH );
+
+ if (!ok) {
+ return ;
+ }
+
+ ok = ManageDriver( DRIVER_NAME,
+ driverLocation,
+ DRIVER_FUNC_INSTALL );
+
+ if (!ok) {
+
+ printf("Unable to install driver. \n");
+
+ //
+ // Error - remove driver.
+ //
+ ManageDriver( DRIVER_NAME,
+ driverLocation,
+ DRIVER_FUNC_REMOVE );
+ return;
+ }
+
+ hDevice = CreateFile( DEVICE_NAME,
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL );
+
+ if (hDevice == INVALID_HANDLE_VALUE) {
+ printf ( "Error: CreatFile Failed : %d\n", GetLastError());
+ return;
+ }
+ }
+
+ DoIoctls(hDevice);
+
+ do {
+
+ if(!DoFileReadWrite(hDevice)) {
+ break;
+ }
+
+ if(!G_fLoop) {
+ break;
+ }
+ Sleep(1000); // sleep for 1 sec.
+
+ } WHILE (TRUE);
+
+ //
+ // Close the handle to the device before unloading the driver.
+ //
+ CloseHandle ( hDevice );
+
+ //
+ // Unload the driver. Ignore any errors.
+ //
+ ManageDriver( DRIVER_NAME,
+ driverLocation,
+ DRIVER_FUNC_REMOVE );
+
+ //
+ // Unload WdfCoInstaller.dll
+ //
+ if ( library ) {
+ UnloadWdfCoInstaller( library );
+ }
+ return;
+}
+
+
+VOID
+DoIoctls(
+ HANDLE hDevice
+ )
+{
+ char OutputBuffer[100];
+ char InputBuffer[200];
+ BOOL bRc;
+ ULONG bytesReturned;
+
+ //
+ // Printing Input & Output buffer pointers and size
+ //
+
+ printf("InputBuffer Pointer = %p, BufLength = %Id\n", InputBuffer,
+ sizeof(InputBuffer));
+ printf("OutputBuffer Pointer = %p BufLength = %Id\n", OutputBuffer,
+ sizeof(OutputBuffer));
+ //
+ // Performing METHOD_BUFFERED
+ //
+
+ if(FAILED(StringCchCopy(InputBuffer, sizeof(InputBuffer),
+ "this String is from User Application; using METHOD_BUFFERED"))){
+ return;
+ }
+
+ printf("\nCalling DeviceIoControl METHOD_BUFFERED:\n");
+
+ memset(OutputBuffer, 0, sizeof(OutputBuffer));
+
+ bRc = DeviceIoControl ( hDevice,
+ (DWORD) IOCTL_NONPNP_METHOD_BUFFERED,
+ InputBuffer,
+ (DWORD) strlen( InputBuffer )+1,
+ OutputBuffer,
+ sizeof( OutputBuffer),
+ &bytesReturned,
+ NULL
+ );
+
+ if ( !bRc )
+ {
+ printf ( "Error in DeviceIoControl : %d", GetLastError());
+ return;
+
+ }
+ printf(" OutBuffer (%d): %s\n", bytesReturned, OutputBuffer);
+
+
+ //
+ // Performing METHOD_NIETHER
+ //
+
+ printf("\nCalling DeviceIoControl METHOD_NEITHER\n");
+
+ if(FAILED(StringCchCopy(InputBuffer, sizeof(InputBuffer),
+ "this String is from User Application; using METHOD_NEITHER"))) {
+ return;
+ }
+
+ memset(OutputBuffer, 0, sizeof(OutputBuffer));
+
+ bRc = DeviceIoControl ( hDevice,
+ (DWORD) IOCTL_NONPNP_METHOD_NEITHER,
+ InputBuffer,
+ (DWORD) strlen( InputBuffer )+1,
+ OutputBuffer,
+ sizeof( OutputBuffer),
+ &bytesReturned,
+ NULL
+ );
+
+ if ( !bRc )
+ {
+ printf ( "Error in DeviceIoControl : %d\n", GetLastError());
+ return;
+
+ }
+
+ printf(" OutBuffer (%d): %s\n", bytesReturned, OutputBuffer);
+
+ //
+ // Performing METHOD_IN_DIRECT
+ //
+
+ printf("\nCalling DeviceIoControl METHOD_IN_DIRECT\n");
+
+ if(FAILED(StringCchCopy(InputBuffer, sizeof(InputBuffer),
+ "this String is from User Application; using METHOD_IN_DIRECT"))) {
+ return;
+ }
+
+ if(FAILED(StringCchCopy(OutputBuffer, sizeof(OutputBuffer),
+ "This String is from User Application in OutBuffer; using METHOD_IN_DIRECT"))) {
+ return;
+ }
+
+ bRc = DeviceIoControl ( hDevice,
+ (DWORD) IOCTL_NONPNP_METHOD_IN_DIRECT,
+ InputBuffer,
+ (DWORD) strlen( InputBuffer )+1,
+ OutputBuffer,
+ sizeof( OutputBuffer),
+ &bytesReturned,
+ NULL
+ );
+
+ if ( !bRc )
+ {
+ printf ( "Error in DeviceIoControl : : %d", GetLastError());
+ return;
+ }
+
+ printf(" Number of bytes transfered from OutBuffer: %d\n",
+ bytesReturned);
+
+ //
+ // Performing METHOD_OUT_DIRECT
+ //
+
+ printf("\nCalling DeviceIoControl METHOD_OUT_DIRECT\n");
+ if(FAILED(StringCchCopy(InputBuffer, sizeof(InputBuffer),
+ "this String is from User Application; using METHOD_OUT_DIRECT"))){
+ return;
+ }
+
+ memset(OutputBuffer, 0, sizeof(OutputBuffer));
+
+ bRc = DeviceIoControl ( hDevice,
+ (DWORD) IOCTL_NONPNP_METHOD_OUT_DIRECT,
+ InputBuffer,
+ (DWORD) strlen( InputBuffer )+1,
+ OutputBuffer,
+ sizeof( OutputBuffer),
+ &bytesReturned,
+ NULL
+ );
+
+ if ( !bRc )
+ {
+ printf ( "Error in DeviceIoControl : : %d", GetLastError());
+ return;
+ }
+
+ printf(" OutBuffer (%d): %s\n", bytesReturned, OutputBuffer);
+
+ return;
+
+}
+
+
+BOOLEAN
+DoFileReadWrite(
+ HANDLE HDevice
+ )
+{
+ ULONG bufLength, index;
+ PUCHAR readBuf = NULL;
+ PUCHAR writeBuf = NULL;
+ BOOLEAN ret;
+ ULONG bytesWritten, bytesRead;
+
+ //
+ // Seed the random-number generator with current time so that
+ // the numbers will be different every time we run.
+ //
+ srand( (unsigned)time( NULL ) );
+
+ //
+ // rand function returns a pseudorandom integer in the range 0 to RAND_MAX
+ // (0x7fff)
+ //
+ bufLength = rand();
+ //
+ // Try until the bufLength is not zero.
+ //
+ while(bufLength == 0) {
+ bufLength = rand();
+ }
+
+ //
+ // Allocate a buffer of that size to use for write operation.
+ //
+ writeBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufLength);
+ if(!writeBuf) {
+ ret = FALSE;
+ goto End;
+ }
+ //
+ // Fill the buffer with randon number less than UCHAR_MAX.
+ //
+ index = bufLength;
+ while(index){
+ writeBuf[index-1] = (UCHAR) rand() % UCHAR_MAX;
+ index--;
+ }
+
+ printf("Write %d bytes to file\n", bufLength);
+
+ //
+ // Tell the driver to write the buffer content to the file from the
+ // begining of the file.
+ //
+
+ if (!WriteFile(HDevice,
+ writeBuf,
+ bufLength,
+ &bytesWritten,
+ NULL)) {
+
+ printf("ReadFile failed with error 0x%x\n", GetLastError());
+
+ ret = FALSE;
+ goto End;
+
+ }
+
+ //
+ // Allocate another buffer of same size.
+ //
+ readBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufLength);
+ if(!readBuf) {
+
+ ret = FALSE;
+ goto End;
+ }
+
+ printf("Read %d bytes from the same file\n", bufLength);
+
+ //
+ // Tell the driver to read the file from the begining.
+ //
+ if (!ReadFile(HDevice,
+ readBuf,
+ bufLength,
+ &bytesRead,
+ NULL)) {
+
+ printf("Error: ReadFile failed with error 0x%x\n", GetLastError());
+
+ ret = FALSE;
+ goto End;
+
+ }
+
+ //
+ // Now compare the readBuf and writeBuf content. They should be the same.
+ //
+
+ if(bytesRead != bytesWritten) {
+ printf("bytesRead(%d) != bytesWritten(%d)\n", bytesRead, bytesWritten);
+ ret = FALSE;
+ goto End;
+ }
+
+ if(memcmp(readBuf, writeBuf, bufLength) != 0){
+ printf("Error: ReadBuf and WriteBuf contents are not the same\n");
+ ret = FALSE;
+ goto End;
+ }
+
+ ret = TRUE;
+
+End:
+
+ if(readBuf){
+ HeapFree (GetProcessHeap(), 0, readBuf);
+ }
+
+ if(writeBuf){
+ HeapFree (GetProcessHeap(), 0, writeBuf);
+ }
+
+ return ret;
+
+
+}
+
+
diff --git a/tests/projects/wdk/umdf/echo/driver/device.c b/tests/projects/wdk/umdf/echo/driver/device.c new file mode 100644 index 000000000..bd522565f --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/device.c @@ -0,0 +1,202 @@ +/*++
+
+Copyright (c) 1990-2000 Microsoft Corporation
+
+Module Name:
+
+ device.c - Device handling events for example driver.
+
+Abstract:
+
+ This is a C version of a very simple sample driver that illustrates
+ how to use the driver framework and demonstrates best practices.
+
+--*/
+
+#include "driver.h"
+
+NTSTATUS
+EchoDeviceCreate(
+ PWDFDEVICE_INIT DeviceInit
+ )
+/*++
+
+Routine Description:
+
+ Worker routine called to create a device and its software resources.
+
+Arguments:
+
+ DeviceInit - Pointer to an opaque init structure. Memory for this
+ structure will be freed by the framework when the WdfDeviceCreate
+ succeeds. So don't access the structure after that point.
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ WDF_OBJECT_ATTRIBUTES deviceAttributes;
+ PDEVICE_CONTEXT deviceContext;
+ WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks;
+ WDFDEVICE device;
+ NTSTATUS status;
+
+ WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
+
+ //
+ // Register pnp/power callbacks so that we can start and stop the timer as the device
+ // gets started and stopped.
+ //
+ pnpPowerCallbacks.EvtDeviceSelfManagedIoInit = EchoEvtDeviceSelfManagedIoStart;
+ pnpPowerCallbacks.EvtDeviceSelfManagedIoSuspend = EchoEvtDeviceSelfManagedIoSuspend;
+
+ #pragma prefast(suppress: 28024, "Function used for both Init and Restart Callbacks")
+ pnpPowerCallbacks.EvtDeviceSelfManagedIoRestart = EchoEvtDeviceSelfManagedIoStart;
+
+ //
+ // Register the PnP and power callbacks. Power policy related callbacks will be registered
+ // later in SotwareInit.
+ //
+ WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);
+
+ WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, DEVICE_CONTEXT);
+
+ status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device);
+
+ if (NT_SUCCESS(status)) {
+ //
+ // Get the device context and initialize it. WdfObjectGet_DEVICE_CONTEXT is an
+ // inline function generated by WDF_DECLARE_CONTEXT_TYPE macro in the
+ // device.h header file. This function will do the type checking and return
+ // the device context. If you pass a wrong object handle
+ // it will return NULL and assert if run under framework verifier mode.
+ //
+ deviceContext = WdfObjectGet_DEVICE_CONTEXT(device);
+ deviceContext->PrivateDeviceData = 0;
+
+ //
+ // Create a device interface so that application can find and talk
+ // to us.
+ //
+ status = WdfDeviceCreateDeviceInterface(
+ device,
+ &GUID_DEVINTERFACE_ECHO,
+ NULL // ReferenceString
+ );
+
+ if (NT_SUCCESS(status)) {
+ //
+ // Initialize the I/O Package and any Queues
+ //
+ status = EchoQueueInitialize(device);
+ }
+ }
+
+ return status;
+}
+
+
+NTSTATUS
+EchoEvtDeviceSelfManagedIoStart(
+ IN WDFDEVICE Device
+ )
+/*++
+
+Routine Description:
+
+ This event is called by the Framework when the device is started
+ or restarted after a suspend operation.
+
+ This function is not marked pageable because this function is in the
+ device power up path. When a function is marked pagable and the code
+ section is paged out, it will generate a page fault which could impact
+ the fast resume behavior because the client driver will have to wait
+ until the system drivers can service this page fault.
+
+Arguments:
+
+ Device - Handle to a framework device object.
+
+Return Value:
+
+ NTSTATUS - Failures will result in the device stack being torn down.
+
+--*/
+{
+ PQUEUE_CONTEXT queueContext = QueueGetContext(WdfDeviceGetDefaultQueue(Device));
+ LARGE_INTEGER DueTime;
+
+ KdPrint(("--> EchoEvtDeviceSelfManagedIoInit\n"));
+
+ //
+ // Restart the queue and the periodic timer. We stopped them before going
+ // into low power state.
+ //
+ WdfIoQueueStart(WdfDeviceGetDefaultQueue(Device));
+
+ DueTime.QuadPart = WDF_REL_TIMEOUT_IN_MS(100);
+
+ WdfTimerStart(queueContext->Timer, DueTime.QuadPart);
+
+ KdPrint(( "<-- EchoEvtDeviceSelfManagedIoInit\n"));
+
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+EchoEvtDeviceSelfManagedIoSuspend(
+ IN WDFDEVICE Device
+ )
+/*++
+
+Routine Description:
+
+ This event is called by the Framework when the device is stopped
+ for resource rebalance or suspended when the system is entering
+ Sx state.
+
+
+Arguments:
+
+ Device - Handle to a framework device object.
+
+Return Value:
+
+ NTSTATUS - The driver is not allowed to fail this function. If it does, the
+ device stack will be torn down.
+
+--*/
+{
+ PQUEUE_CONTEXT queueContext = QueueGetContext(WdfDeviceGetDefaultQueue(Device));
+
+ PAGED_CODE();
+
+ KdPrint(("--> EchoEvtDeviceSelfManagedIoSuspend\n"));
+
+ //
+ // Before we stop the timer we should make sure there are no outstanding
+ // i/o. We need to do that because framework cannot suspend the device
+ // if there are requests owned by the driver. There are two ways to solve
+ // this issue: 1) We can wait for the outstanding I/O to be complete by the
+ // periodic timer 2) Register EvtIoStop callback on the queue and acknowledge
+ // the request to inform the framework that it's okay to suspend the device
+ // with outstanding I/O. In this sample we will use the 1st approach
+ // because it's pretty easy to do. We will restart the queue when the
+ // device is restarted.
+ //
+ WdfIoQueueStopSynchronously(WdfDeviceGetDefaultQueue(Device));
+
+ //
+ // Stop the watchdog timer and wait for DPC to run to completion if it's already fired.
+ //
+ WdfTimerStop(queueContext->Timer, TRUE);
+
+ KdPrint(( "<-- EchoEvtDeviceSelfManagedIoSuspend\n"));
+
+ return STATUS_SUCCESS;
+}
+
+
+
diff --git a/tests/projects/wdk/umdf/echo/driver/device.h b/tests/projects/wdk/umdf/echo/driver/device.h new file mode 100644 index 000000000..1e2c1f28e --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/device.h @@ -0,0 +1,48 @@ +/*++
+
+Copyright (c) 1990-2000 Microsoft Corporation
+
+Module Name:
+
+ device.h
+
+Abstract:
+
+ This is a C version of a very simple sample driver that illustrates
+ how to use the driver framework and demonstrates best practices.
+
+--*/
+
+#include "public.h"
+
+//
+// The device context performs the same job as
+// a WDM device extension in the driver frameworks
+//
+typedef struct _DEVICE_CONTEXT
+{
+ ULONG PrivateDeviceData; // just a placeholder
+
+} DEVICE_CONTEXT, *PDEVICE_CONTEXT;
+
+//
+// This macro will generate an inline function called WdfObjectGet_DEVICE_CONTEXT
+// which will be used to get a pointer to the device context memory
+// in a type safe manner.
+//
+WDF_DECLARE_CONTEXT_TYPE(DEVICE_CONTEXT)
+
+//
+// Function to initialize the device and its callbacks
+//
+NTSTATUS
+EchoDeviceCreate(
+ PWDFDEVICE_INIT DeviceInit
+ );
+
+//
+// Device events
+//
+EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT EchoEvtDeviceSelfManagedIoStart;
+EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND EchoEvtDeviceSelfManagedIoSuspend;
+
diff --git a/tests/projects/wdk/umdf/echo/driver/driver.c b/tests/projects/wdk/umdf/echo/driver/driver.c new file mode 100644 index 000000000..2835aa1dd --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/driver.c @@ -0,0 +1,192 @@ +/*++
+
+Copyright (c) 1990-2000 Microsoft Corporation
+
+Module Name:
+
+ driver.c
+
+Abstract:
+
+ This driver demonstrates use of a default I/O Queue, its
+ request start events, cancellation event, and a synchronized DPC.
+
+ To demonstrate asynchronous operation, the I/O requests are not completed
+ immediately, but stored in the drivers private data structure, and a timer
+ will complete it next time the Timer callback runs.
+
+ During the time the request is waiting for the timer callback to run, it is
+ made cancellable by the call WdfRequestMarkCancelable. This
+ allows the test program to cancel the request and exit instantly.
+
+ This rather complicated set of events is designed to demonstrate
+ the driver frameworks synchronization of access to a device driver
+ data structure, and a pointer which can be a proxy for device hardware
+ registers or resources.
+
+ This common data structure, or resource is accessed by new request
+ events arriving, the Timer callback that completes it, and cancel processing.
+
+ Notice the lack of specific lock/unlock operations.
+
+ Even though this example utilizes a serial queue, a parallel queue
+ would not need any additional explicit synchronization, just a
+ strategy for managing multiple requests outstanding.
+
+--*/
+
+#include "driver.h"
+
+NTSTATUS
+DriverEntry(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PUNICODE_STRING RegistryPath
+ )
+/*++
+
+Routine Description:
+ DriverEntry initializes the driver and is the first routine called by the
+ system after the driver is loaded. DriverEntry specifies the other entry
+ points in the function driver, such as EvtDevice and DriverUnload.
+
+Parameters Description:
+
+ DriverObject - represents the instance of the function driver that is loaded
+ into memory. DriverEntry must initialize members of DriverObject before it
+ returns to the caller. DriverObject is allocated by the system before the
+ driver is loaded, and it is released by the system after the system unloads
+ the function driver from memory.
+
+ RegistryPath - represents the driver specific path in the Registry.
+ The function driver can use the path to store driver related data between
+ reboots. The path does not store hardware instance specific data.
+
+Return Value:
+
+ STATUS_SUCCESS if successful,
+ STATUS_UNSUCCESSFUL otherwise.
+
+--*/
+{
+ WDF_DRIVER_CONFIG config;
+ NTSTATUS status;
+
+ WDF_DRIVER_CONFIG_INIT(&config,
+ EchoEvtDeviceAdd
+ );
+
+ status = WdfDriverCreate(DriverObject,
+ RegistryPath,
+ WDF_NO_OBJECT_ATTRIBUTES,
+ &config,
+ WDF_NO_HANDLE);
+ if (!NT_SUCCESS(status)) {
+ KdPrint(("Error: WdfDriverCreate failed 0x%x\n", status));
+ return status;
+ }
+
+#if DBG
+ EchoPrintDriverVersion();
+#endif
+
+ return status;
+}
+
+NTSTATUS
+EchoEvtDeviceAdd(
+ IN WDFDRIVER Driver,
+ IN PWDFDEVICE_INIT DeviceInit
+ )
+/*++
+Routine Description:
+
+ EvtDeviceAdd is called by the framework in response to AddDevice
+ call from the PnP manager. We create and initialize a device object to
+ represent a new instance of the device.
+
+Arguments:
+
+ Driver - Handle to a framework driver object created in DriverEntry
+
+ DeviceInit - Pointer to a framework-allocated WDFDEVICE_INIT structure.
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ NTSTATUS status;
+
+ UNREFERENCED_PARAMETER(Driver);
+
+ KdPrint(("Enter EchoEvtDeviceAdd\n"));
+
+ status = EchoDeviceCreate(DeviceInit);
+
+ return status;
+}
+
+NTSTATUS
+EchoPrintDriverVersion(
+ )
+/*++
+Routine Description:
+
+ This routine shows how to retrieve framework version string and
+ also how to find out to which version of framework library the
+ client driver is bound to.
+
+Arguments:
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ NTSTATUS status;
+ WDFSTRING string;
+ UNICODE_STRING us;
+ WDF_DRIVER_VERSION_AVAILABLE_PARAMS ver;
+
+ //
+ // 1) Retreive version string and print that in the debugger.
+ //
+ status = WdfStringCreate(NULL, WDF_NO_OBJECT_ATTRIBUTES, &string);
+ if (!NT_SUCCESS(status)) {
+ KdPrint(("Error: WdfStringCreate failed 0x%x\n", status));
+ return status;
+ }
+
+ status = WdfDriverRetrieveVersionString(WdfGetDriver(), string);
+ if (!NT_SUCCESS(status)) {
+ //
+ // No need to worry about delete the string object because
+ // by default it's parented to the driver and it will be
+ // deleted when the driverobject is deleted when the DriverEntry
+ // returns a failure status.
+ //
+ KdPrint(("Error: WdfDriverRetrieveVersionString failed 0x%x\n", status));
+ return status;
+ }
+
+ WdfStringGetUnicodeString(string, &us);
+ KdPrint(("Echo Sample %wZ\n", &us));
+
+ WdfObjectDelete(string);
+ string = NULL; // To avoid referencing a deleted object.
+
+ //
+ // 2) Find out to which version of framework this driver is bound to.
+ //
+ WDF_DRIVER_VERSION_AVAILABLE_PARAMS_INIT(&ver, 1, 0);
+ if (WdfDriverIsVersionAvailable(WdfGetDriver(), &ver) == TRUE) {
+ KdPrint(("Yes, framework version is 1.0\n"));
+ }else {
+ KdPrint(("No, framework verison is not 1.0\n"));
+ }
+
+ return STATUS_SUCCESS;
+}
+
diff --git a/tests/projects/wdk/umdf/echo/driver/driver.h b/tests/projects/wdk/umdf/echo/driver/driver.h new file mode 100644 index 000000000..6539d6cf5 --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/driver.h @@ -0,0 +1,46 @@ +/*++
+
+Copyright (c) 1990-2000 Microsoft Corporation
+
+Module Name:
+
+ driver.h
+
+Abstract:
+
+ This is a C version of a very simple sample driver that illustrates
+ how to use the driver framework and demonstrates best practices.
+
+--*/
+
+#define INITGUID
+
+#include <windows.h>
+#include <wdf.h>
+#include "device.h"
+#include "queue.h"
+
+#ifndef ASSERT
+#if DBG
+#define ASSERT( exp ) \
+ ((!(exp)) ? \
+ (KdPrint(( "\n*** Assertion failed: " #exp "\n\n")), \
+ DebugBreak(), \
+ FALSE) : \
+ TRUE)
+#else
+#define ASSERT( exp )
+#endif // DBG
+#endif // ASSERT
+
+//
+// WDFDRIVER Events
+//
+
+DRIVER_INITIALIZE DriverEntry;
+EVT_WDF_DRIVER_DEVICE_ADD EchoEvtDeviceAdd;
+
+NTSTATUS
+EchoPrintDriverVersion(
+ );
+
diff --git a/tests/projects/wdk/umdf/echo/driver/echoum.inx b/tests/projects/wdk/umdf/echo/driver/echoum.inx Binary files differnew file mode 100644 index 000000000..cae8b45fe --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/echoum.inx diff --git a/tests/projects/wdk/umdf/echo/driver/queue.c b/tests/projects/wdk/umdf/echo/driver/queue.c new file mode 100644 index 000000000..e0f3d7b6b --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/queue.c @@ -0,0 +1,538 @@ +/*++
+
+Copyright (c) 1990-2000 Microsoft Corporation
+
+Module Name:
+
+ queue.c
+
+Abstract:
+
+ This is a C version of a very simple sample driver that illustrates
+ how to use the driver framework and demonstrates best practices.
+
+--*/
+
+#include "driver.h"
+
+NTSTATUS
+EchoQueueInitialize(
+ WDFDEVICE Device
+ )
+/*++
+
+Routine Description:
+
+
+ The I/O dispatch callbacks for the frameworks device object
+ are configured in this function.
+
+ A single default I/O Queue is configured for serial request
+ processing, and a driver context memory allocation is created
+ to hold our structure QUEUE_CONTEXT.
+
+ This memory may be used by the driver automatically synchronized
+ by the Queue's presentation lock.
+
+ The lifetime of this memory is tied to the lifetime of the I/O
+ Queue object, and we register an optional destructor callback
+ to release any private allocations, and/or resources.
+
+
+Arguments:
+
+ Device - Handle to a framework device object.
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ WDFQUEUE queue;
+ NTSTATUS status;
+ PQUEUE_CONTEXT queueContext;
+ WDF_IO_QUEUE_CONFIG queueConfig;
+ WDF_OBJECT_ATTRIBUTES queueAttributes;
+
+ //
+ // Configure a default queue so that requests that are not
+ // configure-fowarded using WdfDeviceConfigureRequestDispatching to goto
+ // other queues get dispatched here.
+ //
+ WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
+ &queueConfig,
+ WdfIoQueueDispatchSequential
+ );
+
+ queueConfig.EvtIoRead = EchoEvtIoRead;
+ queueConfig.EvtIoWrite = EchoEvtIoWrite;
+
+ //
+ // Fill in a callback for destroy, and our QUEUE_CONTEXT size
+ //
+ WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&queueAttributes, QUEUE_CONTEXT);
+
+ //
+ // Set synchronization scope on queue and have the timer to use queue as
+ // the parent object so that queue and timer callbacks are synchronized
+ // with the same lock.
+ //
+ queueAttributes.SynchronizationScope = WdfSynchronizationScopeQueue;
+
+ queueAttributes.EvtDestroyCallback = EchoEvtIoQueueContextDestroy;
+
+ status = WdfIoQueueCreate(
+ Device,
+ &queueConfig,
+ &queueAttributes,
+ &queue
+ );
+
+ if( !NT_SUCCESS(status) ) {
+ KdPrint(("WdfIoQueueCreate failed 0x%x\n",status));
+ return status;
+ }
+
+ // Get our Driver Context memory from the returned Queue handle
+ queueContext = QueueGetContext(queue);
+
+ queueContext->WriteMemory = NULL;
+ queueContext->Timer = NULL;
+
+ queueContext->CurrentRequest = NULL;
+ queueContext->CurrentStatus = STATUS_INVALID_DEVICE_REQUEST;
+
+ //
+ // Create the Queue timer
+ //
+ status = EchoTimerCreate(&queueContext->Timer, queue);
+ if (!NT_SUCCESS(status)) {
+ KdPrint(("Error creating timer 0x%x\n",status));
+ return status;
+ }
+
+ return status;
+}
+
+
+NTSTATUS
+EchoTimerCreate(
+ IN WDFTIMER* Timer,
+ IN WDFQUEUE Queue
+ )
+/*++
+
+Routine Description:
+
+ Subroutine to create timer. By associating the timerobject with
+ the queue, we are basically telling the framework to serialize the queue
+ callbacks with the timer callback. By doing so, we don't have to worry
+ about protecting queue-context structure from multiple threads accessing
+ it simultaneously.
+
+Arguments:
+
+
+Return Value:
+
+ NTSTATUS
+
+--*/
+{
+ NTSTATUS Status;
+ WDF_TIMER_CONFIG timerConfig;
+ WDF_OBJECT_ATTRIBUTES timerAttributes;
+
+ //
+ // Create a non-periodic timer since WDF does not allow periodic timer
+ // at passive level, which is the level UMDF callbacks are invoked at.
+ // The workaround is to always restart the timer in the timer callback.
+ //
+ // WDF_TIMER_CONFIG_INIT sets AutomaticSerialization to TRUE by default.
+ //
+ WDF_TIMER_CONFIG_INIT(&timerConfig, EchoEvtTimerFunc);
+
+ WDF_OBJECT_ATTRIBUTES_INIT(&timerAttributes);
+ timerAttributes.ParentObject = Queue; // Synchronize with the I/O Queue
+ timerAttributes.ExecutionLevel = WdfExecutionLevelPassive;
+
+ Status = WdfTimerCreate(&timerConfig,
+ &timerAttributes,
+ Timer // Output handle
+ );
+
+ return Status;
+}
+
+
+
+VOID
+EchoEvtIoQueueContextDestroy(
+ WDFOBJECT Object
+)
+/*++
+
+Routine Description:
+
+ This is called when the Queue that our driver context memory
+ is associated with is destroyed.
+
+Arguments:
+
+ Context - Context that's being freed.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ PQUEUE_CONTEXT queueContext = QueueGetContext(Object);
+
+ //
+ // Release any resources pointed to in the queue context.
+ //
+ // The body of the queue context will be released after
+ // this callback handler returns
+ //
+
+ //
+ // If Queue context has an I/O buffer, release it
+ //
+ if( queueContext->WriteMemory != NULL ) {
+ WdfObjectDelete(queueContext->WriteMemory);
+ queueContext->WriteMemory = NULL;
+ }
+
+ return;
+}
+
+
+VOID
+EchoEvtRequestCancel(
+ IN WDFREQUEST Request
+ )
+/*++
+
+Routine Description:
+
+
+ Called when an I/O request is cancelled after the driver has marked
+ the request cancellable. This callback is automatically synchronized
+ with the I/O callbacks since we have chosen to use frameworks Device
+ level locking.
+
+Arguments:
+
+ Request - Request being cancelled.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ PQUEUE_CONTEXT queueContext = QueueGetContext(WdfRequestGetIoQueue(Request));
+
+ KdPrint(("EchoEvtRequestCancel called on Request 0x%p\n", Request));
+
+ //
+ // The following is race free by the callside or DPC side
+ // synchronizing completion by calling
+ // WdfRequestMarkCancelable(Queue, Request, FALSE) before
+ // completion and not calling WdfRequestComplete if the
+ // return status == STATUS_CANCELLED.
+ //
+ WdfRequestCompleteWithInformation(Request, STATUS_CANCELLED, 0L);
+
+ //
+ // This book keeping is synchronized by the common
+ // Queue presentation lock
+ //
+ ASSERT(queueContext->CurrentRequest == Request);
+ queueContext->CurrentRequest = NULL;
+
+ return;
+}
+
+VOID
+EchoEvtIoRead(
+ IN WDFQUEUE Queue,
+ IN WDFREQUEST Request,
+ IN size_t Length
+ )
+/*++
+
+Routine Description:
+
+ This event is called when the framework receives IRP_MJ_READ request.
+ It will copy the content from the queue-context buffer to the request buffer.
+ If the driver hasn't received any write request earlier, the read returns zero.
+
+Arguments:
+
+ Queue - Handle to the framework queue object that is associated with the
+ I/O request.
+
+ Request - Handle to a framework request object.
+
+ Length - number of bytes to be read.
+ The default property of the queue is to not dispatch
+ zero lenght read & write requests to the driver and
+ complete is with status success. So we will never get
+ a zero length request.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ NTSTATUS Status;
+ PQUEUE_CONTEXT queueContext = QueueGetContext(Queue);
+ WDFMEMORY memory;
+ size_t writeMemoryLength;
+
+ _Analysis_assume_(Length > 0);
+
+ KdPrint(("EchoEvtIoRead Called! Queue 0x%p, Request 0x%p Length %d\n",
+ Queue,Request,Length));
+ //
+ // No data to read
+ //
+ if( (queueContext->WriteMemory == NULL) ) {
+ WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, (ULONG_PTR)0L);
+ return;
+ }
+
+ //
+ // Read what we have
+ //
+ WdfMemoryGetBuffer(queueContext->WriteMemory, &writeMemoryLength);
+ _Analysis_assume_(writeMemoryLength > 0);
+
+ if( writeMemoryLength < Length ) {
+ Length = writeMemoryLength;
+ }
+
+ //
+ // Get the request memory
+ //
+ Status = WdfRequestRetrieveOutputMemory(Request, &memory);
+ if( !NT_SUCCESS(Status) ) {
+ KdPrint(("EchoEvtIoRead Could not get request memory buffer 0x%x\n", Status));
+ WdfVerifierDbgBreakPoint();
+ WdfRequestCompleteWithInformation(Request, Status, 0L);
+ return;
+ }
+
+ // Copy the memory out
+ Status = WdfMemoryCopyFromBuffer( memory, // destination
+ 0, // offset into the destination memory
+ WdfMemoryGetBuffer(queueContext->WriteMemory, NULL),
+ Length );
+ if( !NT_SUCCESS(Status) ) {
+ KdPrint(("EchoEvtIoRead: WdfMemoryCopyFromBuffer failed 0x%x\n", Status));
+ WdfRequestComplete(Request, Status);
+ return;
+ }
+
+ // Set transfer information
+ WdfRequestSetInformation(Request, (ULONG_PTR)Length);
+
+ // Mark the request is cancelable
+ WdfRequestMarkCancelable(Request, EchoEvtRequestCancel);
+
+
+ // Defer the completion to another thread from the timer dpc
+ queueContext->CurrentRequest = Request;
+ queueContext->CurrentStatus = Status;
+
+ return;
+}
+
+VOID
+EchoEvtIoWrite(
+ IN WDFQUEUE Queue,
+ IN WDFREQUEST Request,
+ IN size_t Length
+ )
+/*++
+
+Routine Description:
+
+ This event is invoked when the framework receives IRP_MJ_WRITE request.
+ This routine allocates memory buffer, copies the data from the request to it,
+ and stores the buffer pointer in the queue-context with the length variable
+ representing the buffers length. The actual completion of the request
+ is defered to the periodic timer dpc.
+
+Arguments:
+
+ Queue - Handle to the framework queue object that is associated with the
+ I/O request.
+
+ Request - Handle to a framework request object.
+
+ Length - number of bytes to be read.
+ The default property of the queue is to not dispatch
+ zero lenght read & write requests to the driver and
+ complete is with status success. So we will never get
+ a zero length request.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ NTSTATUS Status;
+ WDFMEMORY memory;
+ PQUEUE_CONTEXT queueContext = QueueGetContext(Queue);
+ PVOID writeBuffer = NULL;
+
+ _Analysis_assume_(Length > 0);
+
+ KdPrint(("EchoEvtIoWrite Called! Queue 0x%p, Request 0x%p Length %d\n",
+ Queue,Request,Length));
+
+ if( Length > MAX_WRITE_LENGTH ) {
+ KdPrint(("EchoEvtIoWrite Buffer Length to big %d, Max is %d\n",
+ Length,MAX_WRITE_LENGTH));
+ WdfRequestCompleteWithInformation(Request, STATUS_BUFFER_OVERFLOW, 0L);
+ return;
+ }
+
+ // Get the memory buffer
+ Status = WdfRequestRetrieveInputMemory(Request, &memory);
+ if( !NT_SUCCESS(Status) ) {
+ KdPrint(("EchoEvtIoWrite Could not get request memory buffer 0x%x\n",
+ Status));
+ WdfVerifierDbgBreakPoint();
+ WdfRequestComplete(Request, Status);
+ return;
+ }
+
+ // Release previous buffer if set
+ if( queueContext->WriteMemory != NULL ) {
+ WdfObjectDelete(queueContext->WriteMemory);
+ queueContext->WriteMemory = NULL;
+ }
+
+ Status = WdfMemoryCreate(WDF_NO_OBJECT_ATTRIBUTES,
+ NonPagedPoolNx,
+ 'sam1',
+ Length,
+ &queueContext->WriteMemory,
+ &writeBuffer
+ );
+
+ if(!NT_SUCCESS(Status)) {
+ KdPrint(("EchoEvtIoWrite: Could not allocate %d byte buffer\n", Length));
+ WdfRequestComplete(Request, STATUS_INSUFFICIENT_RESOURCES);
+ return;
+ }
+
+
+ // Copy the memory in
+ Status = WdfMemoryCopyToBuffer( memory,
+ 0, // offset into the source memory
+ writeBuffer,
+ Length );
+ if( !NT_SUCCESS(Status) ) {
+ KdPrint(("EchoEvtIoWrite WdfMemoryCopyToBuffer failed 0x%x\n", Status));
+ WdfVerifierDbgBreakPoint();
+
+ WdfObjectDelete(queueContext->WriteMemory);
+ queueContext->WriteMemory = NULL;
+
+ WdfRequestComplete(Request, Status);
+ return;
+ }
+
+ // Set transfer information
+ WdfRequestSetInformation(Request, (ULONG_PTR)Length);
+
+ // Specify the request is cancelable
+ WdfRequestMarkCancelable(Request, EchoEvtRequestCancel);
+
+ // Defer the completion to another thread from the timer dpc
+ queueContext->CurrentRequest = Request;
+ queueContext->CurrentStatus = Status;
+
+ return;
+}
+
+
+VOID
+EchoEvtTimerFunc(
+ IN WDFTIMER Timer
+ )
+/*++
+
+Routine Description:
+
+ This is the TimerDPC the driver sets up to complete requests.
+ This function is registered when the WDFTIMER object is created, and
+ will automatically synchronize with the I/O Queue callbacks
+ and cancel routine.
+
+Arguments:
+
+ Timer - Handle to a framework Timer object.
+
+Return Value:
+
+ VOID
+
+--*/
+{
+ NTSTATUS Status;
+ WDFREQUEST Request;
+ WDFQUEUE queue;
+ PQUEUE_CONTEXT queueContext ;
+
+ queue = WdfTimerGetParentObject(Timer);
+ queueContext = QueueGetContext(queue);
+
+ //
+ // DPC is automatically synchronized to the Queue lock,
+ // so this is race free without explicit driver managed locking.
+ //
+ Request = queueContext->CurrentRequest;
+ if( Request != NULL ) {
+
+ //
+ // Attempt to remove cancel status from the request.
+ //
+ // The request is not completed if it is already cancelled
+ // since the EchoEvtIoCancel function has run, or is about to run
+ // and we are racing with it.
+ //
+ Status = WdfRequestUnmarkCancelable(Request);
+ if( Status != STATUS_CANCELLED ) {
+
+ queueContext->CurrentRequest = NULL;
+ Status = queueContext->CurrentStatus;
+
+ KdPrint(("CustomTimerDPC Completing request 0x%p, Status 0x%x \n", Request,Status));
+
+ WdfRequestComplete(Request, Status);
+ }
+ else {
+ KdPrint(("CustomTimerDPC Request 0x%p is STATUS_CANCELLED, not completing\n",
+ Request));
+ }
+ }
+
+ //
+ // Restart the Timer since WDF does not allow periodic timer
+ // with autosynchronization at passive level
+ //
+ WdfTimerStart(Timer, WDF_REL_TIMEOUT_IN_MS(TIMER_PERIOD));
+
+ return;
+}
+
+
diff --git a/tests/projects/wdk/umdf/echo/driver/queue.h b/tests/projects/wdk/umdf/echo/driver/queue.h new file mode 100644 index 000000000..5c04dc8f7 --- /dev/null +++ b/tests/projects/wdk/umdf/echo/driver/queue.h @@ -0,0 +1,62 @@ +/*++
+
+Copyright (c) 1990-2000 Microsoft Corporation
+
+Module Name:
+
+ queue.h
+
+Abstract:
+
+ This is a C version of a very simple sample driver that illustrates
+ how to use the driver framework and demonstrates best practices.
+
+--*/
+
+// Set max write length for testing
+#define MAX_WRITE_LENGTH 1024*40
+
+// Set timer period in ms
+#define TIMER_PERIOD 1000*2
+
+//
+// This is the context that can be placed per queue
+// and would contain per queue information.
+//
+typedef struct _QUEUE_CONTEXT {
+
+ // Here we allocate a buffer from a test write so it can be read back
+ WDFMEMORY WriteMemory;
+
+ // Timer DPC for this queue
+ WDFTIMER Timer;
+
+ // Virtual I/O
+ WDFREQUEST CurrentRequest;
+ NTSTATUS CurrentStatus;
+
+} QUEUE_CONTEXT, *PQUEUE_CONTEXT;
+
+WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(QUEUE_CONTEXT, QueueGetContext)
+
+NTSTATUS
+EchoQueueInitialize(
+ WDFDEVICE hDevice
+ );
+
+EVT_WDF_IO_QUEUE_CONTEXT_DESTROY_CALLBACK EchoEvtIoQueueContextDestroy;
+
+//
+// Events from the IoQueue object
+//
+EVT_WDF_REQUEST_CANCEL EchoEvtRequestCancel;
+EVT_WDF_IO_QUEUE_IO_READ EchoEvtIoRead;
+EVT_WDF_IO_QUEUE_IO_WRITE EchoEvtIoWrite;
+
+NTSTATUS
+EchoTimerCreate(
+ IN WDFTIMER* pTimer,
+ IN WDFQUEUE Queue
+ );
+
+EVT_WDF_TIMER EchoEvtTimerFunc;
diff --git a/tests/projects/wdk/umdf/echo/exe/echoapp.cpp b/tests/projects/wdk/umdf/echo/exe/echoapp.cpp new file mode 100644 index 000000000..47c0ae0a1 --- /dev/null +++ b/tests/projects/wdk/umdf/echo/exe/echoapp.cpp @@ -0,0 +1,652 @@ +/*++
+
+Copyright (c) Microsoft Corporation
+
+Module Name:
+
+ EchoApp.cpp
+
+Abstract:
+
+ An application to exercise the WDF "echo" sample driver.
+
+
+Environment:
+
+ user mode only
+
+--*/
+
+
+#include <DriverSpecs.h>
+_Analysis_mode_(_Analysis_code_type_user_code_)
+
+#define INITGUID
+
+#include <windows.h>
+#include <strsafe.h>
+#include <cfgmgr32.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "public.h"
+
+#define NUM_ASYNCH_IO 100
+#define BUFFER_SIZE (40*1024)
+
+#define READER_TYPE 1
+#define WRITER_TYPE 2
+
+#define MAX_DEVPATH_LENGTH 256
+
+BOOLEAN G_PerformAsyncIo;
+BOOLEAN G_LimitedLoops;
+ULONG G_AsyncIoLoopsNum;
+WCHAR G_DevicePath[MAX_DEVPATH_LENGTH];
+
+
+ULONG
+AsyncIo(
+ PVOID ThreadParameter
+ );
+
+BOOLEAN
+PerformWriteReadTest(
+ IN HANDLE hDevice,
+ IN ULONG TestLength
+ );
+
+BOOL
+GetDevicePath(
+ IN LPGUID InterfaceGuid,
+ _Out_writes_(BufLen) PWCHAR DevicePath,
+ _In_ size_t BufLen
+ );
+
+
+int __cdecl
+main(
+ _In_ int argc,
+ _In_reads_(argc) char* argv[]
+ )
+{
+ HANDLE hDevice = INVALID_HANDLE_VALUE;
+ HANDLE th1 = NULL;
+ BOOLEAN result = TRUE;
+
+
+ if (argc > 1) {
+ if(!_strnicmp (argv[1], "-Async", 6) ) {
+ G_PerformAsyncIo = TRUE;
+ if (argc > 2) {
+ G_AsyncIoLoopsNum = atoi(argv[2]);
+ G_LimitedLoops = TRUE;
+ }
+ else {
+ G_LimitedLoops = FALSE;
+ }
+
+ } else {
+ printf("Usage:\n");
+ printf(" Echoapp.exe --- Send single write and read request synchronously\n");
+ printf(" Echoapp.exe -Async --- Send reads and writes asynchronously without terminating\n");
+ printf(" Echoapp.exe -Async <number> --- Send <number> reads and writes asynchronously\n");
+ printf("Exit the app anytime by pressing Ctrl-C\n");
+ result = FALSE;
+ goto exit;
+ }
+ }
+
+ if ( !GetDevicePath(
+ (LPGUID) &GUID_DEVINTERFACE_ECHO,
+ G_DevicePath,
+ sizeof(G_DevicePath)/sizeof(G_DevicePath[0])) )
+ {
+ result = FALSE;
+ goto exit;
+ }
+
+ printf("DevicePath: %ws\n", G_DevicePath);
+
+ hDevice = CreateFile(G_DevicePath,
+ GENERIC_READ|GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ 0,
+ NULL );
+
+ if (hDevice == INVALID_HANDLE_VALUE) {
+ printf("Failed to open device. Error %d\n",GetLastError());
+ result = FALSE;
+ goto exit;
+ }
+
+ printf("Opened device successfully\n");
+
+ if(G_PerformAsyncIo) {
+
+ printf("Starting AsyncIo\n");
+
+ //
+ // Create a reader thread
+ //
+ th1 = CreateThread( NULL, // Default Security Attrib.
+ 0, // Initial Stack Size,
+ (LPTHREAD_START_ROUTINE) AsyncIo, // Thread Func
+ (LPVOID)READER_TYPE,
+ 0, // Creation Flags
+ NULL ); // Don't need the Thread Id.
+
+ if (th1 == NULL) {
+ printf("Couldn't create reader thread - error %d\n", GetLastError());
+ result = FALSE;
+ goto exit;
+ }
+
+ //
+ // Use this thread for peforming write.
+ //
+ result = (BOOLEAN)AsyncIo((PVOID)WRITER_TYPE);
+
+ }else {
+ //
+ // Write pattern buffers and read them back, then verify them
+ //
+ result = PerformWriteReadTest(hDevice, 512);
+ if(!result) {
+ goto exit;
+ }
+
+ result = PerformWriteReadTest(hDevice, 30*1024);
+ if(!result) {
+ goto exit;
+ }
+
+ }
+
+exit:
+
+ if (th1 != NULL) {
+ WaitForSingleObject(th1, INFINITE);
+ CloseHandle(th1);
+ }
+
+ if (hDevice != INVALID_HANDLE_VALUE) {
+ CloseHandle(hDevice);
+ }
+
+ return ((result == TRUE) ? 0 : 1);
+
+}
+
+PUCHAR
+CreatePatternBuffer(
+ IN ULONG Length
+ )
+{
+ unsigned int i;
+ PUCHAR p, pBuf;
+
+ pBuf = (PUCHAR)malloc(Length);
+ if( pBuf == NULL ) {
+ printf("Could not allocate %d byte buffer\n",Length);
+ return NULL;
+ }
+
+ p = pBuf;
+
+ for(i=0; i < Length; i++ ) {
+ *p = (UCHAR)i;
+ p++;
+ }
+
+ return pBuf;
+}
+
+BOOLEAN
+VerifyPatternBuffer(
+ _In_reads_bytes_(Length) PUCHAR pBuffer,
+ _In_ ULONG Length
+ )
+{
+ unsigned int i;
+ PUCHAR p = pBuffer;
+
+ for( i=0; i < Length; i++ ) {
+
+ if( *p != (UCHAR)(i & 0xFF) ) {
+ printf("Pattern changed. SB 0x%x, Is 0x%x\n",
+ (UCHAR)(i & 0xFF), *p);
+ return FALSE;
+ }
+
+ p++;
+ }
+
+ return TRUE;
+}
+
+BOOLEAN
+PerformWriteReadTest(
+ IN HANDLE hDevice,
+ IN ULONG TestLength
+ )
+/*
+*/
+{
+ ULONG bytesReturned =0;
+ PUCHAR WriteBuffer = NULL,
+ ReadBuffer = NULL;
+ BOOLEAN result = TRUE;
+
+ WriteBuffer = CreatePatternBuffer(TestLength);
+ if( WriteBuffer == NULL ) {
+
+ result = FALSE;
+ goto Cleanup;
+ }
+
+ ReadBuffer = (PUCHAR)malloc(TestLength);
+ if( ReadBuffer == NULL ) {
+
+ printf("PerformWriteReadTest: Could not allocate %d "
+ "bytes ReadBuffer\n",TestLength);
+
+ result = FALSE;
+ goto Cleanup;
+
+ }
+
+ //
+ // Write the pattern to the device
+ //
+ bytesReturned = 0;
+
+ if (!WriteFile ( hDevice,
+ WriteBuffer,
+ TestLength,
+ &bytesReturned,
+ NULL)) {
+
+ printf ("PerformWriteReadTest: WriteFile failed: "
+ "Error %d\n", GetLastError());
+
+ result = FALSE;
+ goto Cleanup;
+
+ } else {
+
+ if( bytesReturned != TestLength ) {
+
+ printf("bytes written is not test length! Written %d, "
+ "SB %d\n",bytesReturned, TestLength);
+
+ result = FALSE;
+ goto Cleanup;
+ }
+
+ printf ("%d Pattern Bytes Written successfully\n",
+ bytesReturned);
+ }
+
+ bytesReturned = 0;
+
+ if ( !ReadFile (hDevice,
+ ReadBuffer,
+ TestLength,
+ &bytesReturned,
+ NULL)) {
+
+ printf ("PerformWriteReadTest: ReadFile failed: "
+ "Error %d\n", GetLastError());
+
+ result = FALSE;
+ goto Cleanup;
+
+ } else {
+
+ if( bytesReturned != TestLength ) {
+
+ printf("bytes Read is not test length! Read %d, "
+ "SB %d\n",bytesReturned, TestLength);
+
+ //
+ // Note: Is this a Failure Case??
+ //
+ result = FALSE;
+ goto Cleanup;
+ }
+
+ printf ("%d Pattern Bytes Read successfully\n",bytesReturned);
+ }
+
+ //
+ // Now compare
+ //
+ if( !VerifyPatternBuffer(ReadBuffer, TestLength) ) {
+
+ printf("Verify failed\n");
+
+ result = FALSE;
+ goto Cleanup;
+ }
+
+ printf("Pattern Verified successfully\n");
+
+Cleanup:
+
+ //
+ // Free WriteBuffer if non NULL.
+ //
+ if (WriteBuffer) {
+ free (WriteBuffer);
+ }
+
+ //
+ // Free ReadBuffer if non NULL
+ //
+ if (ReadBuffer) {
+ free (ReadBuffer);
+ }
+
+ return result;
+}
+
+ULONG
+AsyncIo(
+ PVOID ThreadParameter
+ )
+{
+ HANDLE hDevice = INVALID_HANDLE_VALUE;
+ HANDLE hCompletionPort = NULL;
+ OVERLAPPED *pOvList = NULL;
+ PUCHAR buf = NULL;
+ ULONG numberOfBytesTransferred;
+ OVERLAPPED *completedOv;
+ ULONG_PTR i;
+ ULONG ioType = (ULONG)(ULONG_PTR)ThreadParameter;
+ ULONG_PTR key;
+ ULONG error;
+ BOOLEAN result = TRUE;
+ ULONG maxPendingRequests = NUM_ASYNCH_IO;
+ ULONG remainingRequestsToSend = 0;
+ ULONG remainingRequestsToReceive = 0;
+
+ hDevice = CreateFile(G_DevicePath,
+ GENERIC_WRITE|GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_OVERLAPPED,
+ NULL );
+
+
+ if (hDevice == INVALID_HANDLE_VALUE) {
+ printf("Cannot open %ws error %d\n", G_DevicePath, GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+
+ hCompletionPort = CreateIoCompletionPort(hDevice, NULL, 1, 0);
+ if (hCompletionPort == NULL) {
+ printf("Cannot open completion port %d \n",GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+
+ //
+ // We will only have NUM_ASYNCH_IO or G_AsyncIoLoopsNum pending at any
+ // time (whichever is less)
+ //
+ if (G_LimitedLoops == TRUE) {
+ remainingRequestsToReceive = G_AsyncIoLoopsNum;
+ if (G_AsyncIoLoopsNum > NUM_ASYNCH_IO) {
+ //
+ // After we send the initial NUM_ASYNCH_IO, we will have additional
+ // (G_AsyncIoLoopsNum - NUM_ASYNCH_IO) I/Os to send
+ //
+ maxPendingRequests = NUM_ASYNCH_IO;
+ remainingRequestsToSend = G_AsyncIoLoopsNum - NUM_ASYNCH_IO;
+ }
+ else {
+ maxPendingRequests = G_AsyncIoLoopsNum;
+ remainingRequestsToSend = 0;
+
+ }
+ }
+
+ pOvList = (OVERLAPPED *)malloc(maxPendingRequests * sizeof(OVERLAPPED));
+ if (pOvList == NULL) {
+ printf("Cannot allocate overlapped array \n");
+ result = FALSE;
+ goto Error;
+ }
+
+ buf = (PUCHAR)malloc(maxPendingRequests * BUFFER_SIZE);
+ if (buf == NULL) {
+ printf("Cannot allocate buffer \n");
+ result = FALSE;
+ goto Error;
+ }
+
+ ZeroMemory(pOvList, maxPendingRequests * sizeof(OVERLAPPED));
+ ZeroMemory(buf, maxPendingRequests * BUFFER_SIZE);
+
+ //
+ // Issue asynch I/O
+ //
+
+ for (i = 0; i < maxPendingRequests; i++) {
+ if (ioType == READER_TYPE) {
+ if ( ReadFile( hDevice,
+ buf + (i* BUFFER_SIZE),
+ BUFFER_SIZE,
+ NULL,
+ &pOvList[i]) == 0) {
+
+ error = GetLastError();
+ if (error != ERROR_IO_PENDING) {
+ printf(" %dth Read failed %d \n", (ULONG) i, GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+ }
+
+ } else {
+ if ( WriteFile( hDevice,
+ buf + (i* BUFFER_SIZE),
+ BUFFER_SIZE,
+ NULL,
+ &pOvList[i]) == 0) {
+ error = GetLastError();
+ if (error != ERROR_IO_PENDING) {
+ printf(" %dth Write failed %d \n", (ULONG) i, GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+ }
+ }
+ }
+
+ //
+ // Wait for the I/Os to complete. If one completes then reissue the I/O
+ //
+
+ WHILE (1) {
+
+ if ( GetQueuedCompletionStatus(hCompletionPort, &numberOfBytesTransferred, &key, &completedOv, INFINITE) == 0) {
+ printf("GetQueuedCompletionStatus failed %d\n", GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+
+ //
+ // Read successfully completed. If we're doing unlimited I/Os then Issue another one.
+ //
+
+ if (ioType == READER_TYPE) {
+
+ i = completedOv - pOvList;
+ printf("Number of bytes read by request number %Id is %d\n", i, numberOfBytesTransferred);
+
+ //
+ // If we're done with the I/Os, then exit
+ //
+ if (G_LimitedLoops == TRUE) {
+ if ((--remainingRequestsToReceive) == 0) {
+ break;
+ }
+
+ if (remainingRequestsToSend == 0) {
+ continue;
+ }
+ else {
+ remainingRequestsToSend--;
+ }
+ }
+
+
+ if ( ReadFile( hDevice,
+ buf + (i * BUFFER_SIZE),
+ BUFFER_SIZE,
+ NULL,
+ completedOv) == 0) {
+ error = GetLastError();
+ if (error != ERROR_IO_PENDING) {
+ printf("%Idth Read failed %d \n", i, GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+ }
+ } else {
+
+ i = completedOv - pOvList;
+
+ printf("Number of bytes written by request number %Id is %d\n", i, numberOfBytesTransferred);
+
+ //
+ // If we're done with the I/Os, then exit
+ //
+ if (G_LimitedLoops == TRUE) {
+ if ((--remainingRequestsToReceive) == 0) {
+ break;
+ }
+
+ if (remainingRequestsToSend == 0) {
+ continue;
+ }
+ else {
+ remainingRequestsToSend--;
+ }
+ }
+
+
+ if ( WriteFile( hDevice,
+ buf + (i * BUFFER_SIZE),
+ BUFFER_SIZE,
+ NULL,
+ completedOv) == 0) {
+ error = GetLastError();
+ if (error != ERROR_IO_PENDING) {
+
+ printf("%Idth write failed %d \n", i, GetLastError());
+ result = FALSE;
+ goto Error;
+ }
+ }
+ }
+ }
+
+Error:
+ if(hDevice != INVALID_HANDLE_VALUE) {
+ CloseHandle(hDevice);
+ }
+
+ if(hCompletionPort) {
+ CloseHandle(hCompletionPort);
+ }
+
+ if(buf) {
+ free(buf);
+ }
+ if(pOvList) {
+ free(pOvList);
+ }
+
+ return (ULONG)result;
+
+}
+
+BOOL
+GetDevicePath(
+ _In_ LPGUID InterfaceGuid,
+ _Out_writes_(BufLen) PWCHAR DevicePath,
+ _In_ size_t BufLen
+ )
+{
+ CONFIGRET cr = CR_SUCCESS;
+ PWSTR deviceInterfaceList = NULL;
+ ULONG deviceInterfaceListLength = 0;
+ PWSTR nextInterface;
+ HRESULT hr = E_FAIL;
+ BOOL bRet = TRUE;
+
+ cr = CM_Get_Device_Interface_List_Size(
+ &deviceInterfaceListLength,
+ InterfaceGuid,
+ NULL,
+ CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
+ if (cr != CR_SUCCESS) {
+ printf("Error 0x%x retrieving device interface list size.\n", cr);
+ goto clean0;
+ }
+
+ if (deviceInterfaceListLength <= 1) {
+ bRet = FALSE;
+ printf("Error: No active device interfaces found.\n"
+ " Is the sample driver loaded?");
+ goto clean0;
+ }
+
+ deviceInterfaceList = (PWSTR)malloc(deviceInterfaceListLength * sizeof(WCHAR));
+ if (deviceInterfaceList == NULL) {
+ printf("Error allocating memory for device interface list.\n");
+ goto clean0;
+ }
+ ZeroMemory(deviceInterfaceList, deviceInterfaceListLength * sizeof(WCHAR));
+
+ cr = CM_Get_Device_Interface_List(
+ InterfaceGuid,
+ NULL,
+ deviceInterfaceList,
+ deviceInterfaceListLength,
+ CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
+ if (cr != CR_SUCCESS) {
+ printf("Error 0x%x retrieving device interface list.\n", cr);
+ goto clean0;
+ }
+
+ nextInterface = deviceInterfaceList + wcslen(deviceInterfaceList) + 1;
+ if (*nextInterface != UNICODE_NULL) {
+ printf("Warning: More than one device interface instance found. \n"
+ "Selecting first matching device.\n\n");
+ }
+
+ hr = StringCchCopy(DevicePath, BufLen, deviceInterfaceList);
+ if (FAILED(hr)) {
+ bRet = FALSE;
+ printf("Error: StringCchCopy failed with HRESULT 0x%x", hr);
+ goto clean0;
+ }
+
+clean0:
+ if (deviceInterfaceList != NULL) {
+ free(deviceInterfaceList);
+ }
+ if (CR_SUCCESS != cr) {
+ bRet = FALSE;
+ }
+
+ return bRet;
+}
+
diff --git a/tests/projects/wdk/umdf/echo/exe/public.h b/tests/projects/wdk/umdf/echo/exe/public.h new file mode 100644 index 000000000..defcded56 --- /dev/null +++ b/tests/projects/wdk/umdf/echo/exe/public.h @@ -0,0 +1,30 @@ +/*++
+Copyright (c) 1990-2000 Microsoft Corporation All Rights Reserved
+
+Module Name:
+
+ public.h
+
+Abstract:
+
+ This module contains the common declarations shared by driver
+ and user applications.
+
+
+Environment:
+
+ user and kernel
+
+--*/
+
+#define WHILE(a) \
+__pragma(warning(suppress:4127)) while(a)
+
+//
+// Define an Interface Guid so that app can find the device and talk to it.
+//
+
+DEFINE_GUID (GUID_DEVINTERFACE_ECHO,
+ 0xcdc35b6e, 0xbe4, 0x4936, 0xbf, 0x5f, 0x55, 0x37, 0x38, 0xa, 0x7c, 0x1a);
+// {CDC35B6E-0BE4-4936-BF5F-5537380A7C1A}
+
|
