├── .gitattributes ├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md └── ved ├── 3rdparty ├── gtest │ ├── include │ │ ├── gmock │ │ │ ├── gmock-actions.h │ │ │ ├── gmock-cardinalities.h │ │ │ ├── gmock-function-mocker.h │ │ │ ├── gmock-generated-actions.h │ │ │ ├── gmock-generated-actions.h.pump │ │ │ ├── gmock-generated-function-mockers.h │ │ │ ├── gmock-generated-function-mockers.h.pump │ │ │ ├── gmock-generated-matchers.h │ │ │ ├── gmock-generated-matchers.h.pump │ │ │ ├── gmock-matchers.h │ │ │ ├── gmock-more-actions.h │ │ │ ├── gmock-more-matchers.h │ │ │ ├── gmock-nice-strict.h │ │ │ ├── gmock-spec-builders.h │ │ │ ├── gmock.h │ │ │ └── internal │ │ │ │ ├── custom │ │ │ │ ├── README.md │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ ├── gmock-matchers.h │ │ │ │ └── gmock-port.h │ │ │ │ ├── gmock-internal-utils.h │ │ │ │ ├── gmock-port.h │ │ │ │ └── gmock-pp.h │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-matchers.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── custom │ │ │ ├── README.md │ │ │ ├── gtest-port.h │ │ │ ├── gtest-printers.h │ │ │ └── gtest.h │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port-arch.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ └── src │ │ ├── gmock-all.cc │ │ ├── gtest-all.cc │ │ └── src │ │ ├── gmock-cardinalities.cc │ │ ├── gmock-internal-utils.cc │ │ ├── gmock-matchers.cc │ │ ├── gmock-spec-builders.cc │ │ ├── gmock.cc │ │ ├── gmock_main.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-matchers.cc │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc ├── json │ └── json.hpp ├── kcrt │ ├── include │ │ └── kcrt.h │ └── lib │ │ ├── x64 │ │ └── kcrt.lib │ │ └── x86 │ │ └── kcrt.lib └── kstl │ ├── include │ ├── EABase │ │ ├── config │ │ │ ├── eacompiler.h │ │ │ ├── eacompilertraits.h │ │ │ └── eaplatform.h │ │ ├── eabase.h │ │ ├── eahave.h │ │ ├── earesult.h │ │ ├── eastdarg.h │ │ ├── eaunits.h │ │ ├── nullptr.h │ │ └── version.h │ └── EASTL │ │ ├── algorithm.h │ │ ├── allocator.h │ │ ├── allocator_malloc.h │ │ ├── any.h │ │ ├── array.h │ │ ├── bitset.h │ │ ├── bitvector.h │ │ ├── bonus │ │ ├── adaptors.h │ │ ├── call_traits.h │ │ ├── compressed_pair.h │ │ ├── fixed_ring_buffer.h │ │ ├── fixed_string_abstract.h │ │ ├── intrusive_sdlist.h │ │ ├── intrusive_slist.h │ │ ├── list_map.h │ │ ├── ring_buffer.h │ │ ├── sort_extra.h │ │ ├── sparse_matrix.h │ │ └── string_abstract.h │ │ ├── chrono.h │ │ ├── core_allocator.h │ │ ├── core_allocator_adapter.h │ │ ├── deque.h │ │ ├── fixed_allocator.h │ │ ├── fixed_function.h │ │ ├── fixed_hash_map.h │ │ ├── fixed_hash_set.h │ │ ├── fixed_list.h │ │ ├── fixed_map.h │ │ ├── fixed_set.h │ │ ├── fixed_slist.h │ │ ├── fixed_string.h │ │ ├── fixed_substring.h │ │ ├── fixed_vector.h │ │ ├── functional.h │ │ ├── hash_map.h │ │ ├── hash_set.h │ │ ├── heap.h │ │ ├── initializer_list.h │ │ ├── internal │ │ ├── allocator_traits.h │ │ ├── allocator_traits_fwd_decls.h │ │ ├── char_traits.h │ │ ├── config.h │ │ ├── copy_help.h │ │ ├── enable_shared.h │ │ ├── fill_help.h │ │ ├── fixed_pool.h │ │ ├── function.h │ │ ├── function_help.h │ │ ├── functional_base.h │ │ ├── generic_iterator.h │ │ ├── hashtable.h │ │ ├── in_place_t.h │ │ ├── integer_sequence.h │ │ ├── intrusive_hashtable.h │ │ ├── mem_fn.h │ │ ├── memory_base.h │ │ ├── meta.h │ │ ├── move_help.h │ │ ├── pair_fwd_decls.h │ │ ├── piecewise_construct_t.h │ │ ├── red_black_tree.h │ │ ├── smart_ptr.h │ │ ├── thread_support.h │ │ ├── tuple_fwd_decls.h │ │ ├── type_compound.h │ │ ├── type_fundamental.h │ │ ├── type_pod.h │ │ ├── type_properties.h │ │ └── type_transformations.h │ │ ├── intrusive_hash_map.h │ │ ├── intrusive_hash_set.h │ │ ├── intrusive_list.h │ │ ├── intrusive_ptr.h │ │ ├── iterator.h │ │ ├── linked_array.h │ │ ├── linked_ptr.h │ │ ├── list.h │ │ ├── map.h │ │ ├── memory.h │ │ ├── meta.h │ │ ├── numeric.h │ │ ├── numeric_limits.h │ │ ├── optional.h │ │ ├── priority_queue.h │ │ ├── queue.h │ │ ├── random.h │ │ ├── ratio.h │ │ ├── safe_ptr.h │ │ ├── scoped_array.h │ │ ├── scoped_ptr.h │ │ ├── segmented_vector.h │ │ ├── set.h │ │ ├── shared_array.h │ │ ├── shared_ptr.h │ │ ├── slist.h │ │ ├── sort.h │ │ ├── span.h │ │ ├── stack.h │ │ ├── string.h │ │ ├── string_hash_map.h │ │ ├── string_map.h │ │ ├── string_view.h │ │ ├── tuple.h │ │ ├── type_traits.h │ │ ├── unique_ptr.h │ │ ├── unordered_map.h │ │ ├── unordered_set.h │ │ ├── utility.h │ │ ├── variant.h │ │ ├── vector.h │ │ ├── vector_map.h │ │ ├── vector_multimap.h │ │ ├── vector_multiset.h │ │ ├── vector_set.h │ │ ├── version.h │ │ └── weak_ptr.h │ └── lib │ ├── x64 │ └── kstl.lib │ └── x86 │ └── kstl.lib ├── Driver ├── Driver.inf ├── Driver.vcxproj ├── Driver.vcxproj.filters ├── headers │ ├── codeioctl.h │ ├── constants.h │ ├── crypt.h │ ├── globalvariable.h │ ├── headers.h │ ├── libraries.h │ └── structs.h ├── source │ ├── crypt.cpp │ └── driver.cpp └── utils │ ├── path.cpp │ └── path.hpp ├── Tests ├── TestDriver │ ├── TestDriver.cpp │ ├── TestDriver.vcxproj │ └── TestDriver.vcxproj.filters └── TestLib │ ├── TestLib.vcxproj │ ├── pch.cpp │ ├── pch.h │ └── test.cpp ├── general-headers ├── constant.h └── open_file_info.h ├── libs ├── dynamic-lib │ └── Dll │ │ ├── DynamicLib.vcxproj │ │ ├── DynamicLib.vcxproj.filters │ │ ├── dllmain.cpp │ │ └── export │ │ ├── include │ │ ├── functions.h │ │ ├── global_variable.h │ │ ├── main.h │ │ ├── safecall.h │ │ └── utils.h │ │ └── src │ │ ├── main.cpp │ │ └── utils.cpp └── static-lib │ ├── Lib.vcxproj │ ├── Lib.vcxproj.filters │ ├── global_headers │ ├── pch.cpp │ └── pch.h │ └── source │ ├── New Text Document.txt │ ├── classes │ ├── copy_sparse │ │ ├── copy_sparse.cpp │ │ └── copy_sparse.h │ ├── define_device │ │ ├── define_device_manager.cpp │ │ └── define_device_manager.h │ ├── device │ │ ├── device.cpp │ │ └── device.h │ ├── driver_disk │ │ ├── driver_disk.cpp │ │ └── driver_disk.h │ ├── exceptions │ │ └── exception.h │ ├── file │ │ ├── file.cpp │ │ └── file.h │ ├── hash │ │ ├── hash.cpp │ │ └── hash.h │ ├── install_manager │ │ ├── install_manager.cpp │ │ └── install_manager.h │ ├── ved_manager │ │ ├── ved_manager.cpp │ │ └── ved_manager.h │ └── wrap │ │ ├── wrap.cpp │ │ └── wrap.h │ └── interface │ ├── i_file.h │ └── i_ved_manager.h ├── support └── RegisterDriver │ ├── RegisterDriver.cpp │ ├── RegisterDriver.vcxproj │ └── RegisterDriver.vcxproj.filters ├── user-program ├── ConsoleInterface │ └── UserConsoleApplication │ │ ├── UserConsoleApplication.cpp │ │ ├── UserConsoleApplication.vcxproj │ │ ├── UserConsoleApplication.vcxproj.filters │ │ ├── global_headers │ │ ├── pch.cpp │ │ └── pch.h │ │ └── source │ │ └── classes │ │ ├── comand_line_argument │ │ ├── comand_line_argument.cpp │ │ └── comand_line_argument.h │ │ └── engine │ │ ├── engine.cpp │ │ └── engine.h ├── GUI │ ├── GUI.pro │ ├── GUI_resource.rc │ ├── copy.cpp │ ├── copy.h │ ├── copy.ui │ ├── createnew.cpp │ ├── createnew.h │ ├── createnew.ui │ ├── main.cpp │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── mainwindow.ui │ ├── mount.cpp │ ├── mount.h │ └── mount.ui └── WPF-GUI │ └── GUI │ ├── App.xaml │ ├── App.xaml.cs │ ├── ApplicationSettings.cs │ ├── AssemblyInfo.cs │ ├── GUI.csproj │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── MountDisk.xaml │ ├── MountDisk.xaml.cs │ ├── Utils │ └── Utils.cs │ ├── VEDHelper │ ├── DllHelper.cs │ ├── VedManager.cs │ └── VedUnsafeNativeMethods │ │ └── NativeVedApi.cs │ ├── View │ ├── VirtualDisk.cs │ └── VirtualDiskView.cs │ └── YzyDDxS.ico ├── ved.sln ├── ved.vcxproj └── ved.vcxproj.filters /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: VED ALL 2 | on: [push] 3 | jobs: 4 | build: 5 | runs-on: windows-latest 6 | 7 | steps: 8 | - uses: actions/checkout@master 9 | 10 | - name: Setup MSBuild.exe 11 | uses: warrenbuckley/Setup-MSBuild@v1 12 | env: 13 | ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' 14 | 15 | - name: MSRestore 16 | run: msbuild /property:Configuration=debug /p:Platform=x86 /t:Restore .\ved\ved.sln 17 | - name: MSBuild 18 | run: msbuild /property:Configuration=debug /p:Platform=x86 .\ved\ved.sln 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 dumitory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Virtual encrypted disk 2 | 3 | ### Appointment 4 | 5 | An application for creating and working with virtual encrypted logical drives. 6 | 7 | ### Functionality 8 | 1. Creates a crypted disk stored in a file (the path to the file and name, password, size of the created disk are indicated) 9 | 2. Mounts the specified file as a logical drive. (checking the password specified at creation) 10 | 3. Removes the previously mounted disk. 11 | 4. Allows you to view a list of mounted disks. 12 | 5. Encrypts / decrypts data written / read from disk. 13 | 6. Supports working with file paths in different languages. 14 | 15 | ### Technology requirements 16 | 1. The GUI can be written in C # or Qt or another framework. 17 | 2. For development, use Visual Studio. 18 | 3. To write a work plan, use MS Project Manager 2007 and higher. 19 | 4. Use GIT to store the source code. 20 | 21 | ### Implementation details 22 | 1. User Interface 23 | - Functionality: 24 | - Create a disk (with the path to the file, password, disk size) 25 | - Encryption mode selection 26 | - Copy parse files 27 | - Mount disk (with the path to the file and password verification) 28 | - Dismount the specified drive 29 | - View the list of mounted disks (drive letter, size, file path) 30 | 31 | Implement the interface using a console application or GUI. 32 | 2. Driver - a virtual disk driver that redirects data to a file with encryption. 33 | 34 | ### Links 35 | Online [documentation](https://ved-docs.dumitory.dev/) 36 | 37 | ### Old project history 38 | https://github.com/DumitoryDev/VED 39 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/gmock-more-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file implements some matchers that depend on gmock-generated-matchers.h. 34 | // 35 | // Note that tests are implemented in gmock-matchers_test.cc rather than 36 | // gmock-more-matchers-test.cc. 37 | 38 | // GOOGLETEST_CM0002 DO NOT DELETE 39 | 40 | #ifndef GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ 41 | #define GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ 42 | 43 | #include "gmock/gmock-generated-matchers.h" 44 | 45 | namespace testing { 46 | 47 | // Silence C4100 (unreferenced formal 48 | // parameter) for MSVC 49 | #ifdef _MSC_VER 50 | # pragma warning(push) 51 | # pragma warning(disable:4100) 52 | #if (_MSC_VER == 1900) 53 | // and silence C4800 (C4800: 'int *const ': forcing value 54 | // to bool 'true' or 'false') for MSVC 14 55 | # pragma warning(disable:4800) 56 | #endif 57 | #endif 58 | 59 | // Defines a matcher that matches an empty container. The container must 60 | // support both size() and empty(), which all STL-like containers provide. 61 | MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { 62 | if (arg.empty()) { 63 | return true; 64 | } 65 | *result_listener << "whose size is " << arg.size(); 66 | return false; 67 | } 68 | 69 | // Define a matcher that matches a value that evaluates in boolean 70 | // context to true. Useful for types that define "explicit operator 71 | // bool" operators and so can't be compared for equality with true 72 | // and false. 73 | MATCHER(IsTrue, negation ? "is false" : "is true") { 74 | return static_cast(arg); 75 | } 76 | 77 | // Define a matcher that matches a value that evaluates in boolean 78 | // context to false. Useful for types that define "explicit operator 79 | // bool" operators and so can't be compared for equality with true 80 | // and false. 81 | MATCHER(IsFalse, negation ? "is true" : "is false") { 82 | return !static_cast(arg); 83 | } 84 | 85 | #ifdef _MSC_VER 86 | # pragma warning(pop) 87 | #endif 88 | 89 | 90 | } // namespace testing 91 | 92 | #endif // GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ 93 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/gmock.h: -------------------------------------------------------------------------------- 1 | // Copyright 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This is the main header file a user should include. 34 | 35 | // GOOGLETEST_CM0002 DO NOT DELETE 36 | 37 | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_ 38 | #define GMOCK_INCLUDE_GMOCK_GMOCK_H_ 39 | 40 | // This file implements the following syntax: 41 | // 42 | // ON_CALL(mock_object.Method(...)) 43 | // .With(...) ? 44 | // .WillByDefault(...); 45 | // 46 | // where With() is optional and WillByDefault() must appear exactly 47 | // once. 48 | // 49 | // EXPECT_CALL(mock_object.Method(...)) 50 | // .With(...) ? 51 | // .Times(...) ? 52 | // .InSequence(...) * 53 | // .WillOnce(...) * 54 | // .WillRepeatedly(...) ? 55 | // .RetiresOnSaturation() ? ; 56 | // 57 | // where all clauses are optional and WillOnce() can be repeated. 58 | 59 | #include "gmock/gmock-actions.h" 60 | #include "gmock/gmock-cardinalities.h" 61 | #include "gmock/gmock-function-mocker.h" 62 | #include "gmock/gmock-generated-actions.h" 63 | #include "gmock/gmock-generated-function-mockers.h" 64 | #include "gmock/gmock-generated-matchers.h" 65 | #include "gmock/gmock-matchers.h" 66 | #include "gmock/gmock-more-actions.h" 67 | #include "gmock/gmock-more-matchers.h" 68 | #include "gmock/gmock-nice-strict.h" 69 | #include "gmock/internal/gmock-internal-utils.h" 70 | 71 | namespace testing { 72 | 73 | // Declares Google Mock flags that we want a user to use programmatically. 74 | GMOCK_DECLARE_bool_(catch_leaked_mocks); 75 | GMOCK_DECLARE_string_(verbose); 76 | GMOCK_DECLARE_int32_(default_mock_behavior); 77 | 78 | // Initializes Google Mock. This must be called before running the 79 | // tests. In particular, it parses the command line for the flags 80 | // that Google Mock recognizes. Whenever a Google Mock flag is seen, 81 | // it is removed from argv, and *argc is decremented. 82 | // 83 | // No value is returned. Instead, the Google Mock flag variables are 84 | // updated. 85 | // 86 | // Since Google Test is needed for Google Mock to work, this function 87 | // also initializes Google Test and parses its flags, if that hasn't 88 | // been done. 89 | GTEST_API_ void InitGoogleMock(int* argc, char** argv); 90 | 91 | // This overloaded version can be used in Windows programs compiled in 92 | // UNICODE mode. 93 | GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv); 94 | 95 | // This overloaded version can be used on Arduino/embedded platforms where 96 | // there is no argc/argv. 97 | GTEST_API_ void InitGoogleMock(); 98 | 99 | } // namespace testing 100 | 101 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_ 102 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gmock-port.h` 6 | 7 | The following macros can be defined: 8 | 9 | ### Flag related macros: 10 | 11 | * `GMOCK_DECLARE_bool_(name)` 12 | * `GMOCK_DECLARE_int32_(name)` 13 | * `GMOCK_DECLARE_string_(name)` 14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)` 15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)` 16 | * `GMOCK_DEFINE_string_(name, default_val, doc)` 17 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/internal/custom/gmock-generated-actions.h: -------------------------------------------------------------------------------- 1 | // This file was GENERATED by command: 2 | // pump.py gmock-generated-actions.h.pump 3 | // DO NOT EDIT BY HAND!!! 4 | 5 | // GOOGLETEST_CM0002 DO NOT DELETE 6 | 7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 9 | 10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/internal/custom/gmock-generated-actions.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $$ This is a Pump source file. Please use Pump to convert 3 | $$ it to callback-actions.h. 4 | $$ 5 | $var max_callback_arity = 5 6 | $$}} This meta comment fixes auto-indentation in editors. 7 | 8 | // GOOGLETEST_CM0002 DO NOT DELETE 9 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 10 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | 12 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 13 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/internal/custom/gmock-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // GOOGLETEST_CM0002 DO NOT DELETE 33 | 34 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 35 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 36 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 37 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/internal/custom/gmock-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | // GOOGLETEST_CM0002 DO NOT DELETE 35 | 36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 38 | 39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 40 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gmock/internal/gmock-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Low-level types and utilities for porting Google Mock to various 32 | // platforms. All macros ending with _ and symbols defined in an 33 | // internal namespace are subject to change without notice. Code 34 | // outside Google Mock MUST NOT USE THEM DIRECTLY. Macros that don't 35 | // end with _ are part of Google Mock's public API and can be used by 36 | // code outside Google Mock. 37 | 38 | // GOOGLETEST_CM0002 DO NOT DELETE 39 | 40 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ 41 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | // Most of the utilities needed for porting Google Mock are also 48 | // required for Google Test and are defined in gtest-port.h. 49 | // 50 | // Note to maintainers: to reduce code duplication, prefer adding 51 | // portability utilities to Google Test's gtest-port.h instead of 52 | // here, as Google Mock depends on Google Test. Only add a utility 53 | // here if it's truly specific to Google Mock. 54 | 55 | #include "gtest/internal/gtest-port.h" 56 | #include "gmock/internal/custom/gmock-port.h" 57 | 58 | // For MS Visual C++, check the compiler version. At least VS 2015 is 59 | // required to compile Google Mock. 60 | #if defined(_MSC_VER) && _MSC_VER < 1900 61 | # error "At least Visual C++ 2015 (14.0) is required to compile Google Mock." 62 | #endif 63 | 64 | // Macro for referencing flags. This is public as we want the user to 65 | // use this syntax to reference Google Mock flags. 66 | #define GMOCK_FLAG(name) FLAGS_gmock_##name 67 | 68 | #if !defined(GMOCK_DECLARE_bool_) 69 | 70 | // Macros for declaring flags. 71 | # define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) 72 | # define GMOCK_DECLARE_int32_(name) \ 73 | extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) 74 | # define GMOCK_DECLARE_string_(name) \ 75 | extern GTEST_API_ ::std::string GMOCK_FLAG(name) 76 | 77 | // Macros for defining flags. 78 | # define GMOCK_DEFINE_bool_(name, default_val, doc) \ 79 | GTEST_API_ bool GMOCK_FLAG(name) = (default_val) 80 | # define GMOCK_DEFINE_int32_(name, default_val, doc) \ 81 | GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val) 82 | # define GMOCK_DEFINE_string_(name, default_val, doc) \ 83 | GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) 84 | 85 | #endif // !defined(GMOCK_DECLARE_bool_) 86 | 87 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ 88 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Testing and Mocking Framework definitions useful in production code. 32 | // GOOGLETEST_CM0003 DO NOT DELETE 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void PrivateMethod(); 44 | // FRIEND_TEST(MyClassTest, PrivateMethodWorks); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, PrivateMethodWorks) { 52 | // // Can call MyClass::PrivateMethod() here. 53 | // } 54 | // 55 | // Note: The test class must be in the same namespace as the class being tested. 56 | // For example, putting MyClassTest in an anonymous namespace will not work. 57 | 58 | #define FRIEND_TEST(test_case_name, test_name)\ 59 | friend class test_case_name##_##test_name##_Test 60 | 61 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 62 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Flag related macros: 19 | 20 | * `GTEST_FLAG(flag_name)` 21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its 22 | own flagfile flag parsing. 23 | * `GTEST_DECLARE_bool_(name)` 24 | * `GTEST_DECLARE_int32_(name)` 25 | * `GTEST_DECLARE_string_(name)` 26 | * `GTEST_DEFINE_bool_(name, default_val, doc)` 27 | * `GTEST_DEFINE_int32_(name, default_val, doc)` 28 | * `GTEST_DEFINE_string_(name, default_val, doc)` 29 | 30 | ### Logging: 31 | 32 | * `GTEST_LOG_(severity)` 33 | * `GTEST_CHECK_(condition)` 34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 35 | 36 | ### Threading: 37 | 38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 43 | * `GTEST_LOCK_EXCLUDED_(locks)` 44 | 45 | ### Underlying library support features 46 | 47 | * `GTEST_HAS_CXXABI_H_` 48 | 49 | ### Exporting API symbols: 50 | 51 | * `GTEST_API_` - Specifier for exported symbols. 52 | 53 | ## Header `gtest-printers.h` 54 | 55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 56 | custom printer. 57 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gtest/internal/custom/gtest-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // 35 | // Injection point for custom user configurations. See README for details 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/include/gtest/internal/gtest-port-arch.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // The Google C++ Testing and Mocking Framework (Google Test) 31 | // 32 | // This header file defines the GTEST_OS_* macro. 33 | // It is separate from gtest-port.h so that custom/gtest-port.h can include it. 34 | 35 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ 36 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ 37 | 38 | // Determines the platform on which Google Test is compiled. 39 | #ifdef __CYGWIN__ 40 | # define GTEST_OS_CYGWIN 1 41 | # elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) 42 | # define GTEST_OS_WINDOWS_MINGW 1 43 | # define GTEST_OS_WINDOWS 1 44 | #elif defined _WIN32 45 | # define GTEST_OS_WINDOWS 1 46 | # ifdef _WIN32_WCE 47 | # define GTEST_OS_WINDOWS_MOBILE 1 48 | # elif defined(WINAPI_FAMILY) 49 | # include 50 | # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 51 | # define GTEST_OS_WINDOWS_DESKTOP 1 52 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) 53 | # define GTEST_OS_WINDOWS_PHONE 1 54 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 55 | # define GTEST_OS_WINDOWS_RT 1 56 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE) 57 | # define GTEST_OS_WINDOWS_PHONE 1 58 | # define GTEST_OS_WINDOWS_TV_TITLE 1 59 | # else 60 | // WINAPI_FAMILY defined but no known partition matched. 61 | // Default to desktop. 62 | # define GTEST_OS_WINDOWS_DESKTOP 1 63 | # endif 64 | # else 65 | # define GTEST_OS_WINDOWS_DESKTOP 1 66 | # endif // _WIN32_WCE 67 | #elif defined __OS2__ 68 | # define GTEST_OS_OS2 1 69 | #elif defined __APPLE__ 70 | # define GTEST_OS_MAC 1 71 | # if TARGET_OS_IPHONE 72 | # define GTEST_OS_IOS 1 73 | # endif 74 | #elif defined __DragonFly__ 75 | # define GTEST_OS_DRAGONFLY 1 76 | #elif defined __FreeBSD__ 77 | # define GTEST_OS_FREEBSD 1 78 | #elif defined __Fuchsia__ 79 | # define GTEST_OS_FUCHSIA 1 80 | #elif defined(__GLIBC__) && defined(__FreeBSD_kernel__) 81 | # define GTEST_OS_GNU_KFREEBSD 1 82 | #elif defined __linux__ 83 | # define GTEST_OS_LINUX 1 84 | # if defined __ANDROID__ 85 | # define GTEST_OS_LINUX_ANDROID 1 86 | # endif 87 | #elif defined __MVS__ 88 | # define GTEST_OS_ZOS 1 89 | #elif defined(__sun) && defined(__SVR4) 90 | # define GTEST_OS_SOLARIS 1 91 | #elif defined(_AIX) 92 | # define GTEST_OS_AIX 1 93 | #elif defined(__hpux) 94 | # define GTEST_OS_HPUX 1 95 | #elif defined __native_client__ 96 | # define GTEST_OS_NACL 1 97 | #elif defined __NetBSD__ 98 | # define GTEST_OS_NETBSD 1 99 | #elif defined __OpenBSD__ 100 | # define GTEST_OS_OPENBSD 1 101 | #elif defined __QNX__ 102 | # define GTEST_OS_QNX 1 103 | #endif // __CYGWIN__ 104 | 105 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ 106 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/src/gmock-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Mocking Framework (Google Mock) 32 | // 33 | // This file #includes all Google Mock implementation .cc files. The 34 | // purpose is to allow a user to build Google Mock by compiling this 35 | // file alone. 36 | 37 | // This line ensures that gmock.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gmock/gmock.h" 40 | 41 | // The following lines pull in the real gmock *.cc files. 42 | #include "src/gmock-cardinalities.cc" 43 | #include "src/gmock-internal-utils.cc" 44 | #include "src/gmock-matchers.cc" 45 | #include "src/gmock-spec-builders.cc" 46 | #include "src/gmock.cc" 47 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Testing and Mocking Framework (Google Test) 32 | // 33 | // Sometimes it's desirable to build Google Test by compiling a single file. 34 | // This file serves this purpose. 35 | 36 | // This line ensures that gtest.h can be compiled on its own, even 37 | // when it's fused. 38 | #include "gtest/gtest.h" 39 | 40 | // The following lines pull in the real gtest *.cc files. 41 | #include "src/gtest.cc" 42 | #include "src/gtest-death-test.cc" 43 | #include "src/gtest-filepath.cc" 44 | #include "src/gtest-matchers.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/src/src/gmock_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include 32 | #include "gmock/gmock.h" 33 | #include "gtest/gtest.h" 34 | 35 | #ifdef ARDUINO 36 | void setup() { 37 | // Since Google Mock depends on Google Test, InitGoogleMock() is 38 | // also responsible for initializing Google Test. Therefore there's 39 | // no need for calling testing::InitGoogleTest() separately. 40 | testing::InitGoogleMock(); 41 | } 42 | void loop() { RUN_ALL_TESTS(); } 43 | #else 44 | 45 | // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which 46 | // causes a link error when _tmain is defined in a static library and UNICODE 47 | // is enabled. For this reason instead of _tmain, main function is used on 48 | // Windows. See the following link to track the current status of this bug: 49 | // https://web.archive.org/web/20170912203238/connect.microsoft.com/VisualStudio/feedback/details/394464/wmain-link-error-in-the-static-library 50 | // // NOLINT 51 | #if GTEST_OS_WINDOWS_MOBILE 52 | # include // NOLINT 53 | 54 | GTEST_API_ int _tmain(int argc, TCHAR** argv) { 55 | #else 56 | GTEST_API_ int main(int argc, char** argv) { 57 | #endif // GTEST_OS_WINDOWS_MOBILE 58 | std::cout << "Running main() from gmock_main.cc\n"; 59 | // Since Google Mock depends on Google Test, InitGoogleMock() is 60 | // also responsible for initializing Google Test. Therefore there's 61 | // no need for calling testing::InitGoogleTest() separately. 62 | testing::InitGoogleMock(&argc, argv); 63 | return RUN_ALL_TESTS(); 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /ved/3rdparty/gtest/src/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | #include "gtest/gtest.h" 32 | 33 | #ifdef ARDUINO 34 | void setup() { 35 | testing::InitGoogleTest(); 36 | } 37 | 38 | void loop() { RUN_ALL_TESTS(); } 39 | 40 | #else 41 | 42 | GTEST_API_ int main(int argc, char **argv) { 43 | printf("Running main() from %s\n", __FILE__); 44 | testing::InitGoogleTest(&argc, argv); 45 | return RUN_ALL_TESTS(); 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /ved/3rdparty/kcrt/include/kcrt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _KCRT_CORE_ 4 | static_assert(0, "include not allow"); 5 | #endif 6 | 7 | #ifndef _countof 8 | #define _countof(x) (sizeof(x)/sizeof(x[0])) 9 | #endif 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif // __cplusplus 14 | 15 | int __cdecl _cinit(void); 16 | void __cdecl _cexit(void); 17 | void __cdecl _cinitfs(void); 18 | 19 | typedef void(__cdecl *_PVFV)(void); 20 | typedef int (__cdecl *_PIFV)(void); 21 | 22 | int __cdecl atexit(_PVFV func); 23 | 24 | void __cdecl free(void* ptr); 25 | void* __cdecl malloc(size_t size); // PagedPool 26 | void* __cdecl kmalloc(SIZE_T size, POOL_TYPE PoolType); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif // __cplusplus 31 | -------------------------------------------------------------------------------- /ved/3rdparty/kcrt/lib/x64/kcrt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dumitory-dev/virtual-encrypted-disk/48c508748667912dda93f9b10f2b18d52cd5f74c/ved/3rdparty/kcrt/lib/x64/kcrt.lib -------------------------------------------------------------------------------- /ved/3rdparty/kcrt/lib/x86/kcrt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dumitory-dev/virtual-encrypted-disk/48c508748667912dda93f9b10f2b18d52cd5f74c/ved/3rdparty/kcrt/lib/x86/kcrt.lib -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EABase/earesult.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * earesult.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #ifndef INCLUDED_earesult_H 9 | #define INCLUDED_earesult_H 10 | 11 | 12 | #include 13 | 14 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 15 | #pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */ 16 | #endif 17 | 18 | 19 | 20 | /* This result type is width-compatible with most systems. */ 21 | typedef int32_t ea_result_type; 22 | 23 | 24 | namespace EA 25 | { 26 | typedef int32_t result_type; 27 | 28 | enum 29 | { 30 | #ifndef SUCCESS 31 | // Deprecated 32 | // Note: a public MS header has created a define of this name which causes a build error. Fortunately they 33 | // define it to 0 which is compatible. 34 | // see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h 35 | SUCCESS = 0, 36 | #endif 37 | // Deprecated 38 | FAILURE = -1, 39 | 40 | // These values are now the preferred constants 41 | EA_SUCCESS = 0, 42 | EA_FAILURE = -1, 43 | }; 44 | } 45 | 46 | 47 | /* Macro to simplify testing for success. */ 48 | #ifndef EA_SUCCEEDED 49 | #define EA_SUCCEEDED(result) ((result) >= 0) 50 | #endif 51 | 52 | /* Macro to simplfify testing for general failure. */ 53 | #ifndef EA_FAILED 54 | #define EA_FAILED(result) ((result) < 0) 55 | #endif 56 | 57 | 58 | #endif 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EABase/eastdarg.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * eastdarg.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #ifndef INCLUDED_eastdarg_H 9 | #define INCLUDED_eastdarg_H 10 | 11 | 12 | #include 13 | #include 14 | 15 | 16 | // VA_ARG_COUNT 17 | // 18 | // Returns the number of arguments passed to a macro's ... argument. 19 | // This applies to macros only and not functions. 20 | // 21 | // Example usage: 22 | // assert(VA_ARG_COUNT() == 0); 23 | // assert(VA_ARG_COUNT(a) == 1); 24 | // assert(VA_ARG_COUNT(a, b) == 2); 25 | // assert(VA_ARG_COUNT(a, b, c) == 3); 26 | // 27 | #if !defined(VA_ARG_COUNT) 28 | #define VA_ARG_COUNT(...) VA_ARG_COUNT_II((VA_ARG_COUNT_PREFIX_ ## __VA_ARGS__ ## _VA_ARG_COUNT_POSTFIX,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)) 29 | #define VA_ARG_COUNT_II(__args) VA_ARG_COUNT_I __args 30 | #define VA_ARG_COUNT_PREFIX__VA_ARG_COUNT_POSTFIX ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0 31 | #define VA_ARG_COUNT_I(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,N,...) N 32 | #endif 33 | 34 | 35 | // va_copy 36 | // 37 | // va_copy is required by C++11 38 | // C++11 and C99 require va_copy to be #defined and implemented. 39 | // http://en.cppreference.com/w/cpp/utility/variadic/va_copy 40 | // 41 | // Example usage: 42 | // void Func(char* p, ...){ 43 | // va_list args, argsCopy; 44 | // va_start(args, p); 45 | // va_copy(argsCopy, args); 46 | // (use args) 47 | // (use argsCopy, which acts the same as args) 48 | // va_end(args); 49 | // va_end(argsCopy); 50 | // } 51 | // 52 | #ifndef va_copy 53 | #if defined(__va_copy) // GCC and others define this for non-C99 compatibility. 54 | #define va_copy(dest, src) __va_copy((dest), (src)) 55 | #else 56 | // This may not work for some platforms, depending on their ABI. 57 | // It works for Microsoft x86,x64, and PowerPC-based platforms. 58 | #define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list)) 59 | #endif 60 | #endif 61 | 62 | 63 | 64 | // va_list_reference 65 | // 66 | // va_list_reference is not part of the C or C++ standards. 67 | // It allows you to pass a va_list by reference to another 68 | // function instead of by value. You cannot simply use va_list& 69 | // as that won't work with many va_list implementations because 70 | // they are implemented as arrays (which can't be passed by 71 | // reference to a function without decaying to a pointer). 72 | // 73 | // Example usage: 74 | // void Test(va_list_reference args){ 75 | // printf("%d", va_arg(args, int)); 76 | // } 77 | // void Func(char* p, ...){ 78 | // va_list args; 79 | // va_start(args, p); 80 | // Test(args); // Upon return args will be modified. 81 | // va_end(args); 82 | // } 83 | #ifndef va_list_reference 84 | #if defined(EA_PLATFORM_MICROSOFT) || (EA_PLATFORM_PTR_SIZE == 4) || (defined(EA_PLATFORM_APPLE) && defined(EA_PROCESSOR_ARM64)) || defined(CS_UNDEFINED_STRING) || (defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM64)) 85 | // This is required for platform ABIs in which va_list is a struct or pointer. 86 | #define va_list_reference va_list& 87 | #else 88 | // This is required for platform ABIs in which va_list is defined to be an array. 89 | #define va_list_reference va_list 90 | #endif 91 | #endif 92 | 93 | 94 | 95 | 96 | #endif /* Header include guard */ 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EABase/eaunits.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * eaunits.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #ifndef INCLUDED_eaunits_h 9 | #define INCLUDED_eaunits_h 10 | 11 | #include 12 | 13 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 14 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 15 | #endif 16 | 17 | // Defining common SI unit macros. 18 | // 19 | // The mebibyte is a multiple of the unit byte for digital information. Technically a 20 | // megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two, 21 | // appropriate for binary machines. Many Linux distributions use the unit, but it is 22 | // not widely acknowledged within the industry or media. 23 | // Reference: https://en.wikipedia.org/wiki/Mebibyte 24 | // 25 | // Examples: 26 | // auto size1 = EA_KILOBYTE(16); 27 | // auto size2 = EA_MEGABYTE(128); 28 | // auto size3 = EA_MEBIBYTE(8); 29 | // auto size4 = EA_GIBIBYTE(8); 30 | 31 | // define byte for completeness 32 | #define EA_BYTE(x) (x) 33 | 34 | // Decimal SI units 35 | #define EA_KILOBYTE(x) (size_t(x) * 1000) 36 | #define EA_MEGABYTE(x) (size_t(x) * 1000 * 1000) 37 | #define EA_GIGABYTE(x) (size_t(x) * 1000 * 1000 * 1000) 38 | #define EA_TERABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000) 39 | #define EA_PETABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000) 40 | #define EA_EXABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000) 41 | 42 | // Binary SI units 43 | #define EA_KIBIBYTE(x) (size_t(x) * 1024) 44 | #define EA_MEBIBYTE(x) (size_t(x) * 1024 * 1024) 45 | #define EA_GIBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024) 46 | #define EA_TEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024) 47 | #define EA_PEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024) 48 | #define EA_EXBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024) 49 | 50 | #endif // INCLUDED_earesult_H 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EABase/nullptr.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * nullptr.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #include 9 | #include 10 | 11 | 12 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 13 | #pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */ 14 | #endif 15 | 16 | 17 | #if defined(EA_COMPILER_CPP11_ENABLED) && !defined(EA_COMPILER_NO_NULLPTR) && !defined(EA_HAVE_nullptr_t_IMPL) 18 | // The compiler supports nullptr, but the standard library doesn't implement a declaration for std::nullptr_t. So we provide one. 19 | namespace std { typedef decltype(nullptr) nullptr_t; } 20 | #endif 21 | 22 | 23 | 24 | #if defined(EA_COMPILER_NO_NULLPTR) // If the compiler lacks a native version... 25 | 26 | namespace std 27 | { 28 | class nullptr_t 29 | { 30 | public: 31 | template // When tested a pointer, acts as 0. 32 | operator T*() const 33 | { return 0; } 34 | 35 | template // When tested as a member pointer, acts as 0. 36 | operator T C::*() const 37 | { return 0; } 38 | 39 | typedef void* (nullptr_t::*bool_)() const; 40 | operator bool_() const // An rvalue of type std::nullptr_t can be converted to an rvalue of type bool; the resulting value is false. 41 | { return false; } // We can't use operator bool(){ return false; } because bool is convertable to int which breaks other required functionality. 42 | 43 | // We can't enable this without generating warnings about nullptr being uninitialized after being used when created without "= {}". 44 | //void* mSizeofVoidPtr; // sizeof(nullptr_t) == sizeof(void*). Needs to be public if nullptr_t is to be a POD. 45 | 46 | private: 47 | void operator&() const; // Address cannot be taken. 48 | }; 49 | 50 | inline nullptr_t nullptr_get() 51 | { 52 | nullptr_t n = { }; // std::nullptr exists. 53 | return n; 54 | } 55 | 56 | #if !defined(nullptr) // If somebody hasn't already defined nullptr in a custom way... 57 | #define nullptr nullptr_get() 58 | #endif 59 | 60 | } // namespace std 61 | 62 | 63 | template 64 | inline bool operator==(T* p, const std::nullptr_t) 65 | { return p == 0; } 66 | 67 | template 68 | inline bool operator==(const std::nullptr_t, T* p) 69 | { return p == 0; } 70 | 71 | template 72 | inline bool operator==(T U::* p, const std::nullptr_t) 73 | { return p == 0; } 74 | 75 | template 76 | inline bool operator==(const std::nullptr_t, T U::* p) 77 | { return p == 0; } 78 | 79 | inline bool operator==(const std::nullptr_t, const std::nullptr_t) 80 | { return true; } 81 | 82 | inline bool operator!=(const std::nullptr_t, const std::nullptr_t) 83 | { return false; } 84 | 85 | inline bool operator<(const std::nullptr_t, const std::nullptr_t) 86 | { return false; } 87 | 88 | inline bool operator>(const std::nullptr_t, const std::nullptr_t) 89 | { return false; } 90 | 91 | inline bool operator<=(const std::nullptr_t, const std::nullptr_t) 92 | { return true; } 93 | 94 | inline bool operator>=(const std::nullptr_t, const std::nullptr_t) 95 | { return true; } 96 | 97 | 98 | using std::nullptr_t; // exported to global namespace. 99 | using std::nullptr_get; // exported to global namespace. 100 | 101 | #endif // EA_COMPILER_NO_NULLPTR 102 | 103 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EABase/version.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * version.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | #ifndef INCLUDED_EABASE_VERSION_H 8 | #define INCLUDED_EABASE_VERSION_H 9 | 10 | /////////////////////////////////////////////////////////////////////////////// 11 | // EABASE_VERSION 12 | // 13 | // We more or less follow the conventional EA packaging approach to versioning 14 | // here. A primary distinction here is that minor versions are defined as two 15 | // digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic 16 | // here is that the value is a counter and not a floating point fraction. 17 | // Note that the major version doesn't have leading zeros. 18 | // 19 | // Example version strings: 20 | // "0.91.00" // Major version 0, minor version 91, patch version 0. 21 | // "1.00.00" // Major version 1, minor and patch version 0. 22 | // "3.10.02" // Major version 3, minor version 10, patch version 02. 23 | // "12.03.01" // Major version 12, minor version 03, patch version 24 | // 25 | // Example usage: 26 | // printf("EABASE version: %s", EABASE_VERSION); 27 | // printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100); 28 | // 29 | /////////////////////////////////////////////////////////////////////////////// 30 | 31 | #ifndef EABASE_VERSION 32 | #define EABASE_VERSION "2.08.04" 33 | #define EABASE_VERSION_N 20804 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/allocator_malloc.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ALLOCATOR_MALLOC_H 7 | #define EASTL_ALLOCATOR_MALLOC_H 8 | 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | // EASTL_ALIGNED_MALLOC_AVAILABLE 16 | // 17 | // Identifies if the standard library provides a built-in aligned version of malloc. 18 | // Defined as 0 or 1, depending on the standard library or platform availability. 19 | // None of the viable C functions provides for an aligned malloc with offset, so we 20 | // don't consider that supported in any case. 21 | // 22 | // Options for aligned allocations: 23 | // C11 aligned_alloc http://linux.die.net/man/3/aligned_alloc 24 | // glibc memalign http://linux.die.net/man/3/posix_memalign 25 | // Posix posix_memalign http://pubs.opengroup.org/onlinepubs/000095399/functions/posix_memalign.html 26 | // VC++ _aligned_malloc http://msdn.microsoft.com/en-us/library/8z34s9c6%28VS.80%29.aspx This is not suitable, since it has a limitation that you need to free via _aligned_free. 27 | // 28 | #if !defined EASTL_ALIGNED_MALLOC_AVAILABLE 29 | #if defined(EA_PLATFORM_POSIX) && !defined(EA_PLATFORM_APPLE) 30 | // memalign is more consistently available than posix_memalign, though its location isn't consistent across 31 | // platforms and compiler libraries. Typically it's declared in one of three headers: stdlib.h, malloc.h, or malloc/malloc.h 32 | #include // memalign, posix_memalign. 33 | #define EASTL_ALIGNED_MALLOC_AVAILABLE 1 34 | 35 | #if defined(__clang__) 36 | #if __has_include() 37 | #include 38 | #elif __has_include() 39 | #include 40 | #endif 41 | #elif defined(EA_PLATFORM_BSD) 42 | #include 43 | #else 44 | #include 45 | #endif 46 | #else 47 | #define EASTL_ALIGNED_MALLOC_AVAILABLE 0 48 | #endif 49 | #endif 50 | 51 | 52 | namespace eastl 53 | { 54 | 55 | /////////////////////////////////////////////////////////////////////////////// 56 | // allocator_malloc 57 | // 58 | // Implements an EASTL allocator that uses malloc/free as opposed to 59 | // new/delete or PPMalloc Malloc/Free. 60 | // 61 | // Example usage: 62 | // vector intVector; 63 | // 64 | class allocator_malloc 65 | { 66 | public: 67 | allocator_malloc(const char* = NULL) 68 | { } 69 | 70 | allocator_malloc(const allocator_malloc&) 71 | { } 72 | 73 | allocator_malloc(const allocator_malloc&, const char*) 74 | { } 75 | 76 | allocator_malloc& operator=(const allocator_malloc&) 77 | { return *this; } 78 | 79 | bool operator==(const allocator_malloc&) 80 | { return true; } 81 | 82 | bool operator!=(const allocator_malloc&) 83 | { return false; } 84 | 85 | void* allocate(size_t n, int /*flags*/ = 0) 86 | { return malloc(n); } 87 | 88 | void* allocate(size_t n, size_t alignment, size_t alignmentOffset, int /*flags*/ = 0) 89 | { 90 | #if EASTL_ALIGNED_MALLOC_AVAILABLE 91 | if((alignmentOffset % alignment) == 0) // We check for (offset % alignmnent == 0) instead of (offset == 0) because any block which is aligned on e.g. 64 also is aligned at an offset of 64 by definition. 92 | return memalign(alignment, n); // memalign is more consistently available than posix_memalign. 93 | #else 94 | if((alignment <= EASTL_SYSTEM_ALLOCATOR_MIN_ALIGNMENT) && ((alignmentOffset % alignment) == 0)) 95 | return malloc(n); 96 | #endif 97 | return NULL; 98 | } 99 | 100 | void deallocate(void* p, size_t /*n*/) 101 | { free(p); } 102 | 103 | const char* get_name() const 104 | { return "allocator_malloc"; } 105 | 106 | void set_name(const char*) 107 | { } 108 | }; 109 | 110 | 111 | } // namespace eastl 112 | 113 | 114 | 115 | #endif // Header include guard 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/bonus/adaptors.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | /////////////////////////////////////////////////////////////////////////////// 6 | /////////////////////////////////////////////////////////////////////////////// 7 | 8 | 9 | #ifndef EASTL_ADAPTORS_H 10 | #define EASTL_ADAPTORS_H 11 | 12 | 13 | #include 14 | #include 15 | 16 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 17 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 18 | #endif 19 | 20 | EA_DISABLE_VC_WARNING(4512 4626) 21 | #if defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+ 22 | EA_DISABLE_VC_WARNING(5027) // move assignment operator was implicitly defined as deleted 23 | #endif 24 | 25 | 26 | namespace eastl 27 | { 28 | /// reverse 29 | /// 30 | /// This adaptor allows reverse iteration of a container in ranged base for-loops. 31 | /// 32 | /// for (auto& i : reverse(c)) { ... } 33 | /// 34 | template 35 | struct reverse_wrapper 36 | { 37 | reverse_wrapper(Container& c) : mContainer(c) {} 38 | Container& mContainer; 39 | }; 40 | 41 | template 42 | auto begin(const reverse_wrapper& w) -> decltype(rbegin(w.mContainer)) 43 | { return rbegin(w.mContainer); } 44 | 45 | template 46 | auto end(const reverse_wrapper& w) -> decltype(rend(w.mContainer)) 47 | { return rend(w.mContainer); } 48 | 49 | template 50 | reverse_wrapper reverse(Container&& c) 51 | { return reverse_wrapper(eastl::forward(c)); } 52 | 53 | } // namespace eastl 54 | 55 | #if defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+ 56 | EA_RESTORE_VC_WARNING() 57 | #endif 58 | EA_RESTORE_VC_WARNING() 59 | 60 | #endif // Header include guard 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/bonus/call_traits.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | /////////////////////////////////////////////////////////////////////////////// 6 | // The design for call_traits here is very similar to that found in template 7 | // metaprogramming libraries such as Boost, GCC, and Metrowerks, given that 8 | // these libraries have established this interface as a defacto standard for 9 | // solving this problem. Also, these are described in various books on the 10 | // topic of template metaprogramming, such as "Modern C++ Design". 11 | // 12 | // See http://www.boost.org/libs/utility/call_traits.htm or search for 13 | // call_traits in Google for a description of call_traits. 14 | /////////////////////////////////////////////////////////////////////////////// 15 | 16 | 17 | #ifndef EASTL_CALL_TRAITS_H 18 | #define EASTL_CALL_TRAITS_H 19 | 20 | 21 | #include 22 | #include 23 | 24 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 25 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 26 | #endif 27 | 28 | 29 | 30 | namespace eastl 31 | { 32 | 33 | 34 | template 35 | struct ct_imp2 { typedef const T& param_type; }; 36 | 37 | template 38 | struct ct_imp2 { typedef const T param_type; }; 39 | 40 | template 41 | struct ct_imp { typedef const T& param_type; }; 42 | 43 | template 44 | struct ct_imp { typedef typename ct_imp2::param_type param_type; }; 45 | 46 | template 47 | struct ct_imp { typedef T const param_type; }; 48 | 49 | 50 | 51 | template 52 | struct call_traits 53 | { 54 | public: 55 | typedef T value_type; 56 | typedef T& reference; 57 | typedef const T& const_reference; 58 | typedef typename ct_imp::value, is_arithmetic::value>::param_type param_type; 59 | }; 60 | 61 | 62 | template 63 | struct call_traits 64 | { 65 | typedef T& value_type; 66 | typedef T& reference; 67 | typedef const T& const_reference; 68 | typedef T& param_type; 69 | }; 70 | 71 | 72 | template 73 | struct call_traits 74 | { 75 | private: 76 | typedef T array_type[N]; 77 | 78 | public: 79 | typedef const T* value_type; 80 | typedef array_type& reference; 81 | typedef const array_type& const_reference; 82 | typedef const T* const param_type; 83 | }; 84 | 85 | 86 | template 87 | struct call_traits 88 | { 89 | private: 90 | typedef const T array_type[N]; 91 | 92 | public: 93 | typedef const T* value_type; 94 | typedef array_type& reference; 95 | typedef const array_type& const_reference; 96 | typedef const T* const param_type; 97 | }; 98 | 99 | 100 | } // namespace eastl 101 | 102 | 103 | #endif // Header include guard 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/bonus/fixed_ring_buffer.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_FIXED_RING_BUFFER_H 6 | #define EASTL_FIXED_RING_BUFFER_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 13 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 14 | #endif 15 | 16 | namespace eastl 17 | { 18 | 19 | /// fixed_ring_buffer 20 | /// 21 | /// This is a convenience template alias for creating a fixed-sized 22 | /// ring_buffer using eastl::fixed_vector as its storage container. This has 23 | /// been tricky for users to get correct due to the constructor requirements 24 | /// of eastl::ring_buffer leaking the implementation detail of the sentinel 25 | /// value being used internally. In addition, it was not obvious what the 26 | /// correct allocator_type template parameter should be used for containers 27 | /// providing both a default allocator type and an overflow allocator type. 28 | /// 29 | /// We are over-allocating the fixed_vector container to accommodate the 30 | /// ring_buffer sentinel to prevent that implementation detail leaking into 31 | /// user code. 32 | /// 33 | /// Example usage: 34 | /// 35 | /// fixed_ring_buffer rb = {0, 1, 2, 3, 4, 5, 6, 7}; 36 | /// or 37 | /// fixed_ring_buffer rb(8); // capacity doesn't need to respect sentinel 38 | /// rb.push_back(0); 39 | /// 40 | /// 41 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 42 | template 43 | using fixed_ring_buffer = 44 | ring_buffer, typename fixed_vector::overflow_allocator_type>; 45 | #endif 46 | 47 | } // namespace eastl 48 | 49 | #endif // Header include guard 50 | 51 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/core_allocator.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_CORE_ALLOCATOR_H 6 | #define EASTL_CORE_ALLOCATOR_H 7 | 8 | #if EASTL_CORE_ALLOCATOR_ENABLED 9 | 10 | #include 11 | 12 | namespace EA 13 | { 14 | namespace Allocator 15 | { 16 | /// EASTLCoreAllocatorImpl 17 | /// 18 | /// EASTL provides an out of the box implementation of the 19 | /// ICoreAllocator interface. This is provided as a convenience for 20 | /// users who wish to provide ICoreAllocator implementations for EASTL to use. 21 | /// 22 | /// EASTL has a dependency on coreallocator so to provide an out of 23 | /// the box implementation for EASTLCoreAlloctor and EASTLCoreDeleter 24 | /// that can be used and tested. Historically we could not test 25 | /// ICoreAllocator interface because we relied on the code being linked 26 | /// in user code. 27 | /// 28 | 29 | class EASTLCoreAllocatorImpl : public ICoreAllocator 30 | { 31 | public: 32 | virtual void* Alloc(size_t size, const char* name, unsigned int flags) 33 | { 34 | return ::operator new[](size, name, flags, 0, __FILE__, __LINE__); 35 | } 36 | 37 | virtual void* Alloc(size_t size, const char* name, unsigned int flags, unsigned int alignment, unsigned int alignOffset = 0) 38 | { 39 | return ::operator new[](size, alignment, alignOffset, name, flags, 0, __FILE__, __LINE__); 40 | } 41 | 42 | virtual void Free(void* ptr, size_t size = 0) 43 | { 44 | ::operator delete(static_cast(ptr)); 45 | } 46 | 47 | virtual void* AllocDebug(size_t size, const DebugParams debugParams, unsigned int flags) 48 | { 49 | return Alloc(size, debugParams.mName, flags); 50 | } 51 | 52 | virtual void* AllocDebug(size_t size, const DebugParams debugParams, unsigned int flags, unsigned int align, unsigned int alignOffset = 0) 53 | { 54 | return Alloc(size, debugParams.mName, flags, align, alignOffset); 55 | } 56 | 57 | static EASTLCoreAllocatorImpl* GetDefaultAllocator(); 58 | }; 59 | 60 | inline EASTLCoreAllocatorImpl* EASTLCoreAllocatorImpl::GetDefaultAllocator() 61 | { 62 | static EASTLCoreAllocatorImpl allocator; 63 | return &allocator; 64 | } 65 | } 66 | } 67 | 68 | #endif // EASTL_CORE_ALLOCATOR_ENABLED 69 | #endif // EASTL_CORE_ALLOCATOR_H 70 | 71 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/allocator_traits_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_ALLOCATOR_TRAITS_H 7 | #define EASTL_INTERNAL_ALLOCATOR_TRAITS_H 8 | 9 | 10 | #include 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace eastl 19 | { 20 | template 21 | struct allocator_traits; 22 | 23 | } // namespace eastl 24 | 25 | #endif // Header include guard 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/enable_shared.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_ENABLE_SHARED_H 7 | #define EASTL_INTERNAL_ENABLE_SHARED_H 8 | 9 | 10 | #include 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | 18 | /// enable_shared_from_this 19 | /// 20 | /// This is a helper mixin class that allows you to make any class 21 | /// export a shared_ptr instance that is associated with the class 22 | /// instance. Any class that inherits from this class gets two functions: 23 | /// shared_ptr shared_from_this(); 24 | /// shared_ptr shared_from_this() const; 25 | /// If you call shared_from_this, you get back a shared_ptr that 26 | /// refers to the class. A second call to shared_from_this returns 27 | /// another shared_ptr that is shared with the first one. 28 | /// 29 | /// The trick that happens which is not so obvious here (and which is 30 | /// not mentioned at all in the Boost documentation of their version 31 | /// of this) is that the shared_ptr constructor detects that the 32 | /// class has an enable_shared_from_this mixin and sets up this system 33 | /// automatically for the user. This is done with template tricks. 34 | /// 35 | /// For some additional explanation, see the Boost documentation for 36 | /// their description of their version of enable_shared_from_this. 37 | /// 38 | template 39 | class enable_shared_from_this 40 | { 41 | public: 42 | shared_ptr shared_from_this() 43 | { return shared_ptr(mWeakPtr); } 44 | 45 | shared_ptr shared_from_this() const 46 | { return shared_ptr(mWeakPtr); } 47 | 48 | public: // This is public because the alternative fails on some compilers that we need to support. 49 | mutable weak_ptr mWeakPtr; 50 | 51 | protected: 52 | template friend class shared_ptr; 53 | 54 | EA_CONSTEXPR enable_shared_from_this() EA_NOEXCEPT 55 | { } 56 | 57 | enable_shared_from_this(const enable_shared_from_this&) EA_NOEXCEPT 58 | { } 59 | 60 | enable_shared_from_this& operator=(const enable_shared_from_this&) EA_NOEXCEPT 61 | { return *this; } 62 | 63 | ~enable_shared_from_this() 64 | { } 65 | 66 | }; // enable_shared_from_this 67 | 68 | } // namespace eastl 69 | 70 | 71 | #endif // Header include guard 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/function_help.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTERNAL_FUNCTION_HELP_H 6 | #define EASTL_INTERNAL_FUNCTION_HELP_H 7 | 8 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 9 | #pragma once 10 | #endif 11 | 12 | #include 13 | 14 | namespace eastl 15 | { 16 | template 17 | class function; 18 | 19 | namespace internal 20 | { 21 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 22 | // to_functor 23 | // 24 | template 25 | T to_functor(T&& func) 26 | { 27 | return EASTL_FORWARD(T, func); 28 | } 29 | 30 | template 31 | auto to_functor(Result (Class::*func)(Arguments...)) -> decltype(eastl::mem_fn(func)) 32 | { 33 | return eastl::mem_fn(func); 34 | } 35 | 36 | template 37 | auto to_functor(Result (Class::*func)(Arguments...) const) -> decltype(eastl::mem_fn(func)) 38 | { 39 | return eastl::mem_fn(func); 40 | } 41 | 42 | 43 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 44 | // is_null 45 | // 46 | template 47 | bool is_null(const T&) 48 | { 49 | return false; 50 | } 51 | 52 | template 53 | bool is_null(Result (*const& function_pointer)(Arguments...)) 54 | { 55 | return function_pointer == nullptr; 56 | } 57 | 58 | template 59 | bool is_null(Result (Class::*const& function_pointer)(Arguments...)) 60 | { 61 | return function_pointer == nullptr; 62 | } 63 | 64 | template 65 | bool is_null(Result (Class::*const& function_pointer)(Arguments...) const) 66 | { 67 | return function_pointer == nullptr; 68 | } 69 | 70 | 71 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 72 | // is_valid_function_argument 73 | // 74 | template 75 | struct is_valid_function_argument 76 | { 77 | static const bool value = false; 78 | }; 79 | 80 | template 81 | struct is_valid_function_argument, Result(Arguments...)> 82 | { 83 | static const bool value = false; 84 | }; 85 | 86 | template 87 | struct is_valid_function_argument 88 | { 89 | struct local_empty_struct {}; // a type that no user function will use as a return type 90 | 91 | template 92 | static decltype(to_functor(eastl::declval())(eastl::declval()...)) local_check(U*); 93 | 94 | template 95 | static local_empty_struct local_check(...); 96 | 97 | static const bool value = eastl::is_convertible(0)), Result>::value; 98 | }; 99 | } // namespace internal 100 | } // namespace eastl 101 | 102 | #endif // Header include guard 103 | 104 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/in_place_t.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_IN_PLACE_T_H 7 | #define EASTL_INTERNAL_IN_PLACE_T_H 8 | 9 | 10 | #include 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | namespace Internal 18 | { 19 | struct in_place_tag {}; 20 | template struct in_place_type_tag {}; 21 | template struct in_place_index_tag {}; 22 | } 23 | 24 | /////////////////////////////////////////////////////////////////////////////// 25 | /// in_place_tag 26 | /// 27 | /// http://en.cppreference.com/w/cpp/utility/in_place_tag 28 | /// 29 | struct in_place_tag 30 | { 31 | in_place_tag() = delete; 32 | 33 | private: 34 | explicit in_place_tag(Internal::in_place_tag) {} 35 | friend inline in_place_tag Internal_ConstructInPlaceTag(); 36 | }; 37 | 38 | // internal factory function for in_place_tag 39 | inline in_place_tag Internal_ConstructInPlaceTag() { return in_place_tag(Internal::in_place_tag{}); } 40 | 41 | 42 | /////////////////////////////////////////////////////////////////////////////// 43 | /// in_place_t / in_place_type_t / in_place_index_t 44 | /// 45 | /// used to disambiguate overloads that take arguments (possibly a parameter 46 | /// pack) for in-place construction of some value. 47 | /// 48 | /// http://en.cppreference.com/w/cpp/utility/optional/in_place_t 49 | /// 50 | using in_place_t = in_place_tag(&)(Internal::in_place_tag); 51 | 52 | template 53 | using in_place_type_t = in_place_tag(&)(Internal::in_place_type_tag); 54 | 55 | template 56 | using in_place_index_t = in_place_tag(&)(Internal::in_place_index_tag); 57 | 58 | 59 | /////////////////////////////////////////////////////////////////////////////// 60 | /// in_place / in_place / in_place 61 | /// 62 | /// http://en.cppreference.com/w/cpp/utility/in_place 63 | /// 64 | inline in_place_tag in_place(Internal::in_place_tag) { return Internal_ConstructInPlaceTag(); } 65 | 66 | template 67 | inline in_place_tag in_place(Internal::in_place_type_tag) { return Internal_ConstructInPlaceTag(); } 68 | 69 | template 70 | inline in_place_tag in_place(Internal::in_place_index_tag) { return Internal_ConstructInPlaceTag(); } 71 | 72 | 73 | } // namespace eastl 74 | 75 | 76 | #endif // Header include guard 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/integer_sequence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTEGER_SEQUENCE_H 6 | #define EASTL_INTEGER_SEQUENCE_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace eastl 13 | { 14 | 15 | #if EASTL_VARIADIC_TEMPLATES_ENABLED && !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 16 | 17 | // integer_sequence 18 | template 19 | class integer_sequence 20 | { 21 | public: 22 | typedef T value_type; 23 | static_assert(is_integral::value, "eastl::integer_sequence can only be instantiated with an integral type"); 24 | static EA_CONSTEXPR size_t size() EA_NOEXCEPT { return sizeof...(Ints); } 25 | }; 26 | 27 | template 28 | struct make_index_sequence_impl; 29 | 30 | template 31 | struct make_index_sequence_impl> 32 | { 33 | typedef typename make_index_sequence_impl>::type type; 34 | }; 35 | 36 | template 37 | struct make_index_sequence_impl<0, integer_sequence> 38 | { 39 | typedef integer_sequence type; 40 | }; 41 | 42 | template 43 | using index_sequence = integer_sequence; 44 | 45 | template 46 | using make_index_sequence = typename make_index_sequence_impl>::type; 47 | 48 | template 49 | struct integer_sequence_convert_impl; 50 | 51 | template 52 | struct integer_sequence_convert_impl> 53 | { 54 | typedef integer_sequence type; 55 | }; 56 | 57 | template 58 | struct make_integer_sequence_impl 59 | { 60 | typedef typename integer_sequence_convert_impl>::type type; 61 | }; 62 | 63 | template 64 | using make_integer_sequence = typename make_integer_sequence_impl::type; 65 | 66 | // Helper alias template that converts any type parameter pack into an index sequence of the same length 67 | template 68 | using index_sequence_for = make_index_sequence; 69 | 70 | #endif // EASTL_VARIADIC_TEMPLATES_ENABLED 71 | 72 | } // namespace eastl 73 | 74 | #endif // EASTL_INTEGER_SEQUENCE_H 75 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/memory_base.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTERNAL_MEMORY_BASE_H 6 | #define EASTL_INTERNAL_MEMORY_BASE_H 7 | 8 | #include 9 | 10 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 11 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 12 | #endif 13 | 14 | 15 | //////////////////////////////////////////////////////////////////////////////////////////// 16 | // This file contains basic functionality found in the standard library 'memory' header that 17 | // have limited or no dependencies. This allows us to utilize these utilize these functions 18 | // in other EASTL code while avoid circular dependencies. 19 | //////////////////////////////////////////////////////////////////////////////////////////// 20 | 21 | namespace eastl 22 | { 23 | /// addressof 24 | /// 25 | /// From the C++11 Standard, section 20.6.12.1 26 | /// Returns the actual address of the object or function referenced by r, even in the presence of an overloaded operator&. 27 | /// 28 | template 29 | T* addressof(T& value) EA_NOEXCEPT 30 | { 31 | return reinterpret_cast(&const_cast(reinterpret_cast(value))); 32 | } 33 | 34 | } // namespace eastl 35 | 36 | #endif // EASTL_INTERNAL_MEMORY_BASE_H 37 | 38 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/pair_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_PAIR_FWD_DECLS_H 6 | #define EASTL_PAIR_FWD_DECLS_H 7 | 8 | #include 9 | 10 | namespace eastl 11 | { 12 | template 13 | struct pair; 14 | } 15 | 16 | #endif // EASTL_PAIR_FWD_DECLS_H 17 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/piecewise_construct_t.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_PIECEWISE_CONSTRUCT_T_H 7 | #define EASTL_INTERNAL_PIECEWISE_CONSTRUCT_T_H 8 | 9 | 10 | #include 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | /////////////////////////////////////////////////////////////////////////////// 18 | /// piecewise_construct_t 19 | /// 20 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct_t 21 | /// 22 | struct piecewise_construct_t 23 | { 24 | explicit piecewise_construct_t() = default; 25 | }; 26 | 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | /// piecewise_construct 30 | /// 31 | /// A tag type used to disambiguate between function overloads that take two tuple arguments. 32 | /// 33 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct 34 | /// 35 | EA_CONSTEXPR piecewise_construct_t piecewise_construct = eastl::piecewise_construct_t(); 36 | 37 | } // namespace eastl 38 | 39 | 40 | #endif // Header include guard 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/internal/tuple_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_TUPLE_FWD_DECLS_H 6 | #define EASTL_TUPLE_FWD_DECLS_H 7 | 8 | #include 9 | 10 | #if EASTL_TUPLE_ENABLED 11 | 12 | namespace eastl 13 | { 14 | template 15 | class tuple; 16 | 17 | template 18 | class tuple_size; 19 | 20 | template 21 | class tuple_element; 22 | 23 | template 24 | using tuple_element_t = typename tuple_element::type; 25 | 26 | // const typename for tuple_element_t, for when tuple or TupleImpl cannot itself be const 27 | template 28 | using const_tuple_element_t = typename conditional< 29 | is_lvalue_reference>::value, 30 | add_lvalue_reference_t>>, 31 | const tuple_element_t 32 | >::type; 33 | 34 | // get 35 | template 36 | tuple_element_t>& get(tuple& t); 37 | 38 | template 39 | const_tuple_element_t>& get(const tuple& t); 40 | 41 | template 42 | tuple_element_t>&& get(tuple&& t); 43 | 44 | template 45 | T& get(tuple& t); 46 | 47 | template 48 | const T& get(const tuple& t); 49 | 50 | template 51 | T&& get(tuple&& t); 52 | } 53 | 54 | #endif // EASTL_VARIADIC_TEMPLATES_ENABLED 55 | 56 | #endif // EASTL_TUPLE_FWD_DECLS_H 57 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/intrusive_hash_map.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTRUSIVE_HASH_MAP_H 6 | #define EASTL_INTRUSIVE_HASH_MAP_H 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 15 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 16 | #endif 17 | 18 | 19 | 20 | namespace eastl 21 | { 22 | 23 | /// intrusive_hash_map 24 | /// 25 | /// Template parameters: 26 | /// Key The key object (key in the key/value pair). T must contain a member of type Key named mKey. 27 | /// T The type of object the map holds (a.k.a. value). 28 | /// bucketCount The number of buckets to use. Best if it's a prime number. 29 | /// Hash Hash function. See functional.h for examples of hash functions. 30 | /// Equal Equality testing predicate; tells if two elements are equal. 31 | /// 32 | template , typename Equal = eastl::equal_to > 33 | class intrusive_hash_map : public intrusive_hashtable 34 | { 35 | public: 36 | typedef intrusive_hashtable base_type; 37 | typedef intrusive_hash_map this_type; 38 | 39 | public: 40 | explicit intrusive_hash_map(const Hash& h = Hash(), const Equal& eq = Equal()) 41 | : base_type(h, eq) 42 | { 43 | // Empty 44 | } 45 | 46 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea? 47 | //intrusive_hash_map(std::initializer_list ilist); 48 | 49 | }; // intrusive_hash_map 50 | 51 | 52 | 53 | 54 | /// intrusive_hash_multimap 55 | /// 56 | /// Implements a intrusive_hash_multimap, which is the same thing as a intrusive_hash_map 57 | /// except that contained elements need not be unique. See the documentation 58 | /// for intrusive_hash_map for details. 59 | /// 60 | /// Template parameters: 61 | /// Key The key object (key in the key/value pair). T must contain a member of type Key named mKey. 62 | /// T The type of object the map holds (a.k.a. value). 63 | /// bucketCount The number of buckets to use. Best if it's a prime number. 64 | /// Hash Hash function. See functional.h for examples of hash functions. 65 | /// Equal Equality testing predicate; tells if two elements are equal. 66 | /// 67 | template , typename Equal = eastl::equal_to > 68 | class intrusive_hash_multimap : public intrusive_hashtable 69 | { 70 | public: 71 | typedef intrusive_hashtable base_type; 72 | typedef intrusive_hash_multimap this_type; 73 | 74 | public: 75 | explicit intrusive_hash_multimap(const Hash& h = Hash(), const Equal& eq = Equal()) 76 | : base_type(h, eq) 77 | { 78 | // Empty 79 | } 80 | 81 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea? 82 | //intrusive_hash_multimap(std::initializer_list ilist); 83 | 84 | }; // intrusive_hash_multimap 85 | 86 | 87 | 88 | 89 | } // namespace eastl 90 | 91 | 92 | #endif // Header include guard 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/intrusive_hash_set.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTRUSIVE_HASH_SET_H 6 | #define EASTL_INTRUSIVE_HASH_SET_H 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 15 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 16 | #endif 17 | 18 | 19 | 20 | namespace eastl 21 | { 22 | 23 | /// intrusive_hash_set 24 | /// 25 | /// Template parameters: 26 | /// T The type of object the set holds (a.k.a. value). 27 | /// bucketCount The number of buckets to use. Best if it's a prime number. 28 | /// Hash Hash function. See functional.h for examples of hash functions. 29 | /// Equal Equality testing predicate; tells if two elements are equal. 30 | /// 31 | template , typename Equal = eastl::equal_to > 32 | class intrusive_hash_set : public intrusive_hashtable 33 | { 34 | public: 35 | typedef intrusive_hashtable base_type; 36 | typedef intrusive_hash_set this_type; 37 | 38 | public: 39 | explicit intrusive_hash_set(const Hash& h = Hash(), const Equal& eq = Equal()) 40 | : base_type(h, eq) 41 | { 42 | // Empty 43 | } 44 | 45 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea? 46 | //intrusive_hash_set(std::initializer_list ilist); 47 | 48 | }; // intrusive_hash_set 49 | 50 | 51 | 52 | 53 | /// intrusive_hash_multiset 54 | /// 55 | /// Implements a intrusive_hash_multiset, which is the same thing as a intrusive_hash_set 56 | /// except that contained elements need not be unique. See the documentation 57 | /// for intrusive_hash_set for details. 58 | /// 59 | /// Template parameters: 60 | /// T The type of object the set holds (a.k.a. value). 61 | /// bucketCount The number of buckets to use. Best if it's a prime number. 62 | /// Hash Hash function. See functional.h for examples of hash functions. 63 | /// Equal Equality testing predicate; tells if two elements are equal. 64 | /// 65 | template , typename Equal = eastl::equal_to > 66 | class intrusive_hash_multiset : public intrusive_hashtable 67 | { 68 | public: 69 | typedef intrusive_hashtable base_type; 70 | typedef intrusive_hash_multiset this_type; 71 | 72 | public: 73 | explicit intrusive_hash_multiset(const Hash& h = Hash(), const Equal& eq = Equal()) 74 | : base_type(h, eq) 75 | { 76 | // Empty 77 | } 78 | 79 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea? 80 | //intrusive_hash_multiset(std::initializer_list ilist); 81 | 82 | }; // intrusive_hash_multiset 83 | 84 | 85 | } // namespace eastl 86 | 87 | 88 | #endif // Header include guard 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/unordered_map.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_UNORDERED_MAP_H 6 | #define EASTL_UNORDERED_MAP_H 7 | 8 | #include 9 | #include 10 | 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | /// unordered_map 18 | /// 19 | /// The original TR1 (technical report 1) used "hash_map" to name a hash 20 | /// table backed associative container of unique key-value pairs. When the 21 | /// container was added to the C++11 standard the committee chose the name 22 | /// "unordered_map" to clarify that internally the elements are NOT sorted in 23 | /// any particular order. We provide a template alias here to ensure feature 24 | /// parity with the original eastl::hash_map. 25 | /// 26 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 27 | template , 30 | typename Predicate = eastl::equal_to, 31 | typename Allocator = EASTLAllocatorType, 32 | bool bCacheHashCode = false> 33 | using unordered_map = hash_map; 34 | #endif 35 | 36 | /// unordered_multimap 37 | /// 38 | /// Similar template alias as "unordered_map" except the contained elements 39 | /// need not be unique. See "hash_multimap" for more details. 40 | /// 41 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 42 | template , 45 | typename Predicate = eastl::equal_to, 46 | typename Allocator = EASTLAllocatorType, 47 | bool bCacheHashCode = false> 48 | using unordered_multimap = hash_multimap; 49 | #endif 50 | 51 | } // namespace eastl 52 | 53 | #endif // Header include guard 54 | 55 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/unordered_set.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_UNORDERED_SET_H 6 | #define EASTL_UNORDERED_SET_H 7 | 8 | #include 9 | #include 10 | 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | 18 | /// unordered_set 19 | /// 20 | /// The original TR1 (technical report 1) used "hash_set" to name a hash 21 | /// table backed associative container of unique "Key" type objects. When 22 | /// the container was added to the C++11 standard the committee chose the 23 | /// name "unordered_set" to clarify that internally the elements are NOT 24 | /// sorted in any particular order. We provide a template alias here to 25 | /// ensure feature parity with the original eastl::hash_set. 26 | /// 27 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 28 | template , 30 | typename Predicate = eastl::equal_to, 31 | typename Allocator = EASTLAllocatorType, 32 | bool bCacheHashCode = false> 33 | using unordered_set = hash_set; 34 | #endif 35 | 36 | /// unordered_multiset 37 | /// 38 | /// Similar template alias as "unordered_set" except the contained elements 39 | /// need not be unique. See "hash_multiset" for more details. 40 | /// 41 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 42 | template , 44 | typename Predicate = eastl::equal_to, 45 | typename Allocator = EASTLAllocatorType, 46 | bool bCacheHashCode = false> 47 | using unordered_multiset = hash_multiset; 48 | #endif 49 | 50 | } // namespace eastl 51 | 52 | #endif // Header include guard 53 | 54 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/version.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_VERSION_H 6 | #define EASTL_VERSION_H 7 | 8 | #include 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/include/EASTL/weak_ptr.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_WEAK_PTR_H 7 | #define EASTL_WEAK_PTR_H 8 | 9 | 10 | // This header file is deprecated. The implementation has moved: 11 | #include 12 | 13 | 14 | #endif 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ved/3rdparty/kstl/lib/x64/kstl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dumitory-dev/virtual-encrypted-disk/48c508748667912dda93f9b10f2b18d52cd5f74c/ved/3rdparty/kstl/lib/x64/kstl.lib -------------------------------------------------------------------------------- /ved/3rdparty/kstl/lib/x86/kstl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dumitory-dev/virtual-encrypted-disk/48c508748667912dda93f9b10f2b18d52cd5f74c/ved/3rdparty/kstl/lib/x86/kstl.lib -------------------------------------------------------------------------------- /ved/Driver/Driver.inf: -------------------------------------------------------------------------------- 1 | ; 2 | ; Driver.inf 3 | ; 4 | 5 | [Version] 6 | Signature="$WINDOWS NT$" 7 | Class=System 8 | ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} 9 | Provider=%ManufacturerName% 10 | DriverVer= 11 | CatalogFile=Driver.cat 12 | 13 | [DestinationDirs] 14 | DefaultDestDir = 12 15 | 16 | 17 | [SourceDisksNames] 18 | 1 = %DiskName%,,,"" 19 | 20 | [SourceDisksFiles] 21 | 22 | 23 | [Manufacturer] 24 | %ManufacturerName%=Standard,NT$ARCH$ 25 | 26 | [Standard.NT$ARCH$] 27 | 28 | 29 | [Strings] 30 | ManufacturerName="" ;TODO: Replace with your manufacturer name 31 | ClassName="" 32 | DiskName="Driver Source Disk" 33 | -------------------------------------------------------------------------------- /ved/Driver/Driver.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4cddcf0d-2aff-46c7-94a1-93c2974e090a} 6 | 7 | 8 | {6c57b75a-e8b0-466c-8f0d-766565293e96} 9 | 10 | 11 | {3a5f280e-dbc0-47b4-8916-f89d1c250799} 12 | 13 | 14 | 15 | 16 | utils 17 | 18 | 19 | source 20 | 21 | 22 | source 23 | 24 | 25 | 26 | 27 | headers 28 | 29 | 30 | headers 31 | 32 | 33 | headers 34 | 35 | 36 | headers 37 | 38 | 39 | headers 40 | 41 | 42 | headers 43 | 44 | 45 | headers 46 | 47 | 48 | utils 49 | 50 | 51 | -------------------------------------------------------------------------------- /ved/Driver/headers/codeioctl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | //#define IOCTL_FILE_DISK_OPEN_FILE CTL_CODE(FILE_DEVICE_DISK, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 5 | //#define IOCTL_FILE_DISK_CLOSE_FILE CTL_CODE(FILE_DEVICE_DISK, 0x801, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 6 | //#define IOCTL_FILE_ADD_DEVICE CTL_CODE(FILE_DEVICE_DISK, 0x802, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 7 | //#define IOCTL_GET_FREE_DEVICE CTL_CODE(FILE_DEVICE_DISK, 0x803, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 8 | //#define IOCTL_GET_MOUNT_DEVICES CTL_CODE(FILE_DEVICE_DISK, 0x804, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -------------------------------------------------------------------------------- /ved/Driver/headers/constants.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "libraries.h" 3 | 4 | #define SECTOR_SIZE 2048 5 | #define WIN9X_COMPAT_SPINLOCK 6 | #define FILE_DISK_POOL_TAG 'ksiD' 7 | #define PASSWORD_OFFSET 512 8 | #define CRYPT_OFFSET 1 9 | #define MAIN_DEVICE_TYPE 0x1 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ved/Driver/headers/crypt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifdef DRIVER_PROJECT 3 | #include 4 | #endif 5 | 6 | #include 7 | #define BLOCK_SIZE 16 8 | 9 | typedef __int32 uint32_t ; 10 | 11 | typedef unsigned char BYTE; 12 | 13 | void Rc4Crypt(PCHAR key,size_t len,PCHAR data,size_t data_len); 14 | 15 | NTSTATUS DecryptEncrypt(UCHAR * puDataPassword, size_t uSizePassword, UCHAR * puData, size_t uSizeData, BOOLEAN bIsEncrypt); 16 | -------------------------------------------------------------------------------- /ved/Driver/headers/globalvariable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "libraries.h" 3 | ULONG g_uCountDevice = 1; 4 | HANDLE g_pDirHandle = NULL; 5 | PDEVICE_OBJECT g_pDeviceObject = NULL; 6 | PDRIVER_OBJECT g_pDriverObject = NULL; 7 | 8 | UNICODE_STRING g_usDeviceName = RTL_CONSTANT_STRING(DEVICE_MAIN_DEVICE_NAME); 9 | UNICODE_STRING g_usSymLinkName = RTL_CONSTANT_STRING(MAIN_DEVICE_SYM_LINK); 10 | 11 | -------------------------------------------------------------------------------- /ved/Driver/headers/headers.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER 2 | #define HEADER 3 | #include "constants.h" 4 | #include "codeioctl.h" 5 | #include "structs.h" 6 | #include "open_file_info.h" 7 | #include "globalvariable.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /ved/Driver/headers/libraries.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBRARY 2 | #define LIBRARY 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /ved/Driver/headers/structs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "libraries.h" 3 | #include "constants.h" 4 | #include "crypt.h" 5 | #include "open_file_info.h" 6 | 7 | 8 | 9 | typedef struct _DEVICE_EXTENSION { 10 | BOOLEAN media_in_device; 11 | UNICODE_STRING device_name; 12 | ULONG device_number; 13 | DEVICE_TYPE device_type; 14 | HANDLE file_handle; 15 | UNICODE_STRING file_name; 16 | LARGE_INTEGER file_size; 17 | ANSI_STRING password; 18 | LIST_ENTRY list_head; 19 | KSPIN_LOCK list_lock; 20 | KEVENT request_event; 21 | PVOID thread_pointer; 22 | BOOLEAN terminate_thread; 23 | enum Crypt crypt_mode; 24 | WCHAR letter; 25 | 26 | 27 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION; 28 | 29 | -------------------------------------------------------------------------------- /ved/Driver/source/driver.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dumitory-dev/virtual-encrypted-disk/48c508748667912dda93f9b10f2b18d52cd5f74c/ved/Driver/source/driver.cpp -------------------------------------------------------------------------------- /ved/Driver/utils/path.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////// 2 | // dep: stl & apathy 3 | #include 4 | #ifndef _EASTL 5 | #define _EASTL 6 | #endif 7 | #include "path.hpp" 8 | 9 | extern "C" 10 | size_t path_sanitize(char* s, size_t sz, const char* base, const char* expr) 11 | { 12 | eastl::string t; 13 | 14 | t.append(base); 15 | t.append("\\"); 16 | t.append(expr); 17 | for (char& c : t) 18 | { 19 | if (c == '\\') 20 | c = '/'; 21 | } 22 | 23 | apathy::Path path(t); 24 | t = path.sanitize().string(); 25 | 26 | if (t.empty()) 27 | return 0; 28 | 29 | for (char& c : t) 30 | { 31 | if (c == '/') 32 | c = '\\'; 33 | } 34 | t.insert(0, "\\??\\"); 35 | 36 | size_t size = t.size(); 37 | const char* ptr = t.c_str(); 38 | 39 | if (sz < size + 1) 40 | return 0; 41 | 42 | memcpy(s, ptr, size); 43 | s[size] = '\0'; 44 | 45 | return size; 46 | } 47 | -------------------------------------------------------------------------------- /ved/Tests/TestDriver/TestDriver.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Исходные файлы 20 | 21 | 22 | -------------------------------------------------------------------------------- /ved/Tests/TestLib/pch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pch.cpp 3 | // Include the standard header and generate the precompiled header. 4 | // 5 | 6 | #include "pch.h" 7 | -------------------------------------------------------------------------------- /ved/Tests/TestLib/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // Header for standard system include files. 4 | // 5 | 6 | #pragma once 7 | 8 | #include "gtest/gtest.h" 9 | #include 10 | -------------------------------------------------------------------------------- /ved/Tests/TestLib/test.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "classes/hash/hash.h" 3 | #include "classes/driver_disk/driver_disk.h" 4 | 5 | namespace hash { 6 | 7 | std::vector data{ 'm','a','m','a' }; 8 | 9 | TEST(TestLibHash, TestMd5) { 10 | 11 | const std::string test_hash = "eeafbf4d9b3957b139da7b7f2e7f2d4a"; 12 | ved::hash hash_(ved::hash::type_hash::MD5); 13 | EXPECT_EQ(hash_.get_hash(data), test_hash); 14 | } 15 | 16 | TEST(TestLibHash, TestSHA256) { 17 | 18 | const std::string test_hash = "ccb711f092ac8ef1805b5045fab7e8a6189cb97ad04565e21b5fbcfc9e542e42"; 19 | ved::hash hash_(ved::hash::type_hash::SHA256); 20 | EXPECT_EQ(hash_.get_hash(data), test_hash); 21 | } 22 | 23 | TEST(TestLibHash, TestSHA1) { 24 | 25 | const std::string test_hash = "99df988b77e60a1718e9e6fecdaf22552047be28"; 26 | ved::hash hash_(ved::hash::type_hash::SHA1); 27 | EXPECT_EQ(hash_.get_hash(data), test_hash); 28 | } 29 | } 30 | 31 | 32 | namespace input 33 | { 34 | 35 | std::string password = "0000000000000000"; 36 | std::wstring path = L"empty"; 37 | LARGE_INTEGER size; 38 | Crypt mode = Crypt::RC4; 39 | WCHAR letter = L'C'; 40 | 41 | 42 | TEST(TestLibInput, TestPassword) { 43 | 44 | size.QuadPart = 100; 45 | EXPECT_THROW(ved::driver_disk::make_file_info(path,size,letter,"1",mode),std::invalid_argument); 46 | } 47 | 48 | TEST(TestLibInput, TestPath) { 49 | 50 | size.QuadPart = 100; 51 | EXPECT_THROW(ved::driver_disk::make_file_info(L"",size,letter,password,mode),std::invalid_argument); 52 | } 53 | 54 | TEST(TestLibInput, TestSize) { 55 | 56 | size.QuadPart = 9; 57 | EXPECT_THROW(ved::driver_disk::make_file_info(path,size,letter,password,mode),std::invalid_argument); 58 | } 59 | 60 | TEST(TestLibInput, TestLetter) { 61 | 62 | size.QuadPart = 100; 63 | letter = '1'; 64 | EXPECT_THROW(ved::driver_disk::make_file_info(path,size,letter,password,mode),std::invalid_argument); 65 | } 66 | 67 | } 68 | 69 | int main(int argc, char** argv) { 70 | ::testing::InitGoogleTest(&argc, argv); 71 | return RUN_ALL_TESTS(); 72 | } 73 | -------------------------------------------------------------------------------- /ved/general-headers/constant.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define DEVICE_BASE_NAME L"\\FileDisk" 4 | #define DEVICE_DIR_NAME L"\\Device" DEVICE_BASE_NAME 5 | #define DEVICE_NAME_PREFIX DEVICE_DIR_NAME DEVICE_BASE_NAME 6 | #define DEVICE_MAIN_DEVICE_NAME_PREFIX L"\\EntryPoint" 7 | 8 | #define MAIN_DEVICE_SYM_LINK L"\\??\\TestLink" 9 | #define DEVICE_MAIN_DEVICE_NAME DEVICE_DIR_NAME DEVICE_MAIN_DEVICE_NAME_PREFIX 10 | 11 | 12 | #define IOCTL_FILE_DISK_OPEN_FILE CTL_CODE(FILE_DEVICE_DISK, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 13 | #define IOCTL_FILE_DISK_CLOSE_FILE CTL_CODE(FILE_DEVICE_DISK, 0x801, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 14 | #define IOCTL_FILE_ADD_DEVICE CTL_CODE(FILE_DEVICE_DISK, 0x802, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 15 | #define IOCTL_GET_FREE_DEVICE CTL_CODE(FILE_DEVICE_DISK, 0x803, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 16 | #define IOCTL_GET_MOUNT_DEVICES CTL_CODE(FILE_DEVICE_DISK, 0x804, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 17 | 18 | #define MAX_PASSWORD_SIZE 16 -------------------------------------------------------------------------------- /ved/general-headers/open_file_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "constant.h" 3 | #include 4 | 5 | enum Crypt 6 | { 7 | CryptPrev = 0, 8 | RC4, 9 | AES 10 | }; 11 | 12 | typedef struct _OPEN_FILE_INFORMATION { 13 | LARGE_INTEGER FileSize; 14 | WCHAR DriveLetter; 15 | USHORT FileNameLength; 16 | USHORT PasswordLength; 17 | CHAR Password[MAX_PASSWORD_SIZE]; 18 | WCHAR FileName[MAX_PATH]; 19 | enum Crypt CryptMode; 20 | }OPEN_FILE_INFORMATION, *POPEN_FILE_INFORMATION; -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/DynamicLib.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | BOOL APIENTRY DllMain(HMODULE hModule, 3 | DWORD ul_reason_for_call, 4 | LPVOID lpReserved 5 | ) 6 | { 7 | switch (ul_reason_for_call) 8 | { 9 | case DLL_PROCESS_ATTACH: 10 | case DLL_THREAD_ATTACH: 11 | case DLL_THREAD_DETACH: 12 | case DLL_PROCESS_DETACH: 13 | break; 14 | default: ; 15 | } 16 | return TRUE; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/include/functions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "json.hpp" 3 | #include "safecall.h" 4 | #include "utils.h" 5 | 6 | #define IMLP_TEMPLATE_FUNC_VED_API(name) \ 7 | template \ 8 | bool name(Args... param) noexcept \ 9 | { \ 10 | return safe_call(&ved::i_ved_manager::name, param...); \ 11 | } 12 | 13 | IMLP_TEMPLATE_FUNC_VED_API(un_mount) 14 | IMLP_TEMPLATE_FUNC_VED_API(mount) 15 | IMLP_TEMPLATE_FUNC_VED_API(mount_ex) 16 | IMLP_TEMPLATE_FUNC_VED_API(create_file) 17 | IMLP_TEMPLATE_FUNC_VED_API(run_driver) 18 | IMLP_TEMPLATE_FUNC_VED_API(copy_image) 19 | 20 | template 21 | const wchar_t* 22 | get_error(Args...) noexcept 23 | { 24 | return cur_error.c_str(); 25 | } 26 | 27 | template 28 | bool 29 | get_mounted_disks(char* buffer, int* len) noexcept 30 | { 31 | return noexcept_call([=]() { 32 | if (!check_arguments(buffer, len)) 33 | throw std::exception("Invalid input argument(null pointer)"); 34 | 35 | const auto json_dump = 36 | utils::convert_mounted_disk_to_json(manager->get_mounted_disks()); 37 | 38 | if (*len <= json_dump.size()) { 39 | *len = json_dump.size() + 1; 40 | throw std::exception("Too small input buffer!"); 41 | } 42 | 43 | memcpy(buffer, json_dump.c_str(), json_dump.size()); 44 | buffer[json_dump.size()] = '\0'; 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/include/global_variable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "i_ved_manager.h" 3 | #include "ved_manager/ved_manager.h" 4 | 5 | inline auto manager = ved::i_ved_manager::create(); 6 | inline auto cur_error{ std::wstring(L"None error!") }; 7 | 8 | 9 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/include/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef DLL_EXPORTS 4 | #define DLL_API __declspec(dllexport) 5 | #else 6 | #error "not supported" 7 | #endif 8 | 9 | #include "functions.h" 10 | 11 | extern "C" 12 | { 13 | 14 | template DLL_API bool un_mount(wchar_t letter) noexcept; 15 | 16 | template DLL_API bool mount(const wchar_t* path, 17 | const char* password, 18 | wchar_t letter) noexcept; 19 | 20 | template DLL_API bool mount_ex(const wchar_t* path, 21 | unsigned long long size, 22 | const char* password, 23 | wchar_t letter, 24 | enum Crypt crypt_mode) noexcept; 25 | 26 | template DLL_API bool create_file(const wchar_t* path, 27 | unsigned long long size, 28 | const char* password, 29 | enum Crypt crypt_mode) noexcept; 30 | 31 | template DLL_API bool run_driver(unsigned long flag_startup, 32 | const wchar_t* path_driver, 33 | const wchar_t* name_service) noexcept; 34 | 35 | template DLL_API bool copy_image(const wchar_t* src, const wchar_t* dest) noexcept; 36 | 37 | template DLL_API bool get_mounted_disks(char* buffer, int* len) noexcept; 38 | 39 | template DLL_API const wchar_t* get_error() noexcept; 40 | } 41 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/include/safecall.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "global_variable.h" 4 | 5 | template 6 | bool 7 | check_arguments(Types... args) 8 | { 9 | const auto check_null_pointer = [](auto param) { 10 | if constexpr (std::is_pointer_v>) { 11 | return static_cast(param); 12 | } 13 | else { 14 | return true; 15 | } 16 | }; 17 | auto res{ true }; 18 | return ((res &= check_null_pointer(args)), ...); 19 | } 20 | 21 | inline void 22 | set_error(const wchar_t* error) 23 | { 24 | cur_error = error; 25 | } 26 | 27 | template 28 | bool 29 | noexcept_call(T&& func) noexcept 30 | { 31 | try { 32 | func(); 33 | return true; 34 | } 35 | catch (const ved::c_exception& error) { 36 | cur_error = error.GetMessageW(); 37 | } 38 | catch (const std::exception& error) { 39 | const auto str_error = std::string(error.what()); 40 | cur_error = std::wstring{ str_error.cbegin(), str_error.cend() }; 41 | } 42 | return false; 43 | } 44 | 45 | template 46 | auto 47 | create_method_wrapper(T&& func, Args&&... args) 48 | { 49 | return[... args = std::forward(args), &func]() mutable { 50 | (manager.get()->*func)(std::forward(args)...); 51 | }; 52 | } 53 | 54 | template 55 | auto 56 | safe_call(T&& func, Args&&... args) noexcept 57 | { 58 | if (!check_arguments(args...)) { 59 | set_error(L"Invalid input argument(null pointer)"); 60 | return false; 61 | } 62 | return noexcept_call( 63 | create_method_wrapper(std::forward(func), std::forward(args)...)); 64 | } 65 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/include/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "global_variable.h" 3 | #include 4 | 5 | namespace utils { 6 | 7 | using disk_info = OPEN_FILE_INFORMATION; 8 | 9 | inline void 10 | remove_unused_prefix_from_path(std::wstring& path) 11 | { 12 | path.erase(0, 4); // remove ////??//// 13 | } 14 | 15 | std::string 16 | convert_mounted_disk_to_json(const std::vector& disks); 17 | } 18 | -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" -------------------------------------------------------------------------------- /ved/libs/dynamic-lib/Dll/export/src/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | #include "json.hpp" 3 | 4 | using namespace utils; 5 | using namespace std; 6 | using namespace nlohmann; 7 | 8 | string 9 | utils::convert_mounted_disk_to_json(const vector& disks) 10 | { 11 | 12 | if (disks.empty()) 13 | return ""; 14 | 15 | json j_array = json::array(); 16 | for (const auto& [FileSize, 17 | DriveLetter, 18 | FileNameLength, 19 | PasswordLength, 20 | Password, 21 | FileName, 22 | CryptMode] : disks) { 23 | 24 | 25 | auto path = wstring(FileName); 26 | remove_unused_prefix_from_path(path); 27 | 28 | json obj{}; 29 | 30 | obj["FilePath"] = string(path.cbegin(), path.cend()); 31 | obj["FileSize"] = FileSize.QuadPart / 1024 / 1024; 32 | obj["CryptMode"] = CryptMode; 33 | obj["FilePath"] = string(path.cbegin(), path.cend()); 34 | obj["Letter"] = static_cast(DriveLetter); 35 | 36 | j_array.push_back(obj); 37 | } 38 | 39 | return j_array.dump(); 40 | } -------------------------------------------------------------------------------- /ved/libs/static-lib/global_headers/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" -------------------------------------------------------------------------------- /ved/libs/static-lib/global_headers/pch.h: -------------------------------------------------------------------------------- 1 | #ifndef STDAFX 2 | #define STDAFX 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/New Text Document.txt: -------------------------------------------------------------------------------- 1 | $(SolutionDir)libs\static-lib\source\classes 2 | $(SolutionDir)libs\static-lib\source\interface 3 | $(SolutionDir)libs\static-lib\global_headers 4 | $(SolutionDir)general-headers 5 | $(SolutionDir)libs\dynamic-lib\Dll\export\include 6 | $(SolutionDir)libs\dynamic-lib\Dll\export\external 7 | $(SolutionDir)libs\static-lib\source -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/copy_sparse/copy_sparse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | namespace ved { 5 | 6 | /** 7 | * \brief A class for copying "Sparse files" 8 | */ 9 | class copy_sparse { 10 | public: 11 | copy_sparse(const copy_sparse& other) = delete; 12 | copy_sparse(copy_sparse&& other) noexcept = delete; 13 | copy_sparse& operator=(const copy_sparse& other) = delete; 14 | copy_sparse& operator=(copy_sparse&& other) noexcept = delete; 15 | copy_sparse(void) = delete; 16 | ~copy_sparse(void) = delete; 17 | /** 18 | All files we create can be "sparse". They have to be copied in a special way. 19 | See also: https://en.wikipedia.org/wiki/Sparse_file 20 | \param[in] in Where to copy from 21 | \param[in] out Where to copy 22 | */ 23 | static void copy(const std::wstring& in, const std::wstring& out); 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/define_device/define_device_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "define_device_manager.h" 2 | #include "classes/exceptions/exception.h" 3 | #include 4 | 5 | namespace ved { 6 | void 7 | define_device_manager::link_device(const std::wstring& path_device) 8 | { 9 | if (!::DefineDosDevice( 10 | DDD_RAW_TARGET_PATH, &this->letter_[4], path_device.c_str())) { 11 | throw ved::c_win_api_exception(L"Error DefineDosDevice!(add)", 12 | ::GetLastError()); 13 | } 14 | } 15 | 16 | void 17 | define_device_manager::delete_define(void) const 18 | { 19 | if (!::DefineDosDevice(DDD_REMOVE_DEFINITION, &this->letter_[4], nullptr)) { 20 | throw ved::c_win_api_exception(L"Error DefineDosDevice(delete)!", 21 | ::GetLastError()); 22 | } 23 | } 24 | 25 | void 26 | define_device_manager::report_define(void) const 27 | { 28 | ::SHChangeNotify( 29 | SHCNE_DRIVEADD, SHCNF_PATH, this->drive_name_.c_str(), nullptr); 30 | } 31 | 32 | void 33 | define_device_manager::report_delete_define(void) const 34 | { 35 | ::SHChangeNotify( 36 | SHCNE_DRIVEREMOVED, SHCNF_PATH, this->drive_name_.c_str(), nullptr); 37 | } 38 | 39 | bool 40 | define_device_manager::check_define(void) const 41 | { 42 | try { 43 | ved::file::settings settings{}; 44 | 45 | settings.dw_creation_disposition = OPEN_EXISTING; 46 | settings.dw_desired_access = GENERIC_READ | GENERIC_WRITE; 47 | settings.dw_flags_and_attributes = FILE_FLAG_NO_BUFFERING; 48 | settings.dw_share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; 49 | settings.ws_file_name = this->letter_; 50 | 51 | auto tmp = ved::file::create(settings); 52 | 53 | return true; 54 | } 55 | catch (const ved::c_win_api_exception& error) { 56 | if (error.get_code() != 0x02) { 57 | return true; 58 | } 59 | return false; 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/define_device/define_device_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "classes/device/device.h" 3 | 4 | 5 | 6 | namespace ved { 7 | /** 8 | * \brief A class for creating various manipulations with links in the system. 9 | * Here we tell the system to associate our drive letter with a kernel object. 10 | */ 11 | class define_device_manager 12 | { 13 | public: 14 | define_device_manager(const define_device_manager& other) = default; 15 | define_device_manager(define_device_manager&& other) noexcept = default; 16 | define_device_manager& operator=(const define_device_manager& other) = 17 | default; 18 | define_device_manager& operator=(define_device_manager&& other) noexcept = 19 | default; 20 | define_device_manager(void) = delete; 21 | ~define_device_manager(void) = default; 22 | 23 | /** 24 | * Constructor 25 | * \param [in] letter Disk letter 26 | */ 27 | explicit define_device_manager(const WCHAR letter) 28 | { 29 | this->letter_ = define_device_manager::make_path_letter(letter); 30 | this->drive_name_ = define_device_manager::make_drive_name(letter); 31 | } 32 | 33 | /** 34 | * The method checks if there are disks with our letter 35 | * \return bool true or false 36 | */ 37 | [[nodiscard]] bool check_define(void) const; 38 | 39 | /** 40 | * The method associates the letter of our disk with an object in the system (driver) 41 | * \param [in] path_device Device object path. 42 | */ 43 | void link_device(const std::wstring& path_device); 44 | 45 | /** 46 | * The method removes our letter from the system 47 | */ 48 | void delete_define(void) const; 49 | 50 | /** 51 | * The method tells the system that we have added a new disk with the letter 52 | */ 53 | void report_define(void) const; 54 | 55 | /** 56 | * The method tells the system that we have deleted our disk with the letter 57 | */ 58 | void report_delete_define(void) const; 59 | 60 | /** 61 | * The method creates a new instance of the device class 62 | */ 63 | [[nodiscard]] auto make_device(void) const 64 | { 65 | return ved::device(this->letter_); 66 | } 67 | 68 | private: 69 | std::wstring letter_{}; 70 | std::wstring drive_name_{}; 71 | 72 | static std::wstring make_path_letter(WCHAR letter) 73 | { 74 | std::wstring path_letter = LR"(\\.\ :)"; 75 | path_letter[4] = letter; 76 | return path_letter; 77 | } 78 | 79 | static std::wstring make_drive_name(WCHAR letter) 80 | { 81 | std::wstring drive_name = L" :\\"; 82 | drive_name[0] = letter; 83 | return drive_name; 84 | } 85 | }; 86 | 87 | } 88 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/device/device.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "device.h" 3 | namespace ved { 4 | void 5 | device::connect() 6 | { 7 | ved::file::settings settings{}; 8 | 9 | settings.dw_creation_disposition = OPEN_EXISTING; 10 | settings.dw_desired_access = GENERIC_READ | GENERIC_WRITE; 11 | settings.dw_flags_and_attributes = FILE_FLAG_NO_BUFFERING; 12 | settings.dw_share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; 13 | settings.ws_file_name = this->path_driver_; 14 | 15 | h_driver_ = ved::file::create(settings); 16 | } 17 | 18 | DWORD 19 | device::send_ctl_code(const DWORD code, 20 | void* data_in, 21 | const DWORD size_data_in, 22 | void* data_out, 23 | const DWORD size_data_out) const 24 | { 25 | 26 | DWORD ret = 0; 27 | 28 | if (!::DeviceIoControl(h_driver_->operator void* (), 29 | code, 30 | data_in, 31 | size_data_in, 32 | data_out, 33 | size_data_out, 34 | &ret, 35 | nullptr)) { 36 | 37 | throw ved::driver_exception(L"Error DeviceIoControl!", GetLastError()); 38 | } 39 | 40 | return ret; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/device/device.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "classes/file/file.h" 4 | 5 | namespace ved { 6 | /** 7 | * \brief A class for interacting with the driver object. 8 | * Although it is better to inherit this class from i_file, I no longer remember why it looks like this :( 9 | */ 10 | class device 11 | { 12 | public: 13 | device(void) = default; 14 | ~device(void) = default; 15 | device(const device& other) = delete; 16 | device(device&& other) noexcept = default; 17 | device& operator=(const device& other) = delete; 18 | device& operator=(device&& other) noexcept = default; 19 | 20 | /** 21 | * Constructor 22 | * \param [in] path_driver - The path to the driver object. 23 | * We have a master object that creates the other objects for a particular drive. 24 | */ 25 | explicit device(std::wstring path_driver) 26 | : path_driver_(std::move(path_driver)) 27 | {} 28 | 29 | /** 30 | Method for connecting to a device. 31 | */ 32 | void connect(void); 33 | 34 | /** 35 | Method for disconnecting to a device. 36 | */ 37 | void disconnect(void) { this->h_driver_ = {}; } 38 | 39 | /** 40 | * The method returns the path to the device 41 | * \return wstring 42 | */ 43 | [[nodiscard]] auto get_path(void) const noexcept { return this->path_driver_; } 44 | 45 | /** 46 | * Setting path 47 | * \param [in] path new path (must not be empty) 48 | */ 49 | auto set_path(const std::wstring& path) 50 | { 51 | if (path.empty()) { 52 | throw std::runtime_error("Path device is empty!"); 53 | } 54 | 55 | this->path_driver_ = path; 56 | } 57 | 58 | /** 59 | * The method sends a message to the device. See also: https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/defining-i-o-control-codes 60 | * \param [in] code Command code 61 | * \param [in] data_in Data buffer for send 62 | * \param [in] size_data_in Data buffer size 63 | * \param [in] data_out Buffer to retrieve information 64 | * \param [in] size_data_out Buffer to retrieve size 65 | */ 66 | DWORD send_ctl_code(DWORD code = 0, 67 | void* data_in = nullptr, 68 | DWORD size_data_in = 0, 69 | void* data_out = nullptr, 70 | DWORD size_data_out = 0) const; 71 | 72 | /** 73 | * Writing information to the device. 74 | * \param [in] data Data buffer for send 75 | * \param [in] lp LPOVERLAPPED for async 76 | */ 77 | auto write(const std::vector& data, LPOVERLAPPED lp = {}) const 78 | { 79 | return this->h_driver_->write(data, lp); 80 | } 81 | 82 | /** 83 | * Reading information to the device. 84 | * \param [out] data Buffer to retrieve information 85 | * \param [in] lp LPOVERLAPPED for async 86 | */ 87 | auto read(std::vector& data, LPOVERLAPPED lp = {}) const 88 | { 89 | return this->h_driver_->read(data, lp); 90 | } 91 | 92 | /** 93 | * The method checks if we are connected to the device 94 | * \return bool 95 | */ 96 | [[nodiscard]] auto is_connect(void) const noexcept 97 | { 98 | return static_cast(this->h_driver_.get()); 99 | } 100 | 101 | private: 102 | std::wstring path_driver_{}; 103 | std::unique_ptr h_driver_{}; 104 | }; 105 | } 106 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/driver_disk/driver_disk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "classes/copy_sparse/copy_sparse.h" 4 | #include "classes/device/device.h" 5 | #include "open_file_info.h" 6 | 7 | namespace ved { 8 | /** 9 | * \brief A class for interacting with the disk driver. 10 | * It encapsulates the work with the kernel objects 11 | * 12 | */ 13 | class driver_disk 14 | { 15 | public: 16 | /** 17 | The method creates OPEN_FILE_INFORMATION structure, which contains information about the disk image we are opening. 18 | Then, this object is passed to the driver 19 | \param [in] file_name Disk image file 20 | \param [in] file_size Disk image size 21 | \param [in] drive_letter Disk image letter 22 | \param [in] file_password Disk image password 23 | \param [in] mode_crypt Disk image crypt mode (AES or GCM) 24 | */ 25 | static std::unique_ptr make_file_info( 26 | const std::wstring& file_name, 27 | LARGE_INTEGER file_size, 28 | WCHAR drive_letter, 29 | const std::string& file_password, 30 | enum Crypt mode_crypt); 31 | 32 | driver_disk(const driver_disk& other) = delete; 33 | driver_disk(driver_disk&& other) noexcept = delete; 34 | driver_disk& operator=(const driver_disk& other) = delete; 35 | driver_disk& operator=(driver_disk&& other) noexcept = delete; 36 | driver_disk(void) = default; 37 | ~driver_disk(void) = default; 38 | 39 | /** 40 | The constructor takes the path to the main kernel object 41 | \param [in] path_main_device Path to main kernel object 42 | */ 43 | explicit driver_disk(const std::wstring& path_main_device) 44 | { 45 | this->main_device_ = device(path_main_device); 46 | this->path_main_device_ = path_main_device; 47 | } 48 | 49 | /** 50 | Trying to open the device... 51 | */ 52 | void connect_to_main_device(void) { this->main_device_.connect(); } 53 | 54 | /** 55 | The method checks if we are connected to the main kernel object (driver) 56 | */ 57 | [[nodiscard]] auto is_connected(void) const noexcept 58 | { 59 | return this->main_device_.is_connect(); 60 | } 61 | 62 | /** 63 | The method mounts the disk to the system 64 | \param[in] open_file OPEN_FILE_INFORMATION structure, which contains information about the disk image we are opening. 65 | */ 66 | void mount_disk( 67 | const std::unique_ptr& open_file) const; 68 | 69 | /** 70 | The method creates a disk image in the file system 71 | \param[in] open_file OPEN_FILE_INFORMATION structure, which contains information about the disk image we are opening. 72 | */ 73 | void create_file_disk( 74 | const std::unique_ptr& open_file) const; 75 | 76 | /** 77 | Method of unmounting a disk from the system 78 | \param[in] letter Disk letter 79 | */ 80 | static void un_mount_disk(WCHAR letter); 81 | 82 | /** 83 | The method copies the sparse file 84 | \param[in] in copy from where 85 | \param[in] out copy to where 86 | */ 87 | static void copy_image(const std::wstring& in, const std::wstring& out); 88 | 89 | /** 90 | The method returns disks that we have mounted to the system 91 | \return std::vector 92 | */ 93 | [[nodiscard]] std::vector get_mounted_disks( 94 | void) const; 95 | 96 | private: 97 | [[nodiscard]] size_t get_free_number_device(void) const; 98 | 99 | device main_device_{}; 100 | std::wstring path_main_device_{}; 101 | }; 102 | 103 | } 104 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/file/file.cpp: -------------------------------------------------------------------------------- 1 | #include "file.h" 2 | 3 | namespace ved { 4 | 5 | i_file& 6 | file::create(void) 7 | { 8 | i_file::h_ = std::make_unique( 9 | ::CreateFile(this->settings_.ws_file_name.c_str(), 10 | this->settings_.dw_desired_access, 11 | this->settings_.dw_share_mode, 12 | this->settings_.lp_security_attributes, 13 | this->settings_.dw_creation_disposition, 14 | this->settings_.dw_flags_and_attributes, 15 | nullptr)); 16 | 17 | if (!*i_file::h_) 18 | throw file_exception(L"Error CreateFile", GetLastError()); 19 | 20 | return *this; 21 | } 22 | 23 | LARGE_INTEGER 24 | file::get_size(void) const 25 | { 26 | LARGE_INTEGER liReturn{}; 27 | if (!::GetFileSizeEx(*i_file::h_, &liReturn)) 28 | throw file_exception(L"Error GetFileSizeEx", GetLastError()); 29 | 30 | return liReturn; 31 | } 32 | 33 | std::wstring 34 | file::get_extension(const std::wstring& ws_file) 35 | { 36 | const auto pos_extension = ws_file.rfind('.'); 37 | 38 | if (pos_extension == std::wstring::npos) 39 | return std::wstring(); 40 | 41 | return ws_file.substr(pos_extension); 42 | } 43 | 44 | DWORD 45 | file::get_attributes(const std::wstring& ws_file) 46 | { 47 | const auto dw_return = ::GetFileAttributes(ws_file.c_str()); 48 | 49 | if (dw_return == INVALID_FILE_ATTRIBUTES) 50 | throw file_exception(L"Error GetFileAttributes", GetLastError()); 51 | 52 | return dw_return; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/file/file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "classes/exceptions/exception.h" 3 | #include "interface/i_file.h" 4 | #include "pch.h" 5 | 6 | namespace ved { 7 | /** 8 | * \brief The class encapsulates methods of addressing the device descriptor... 9 | */ 10 | class file final : public i_file 11 | { 12 | 13 | public: 14 | file(void) = default; 15 | file(const file&) = delete; 16 | file(file&&) = delete; 17 | file& operator=(const file&) = delete; 18 | file& operator=(file&&) = delete; 19 | 20 | /** 21 | * \brief Kind of a good practice... 22 | * The default is to open the file for reading 23 | */ 24 | struct settings 25 | { 26 | 27 | std::wstring ws_file_name{}; 28 | DWORD dw_desired_access{ GENERIC_READ }; 29 | DWORD dw_share_mode{ FILE_SHARE_READ }; 30 | LPSECURITY_ATTRIBUTES lp_security_attributes{}; 31 | DWORD dw_creation_disposition{ OPEN_EXISTING }; 32 | DWORD dw_flags_and_attributes{ FILE_ATTRIBUTE_NORMAL }; 33 | HANDLE h_template_file{}; 34 | }; 35 | 36 | explicit file(settings settings) 37 | : settings_(std::move(settings)) 38 | {} 39 | 40 | ~file(void) override = default; 41 | 42 | /** 43 | * The method creates an instance of our class 44 | * \param[in] settings File opening settings 45 | * \return unique_ptr 46 | */ 47 | static auto create(const settings& settings) 48 | { 49 | return i_file::create(settings); 50 | } 51 | 52 | /** 53 | * The method returns the file size in kilobytes 54 | * 55 | * \return LARGE_INTEGER 56 | */ 57 | [[nodiscard]] LARGE_INTEGER get_size(void) const override; 58 | 59 | /** 60 | * The method returns file attributes 61 | * 62 | * \param[in] ws_file File path 63 | * \return DWORD file attributes 64 | */ 65 | static DWORD get_attributes(const std::wstring& ws_file); 66 | 67 | /** 68 | * The method returns file extension 69 | * 70 | * \param[in] ws_file File path 71 | * \return wstring file extension 72 | */ 73 | static std::wstring get_extension(const std::wstring& ws_file); 74 | 75 | private: 76 | settings settings_{}; 77 | 78 | i_file& create(void) override; 79 | 80 | i_file& connect(LPOVERLAPPED = {}) const override 81 | { 82 | throw file_exception(L"File::Connect", ERROR_NOT_SUPPORTED); 83 | } 84 | 85 | [[nodiscard]] i_file& disconnect(void) const override 86 | { 87 | throw file_exception(L"File::Disconnect", ERROR_NOT_SUPPORTED); 88 | } 89 | }; 90 | 91 | } 92 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/hash/hash.cpp: -------------------------------------------------------------------------------- 1 | #include "hash.h" 2 | #include "classes/exceptions/exception.h" 3 | namespace ved { 4 | 5 | std::string 6 | hash::get_hash(const BYTE* data, const DWORD size) const 7 | { 8 | HCRYPTPROV h_prov{}; 9 | HCRYPTPROV h_hash{}; 10 | 11 | if (!::CryptAcquireContext( 12 | &h_prov, nullptr, nullptr, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) { 13 | throw ved::c_hash_exception(L"Error CryptAcquireContext", GetLastError()); 14 | } 15 | 16 | handle uptrh_prov(reinterpret_cast(h_prov), f_destroy_context_); 17 | 18 | if (!::CryptCreateHash( 19 | h_prov, static_cast(this->type_), 0, 0, &h_hash)) { 20 | throw ved::c_hash_exception(L"Error CryptCreateHash", GetLastError()); 21 | } 22 | 23 | handle uptrh_hash = { reinterpret_cast(h_hash), f_destroy_hash_ }; 24 | 25 | if (!::CryptHashData(h_hash, data, size, 0)) { 26 | throw ved::c_hash_exception(L"Error CryptHashData", GetLastError()); 27 | } 28 | 29 | DWORD dw_hash_size{}; 30 | DWORD dw_size_dw = sizeof(DWORD); 31 | 32 | if (!::CryptGetHashParam(h_hash, 33 | HP_HASHSIZE, 34 | reinterpret_cast(&dw_hash_size), 35 | &dw_size_dw, 36 | 0)) { 37 | throw ved::c_hash_exception(L"Error CryptGetHashParam", GetLastError()); 38 | } 39 | 40 | std::vector v_data(dw_hash_size); 41 | 42 | if (!::CryptGetHashParam(h_hash, 43 | HP_HASHVAL, 44 | reinterpret_cast(&v_data[0]), 45 | &dw_hash_size, 46 | 0)) { 47 | throw ved::c_hash_exception(L"Error CryptGetHashParam", GetLastError()); 48 | } 49 | 50 | std::ostringstream oss{}; 51 | 52 | for (unsigned char& iter : v_data) 53 | { 54 | oss.fill('0'); 55 | oss.width(2); 56 | 57 | oss << std::hex << static_cast(iter); 58 | } 59 | 60 | return oss.str(); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/hash/hash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "classes/exceptions/exception.h" 3 | #include 4 | #include 5 | 6 | namespace ved { 7 | /** 8 | * \brief A class for getting hashes... 9 | * In the project, from any password we get a hash, which becomes a key for encrypting and decrypting files on the disk. 10 | */ 11 | class hash 12 | { 13 | 14 | public: 15 | hash(void) = delete; 16 | hash(const hash& other) = delete; 17 | hash(hash&& other) = delete; 18 | hash& operator=(const hash& other) = delete; 19 | hash& operator=(hash&& other) = delete; 20 | 21 | enum class type_hash 22 | { 23 | MD5 = (ALG_CLASS_HASH | ALG_TYPE_ANY | 3), 24 | SHA1 = (ALG_CLASS_HASH | ALG_TYPE_ANY | 4), 25 | SHA256 = (ALG_CLASS_HASH | ALG_TYPE_ANY | 12) 26 | }; 27 | 28 | /** 29 | * The method returns the hash from the string 30 | * 31 | * \param[in] buf hash data 32 | * 33 | * \return std::string data hash 34 | */ 35 | [[nodiscard]] std::string get_hash(const std::vector& buf) const 36 | { 37 | if (buf.empty()) 38 | throw ved::c_hash_exception(L"Data bytes is empty!(GetHash)"); 39 | 40 | return this->get_hash_from_byte(buf.data(), static_cast(buf.size())); 41 | } 42 | 43 | explicit hash(const type_hash& type) 44 | : type_(type) 45 | {} 46 | 47 | private: 48 | type_hash type_{}; 49 | 50 | using handle = std::unique_ptr>; 51 | 52 | const std::function f_destroy_hash_ = [](void* p) { 53 | if (p) 54 | ::CryptDestroyHash(reinterpret_cast(p)); 55 | }; 56 | 57 | const std::function f_destroy_context_ = [](void* p) { 58 | if (p) 59 | ::CryptReleaseContext(reinterpret_cast(p), 0); 60 | }; 61 | 62 | std::string get_hash(const BYTE* data, DWORD size) const; 63 | 64 | std::string get_hash_from_byte(const BYTE* data, DWORD size) const 65 | { 66 | return this->get_hash(data, size); 67 | } 68 | }; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/install_manager/install_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "install_manager.h" 2 | 3 | namespace ved { 4 | 5 | install_manager::handle 6 | install_manager::open_manager(const DWORD access) 7 | { 8 | auto h = ved::service::handle::create(::OpenSCManager({}, {}, access)); 9 | 10 | if (!*h) { 11 | throw ved::service_exception(L"OpenSCManager error!", ::GetLastError()); 12 | } 13 | 14 | return h; 15 | } 16 | 17 | void 18 | install_manager::install_service(const std::wstring& device_path, 19 | const std::wstring& device_name, 20 | DWORD startup_flag) 21 | { 22 | const auto h = ved::service::handle::create( 23 | ::CreateService(*install_manager::open_manager(), 24 | device_name.c_str(), 25 | device_name.c_str(), 26 | SERVICE_ALL_ACCESS, 27 | SERVICE_KERNEL_DRIVER, 28 | startup_flag, 29 | SERVICE_ERROR_NORMAL, 30 | device_path.c_str(), 31 | {}, 32 | {}, 33 | {}, 34 | {}, 35 | {})); 36 | 37 | if (!*h) { 38 | const auto error_code = ::GetLastError(); 39 | if (error_code != ERROR_SERVICE_EXISTS) { 40 | throw ved::service_exception(L"Error CreateService!", ::GetLastError()); 41 | } 42 | } 43 | } 44 | 45 | install_manager::handle 46 | install_manager::open_service(const handle& u_handle, 47 | const std::wstring& device_name, 48 | const DWORD access) 49 | { 50 | auto h = ved::service::handle::create( 51 | ::OpenService(*u_handle, device_name.c_str(), access)); 52 | 53 | if (!*h) { 54 | throw ved::service_exception(L"Error OpenService!", ::GetLastError()); 55 | } 56 | 57 | return h; 58 | } 59 | 60 | void 61 | install_manager::load_service(const std::wstring& device_name) 62 | { 63 | 64 | const auto h = install_manager::open_service( 65 | install_manager::open_manager(), device_name.c_str(), SERVICE_START); 66 | 67 | if (!::StartService(*h, {}, {})) { 68 | const auto error = ::GetLastError(); 69 | if (error != ERROR_SERVICE_ALREADY_RUNNING) { 70 | throw ved::service_exception(L"Error StartService!", GetLastError()); 71 | } 72 | } 73 | } 74 | 75 | void 76 | install_manager::unload_service(const std::wstring& device_name) 77 | { 78 | const auto h = install_manager::open_service( 79 | install_manager::open_manager(), device_name.c_str(), SERVICE_STOP); 80 | 81 | SERVICE_STATUS status{}; 82 | 83 | if (!::ControlService(*h, SERVICE_CONTROL_STOP, &status)) { 84 | throw ved::service_exception(L"Error ControlService!", ::GetLastError()); 85 | } 86 | } 87 | 88 | void 89 | install_manager::uninstall_service(const std::wstring& device_name) 90 | { 91 | const auto h = install_manager::open_service( 92 | install_manager::open_manager(), device_name, SERVICE_ALL_ACCESS); 93 | 94 | if (!::DeleteService(*h)) { 95 | throw ved::service_exception(L"Error DeleteService!", ::GetLastError()); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/install_manager/install_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "classes/exceptions/exception.h" 3 | #include "classes/wrap/wrap.h" 4 | 5 | namespace ved { 6 | /** 7 | * \brief The class is responsible for installing the driver on the system 8 | * Note that at the moment the driver is not signed and without a windows test mode it is impossible to load it on the system. 9 | * Except for a couple of hack, but i don't use them (though why?) 10 | * 11 | * If UAC is enabled: 12 | * 13 | * Also, driver registration should be in administrator mode, and disk management in normal user mode. 14 | * This is due to the fact that the disk is visible to the user of the specific session from which he is logged in. 15 | */ 16 | class install_manager 17 | { 18 | using handle = std::unique_ptr; 19 | 20 | public: 21 | install_manager(void) = delete; 22 | ~install_manager(void) = delete; 23 | install_manager(const install_manager& other) = delete; 24 | install_manager(install_manager&& other) noexcept = delete; 25 | install_manager& operator=(const install_manager& other) = delete; 26 | install_manager& operator=(install_manager&& other) noexcept = delete; 27 | 28 | /** 29 | Registers driver on the system 30 | \param[in] startup_flag The driver launch flag. There can be several variants: 31 | SERVICE_DEMAND_START - A service started by the service control manager when a process calls the StartService function. 32 | SERVICE_AUTO_START - A service started automatically by the service control manager during system startup. 33 | \param[in] device_path Path to the driver file. 34 | \param[in] device_name Driver service name 35 | */ 36 | static void install_service(const std::wstring& device_path, 37 | const std::wstring& device_name, 38 | DWORD startup_flag = SERVICE_DEMAND_START); 39 | 40 | /** 41 | Run the driver on the system 42 | \param[in] device_name Driver service name 43 | */ 44 | static void load_service(const std::wstring& device_name); 45 | 46 | /** 47 | Stop the driver on the system 48 | \param[in] device_name Driver service name 49 | */ 50 | static void unload_service(const std::wstring& device_name); 51 | 52 | /** 53 | Unregister the driver on the system 54 | \param[in] device_name Driver service name 55 | */ 56 | static void uninstall_service(const std::wstring& device_name); 57 | 58 | private: 59 | static handle open_manager(const DWORD access = SC_MANAGER_ALL_ACCESS); 60 | 61 | static handle open_service(const handle& u_handle, 62 | const std::wstring& device_name, 63 | const DWORD access = SERVICE_ALL_ACCESS); 64 | }; 65 | 66 | } -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/ved_manager/ved_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "ved_manager.h" 2 | 3 | #include "classes/install_manager/install_manager.h" 4 | 5 | namespace ved { 6 | void 7 | ved_manager::mount(const std::wstring& path, 8 | const std::string& password, 9 | WCHAR letter) 10 | { 11 | if (!std::filesystem::exists(path)) { 12 | throw std::invalid_argument("File is not exist!"); 13 | } 14 | 15 | this->connected(); 16 | const auto hash_password = this->make_md5_hash(password); 17 | LARGE_INTEGER size; 18 | size.QuadPart = 0; 19 | const auto disk_info = ved::driver_disk::make_file_info( 20 | path, size, letter, hash_password, Crypt::CryptPrev); 21 | this->driver_.mount_disk(disk_info); 22 | } 23 | 24 | void 25 | ved_manager::mount_ex(const std::wstring& path, 26 | const unsigned long long size, 27 | const std::string& password, 28 | const WCHAR letter, 29 | const Crypt mode) 30 | { 31 | if (std::filesystem::exists(path)) { 32 | throw std::invalid_argument("File is now exist!"); 33 | } 34 | 35 | this->connected(); 36 | const auto hash_password = this->make_md5_hash(password); 37 | LARGE_INTEGER size_file; 38 | size_file.QuadPart = size; 39 | const auto disk_info = ved::driver_disk::make_file_info( 40 | path, size_file, letter, hash_password, mode); 41 | this->driver_.mount_disk(disk_info); 42 | } 43 | 44 | void 45 | ved_manager::create_file(const std::wstring& path, 46 | const unsigned long long size, 47 | const std::string& password, 48 | const Crypt mode) 49 | { 50 | 51 | if (std::filesystem::exists(path)) { 52 | throw std::invalid_argument("File is now exist!"); 53 | } 54 | 55 | this->connected(); 56 | const auto hash_password = this->make_md5_hash(password); 57 | LARGE_INTEGER size_file; 58 | size_file.QuadPart = size; 59 | const auto disk_info = ved::driver_disk::make_file_info( 60 | path, size_file, L'C', hash_password, mode); 61 | this->driver_.create_file_disk(disk_info); 62 | } 63 | 64 | void 65 | ved_manager::un_mount(const WCHAR letter) 66 | { 67 | this->connected(); 68 | ved::driver_disk::un_mount_disk(letter); 69 | } 70 | 71 | void 72 | ved_manager::run_driver(DWORD flag_startup, 73 | const std::wstring& path_driver, 74 | const std::wstring& name_service) 75 | { 76 | 77 | ved::install_manager::install_service( 78 | path_driver, name_service, flag_startup); 79 | ved::install_manager::load_service(name_service); 80 | } 81 | 82 | void 83 | ved_manager::stop_driver(const std::wstring& device_name) 84 | { 85 | 86 | this->un_mount_all(); 87 | 88 | ved::install_manager::unload_service(device_name); 89 | ved::install_manager::uninstall_service(device_name); 90 | } 91 | 92 | void 93 | ved_manager::copy_image(const std::wstring& in, const std::wstring& out) 94 | { 95 | ved::driver_disk::copy_image(in, out); 96 | } 97 | 98 | void 99 | ved_manager::un_mount_all(void) 100 | { 101 | auto disks = this->get_mounted_disks(); 102 | 103 | for (auto& element : disks) { 104 | this->un_mount(element.DriveLetter); 105 | } 106 | } 107 | 108 | std::vector 109 | ved_manager::get_mounted_disks(void) 110 | { 111 | this->connected(); 112 | return this->driver_.get_mounted_disks(); 113 | } 114 | 115 | std::string 116 | ved_manager::make_md5_hash(const std::string& password) const 117 | { 118 | auto hash = 119 | this->hash_convert_.get_hash({ password.cbegin(), password.cend() }); 120 | hash.resize(MAX_PASSWORD_SIZE); 121 | return hash; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/ved_manager/ved_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "interface/i_ved_manager.h" 4 | #include "classes/driver_disk/driver_disk.h" 5 | #include "classes/hash/hash.h" 6 | #include "constant.h" 7 | #include "open_file_info.h" 8 | 9 | 10 | namespace ved { 11 | 12 | /** 13 | * \brief The class implements the i_ved_manager interface functionality with sparse files. 14 | */ 15 | class ved_manager : public i_ved_manager 16 | { 17 | public: 18 | ved_manager(void) 19 | : driver_(MAIN_DEVICE_SYM_LINK) 20 | {} 21 | 22 | ~ved_manager(void) override = default; 23 | ved_manager(const ved_manager& other) = delete; 24 | ved_manager(ved_manager&& other) noexcept = delete; 25 | ved_manager& operator=(const ved_manager& other) = delete; 26 | ved_manager& operator=(ved_manager&& other) noexcept = delete; 27 | 28 | void mount(const std::wstring& path, 29 | const std::string& password, 30 | WCHAR letter) override; 31 | 32 | void mount_ex(const std::wstring& path, 33 | unsigned long long size, 34 | const std::string& password, 35 | WCHAR letter, 36 | Crypt mode) override; 37 | 38 | void create_file(const std::wstring& path, 39 | unsigned long long size, 40 | const std::string& password, 41 | Crypt mode) override; 42 | 43 | void un_mount(WCHAR letter) override; 44 | 45 | void run_driver(DWORD flag_startup = SERVICE_DEMAND_START, 46 | const std::wstring& path_driver = 47 | L"%SystemRoot%\\System32\\Drivers\\DriverVED.sys", 48 | const std::wstring& name_service = L"VEDriver") override; 49 | 50 | void stop_driver(const std::wstring& device_name = L"VEDriver") override; 51 | 52 | void copy_image(const std::wstring& in, const std::wstring& out) override; 53 | 54 | void un_mount_all(void) override; 55 | 56 | std::vector get_mounted_disks(void) override; 57 | 58 | private: 59 | ved::hash hash_convert_{ hash::type_hash::MD5 }; 60 | ved::driver_disk driver_; 61 | 62 | void connected(void) 63 | { 64 | if (!this->driver_.is_connected()) { 65 | try { 66 | this->driver_.connect_to_main_device(); 67 | } 68 | catch (...) { 69 | throw std::runtime_error("Error open driver device!"); 70 | } 71 | } 72 | } 73 | 74 | [[nodiscard]] std::string make_md5_hash(const std::string& password) const; 75 | }; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/wrap/wrap.cpp: -------------------------------------------------------------------------------- 1 | #include "Wrap.h" 2 | namespace ved { 3 | 4 | handle::handle(HANDLE h) noexcept 5 | : h_(h) 6 | {} 7 | 8 | handle::~handle(void) noexcept 9 | { 10 | if (this->h_) 11 | ::CloseHandle(this->h_); 12 | } 13 | 14 | handle::operator HANDLE(void) const noexcept 15 | { 16 | return this->h_; 17 | } 18 | 19 | bool 20 | handle::operator!(void) const noexcept 21 | { 22 | return this->h_ == nullptr || this->h_ == INVALID_HANDLE_VALUE; 23 | } 24 | 25 | namespace service { 26 | 27 | handle::handle(SC_HANDLE h) noexcept 28 | : h_(h) 29 | {} 30 | 31 | handle::~handle(void) noexcept 32 | { 33 | if (this->h_) 34 | CloseServiceHandle(this->h_); 35 | } 36 | 37 | std::unique_ptr 38 | handle::create(SC_HANDLE h) 39 | { 40 | return std::unique_ptr(new handle(h)); 41 | } 42 | 43 | handle::operator SC_HANDLE(void) const noexcept 44 | { 45 | return this->h_; 46 | } 47 | 48 | bool 49 | handle::operator!(void) const noexcept 50 | { 51 | return !this->h_; 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/classes/wrap/wrap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "open_file_info.h" 3 | #include "pch.h" 4 | #include 5 | 6 | namespace ved { 7 | 8 | class handle 9 | { 10 | 11 | public: 12 | handle(const handle&) = delete; 13 | handle(handle&&) = delete; 14 | handle& operator=(const handle&) = delete; 15 | handle& operator=(handle&&) = delete; 16 | 17 | explicit handle(HANDLE = {}) noexcept; 18 | 19 | virtual ~handle(void) noexcept; 20 | 21 | operator HANDLE(void) const noexcept; 22 | 23 | bool operator!(void) const noexcept; 24 | 25 | private: 26 | HANDLE h_{}; 27 | }; 28 | 29 | namespace service { 30 | 31 | class handle 32 | { 33 | 34 | public: 35 | handle(void) = delete; 36 | handle(const handle&) = delete; 37 | handle& operator=(const handle&) = delete; 38 | handle(handle&&) = delete; 39 | handle& operator=(handle&&) = delete; 40 | ~handle(void) noexcept; 41 | 42 | static std::unique_ptr create(SC_HANDLE); 43 | 44 | operator SC_HANDLE(void) const noexcept; 45 | 46 | bool operator!(void) const noexcept; 47 | 48 | private: 49 | SC_HANDLE h_{}; 50 | 51 | explicit handle(SC_HANDLE) noexcept; 52 | }; 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /ved/libs/static-lib/source/interface/i_file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "classes/wrap/wrap.h" 3 | #include "classes/exceptions/exception.h" 4 | 5 | namespace ved { 6 | 7 | /** 8 | \brief Interface for classes that use IO operations. 9 | */ 10 | class i_file 11 | { 12 | 13 | using handle = std::unique_ptr; 14 | 15 | public: 16 | i_file(const i_file&) = delete; 17 | i_file(i_file&&) = delete; 18 | i_file& operator=(const i_file&) = delete; 19 | i_file& operator=(i_file&&) = delete; 20 | 21 | /** 22 | Destructor 23 | */ 24 | virtual ~i_file(void) = default; 25 | 26 | /** 27 | Pure virtual method for connecting to a device. 28 | \param[in] LPOVERLAPPED Contains information used in asynchronous (or overlapped) input and output (I/O). 29 | */ 30 | virtual i_file& connect(LPOVERLAPPED = nullptr) const = 0; 31 | 32 | /** 33 | Pure virtual method for disconnecting the device. 34 | \param[in] LPOVERLAPPED Contains information used in asynchronous (or overlapped) input and output (I/O). 35 | */ 36 | virtual i_file& disconnect(void) const = 0; 37 | 38 | /** 39 | A method for writing data to the device. 40 | \param[in] vec_buf data 41 | \param[in] LPOVERLAPPED Contains information used in asynchronous (or overlapped) input and output (I/O). 42 | */ 43 | virtual DWORD write(const std::vector& vec_buf, 44 | LPOVERLAPPED lp_overlapped = {}) const 45 | { 46 | 47 | DWORD dw_return = {}; 48 | 49 | if (!WriteFile(*this->h_, 50 | vec_buf.data(), 51 | static_cast(vec_buf.size()), 52 | &dw_return, 53 | lp_overlapped)) { 54 | if (const auto dw_err_code = ::GetLastError(); dw_err_code != ERROR_IO_PENDING) 55 | throw i_file_exception(L"Error WriteFile", dw_err_code); 56 | } 57 | 58 | return dw_return; 59 | } 60 | 61 | /** 62 | A method for reading data to the device. 63 | \param[out] vec_buf data 64 | \param[in] LPOVERLAPPED Contains information used in asynchronous (or overlapped) input and output (I/O). 65 | \return Number of reads 66 | */ 67 | virtual DWORD read(std::vector& vec_buf, 68 | LPOVERLAPPED lp_overlapped = {}) const 69 | { 70 | 71 | DWORD dw_return = {}; 72 | 73 | if (!ReadFile(*this->h_, 74 | vec_buf.data(), 75 | static_cast(vec_buf.size()), 76 | &dw_return, 77 | lp_overlapped)) { 78 | const auto dw_err_code = ::GetLastError(); 79 | if (dw_err_code != ERROR_IO_PENDING) 80 | throw i_file_exception(L"Error ReadFile", dw_err_code); 81 | } 82 | 83 | return dw_return; 84 | } 85 | 86 | /** 87 | Return native handle 88 | \return native handle 89 | */ 90 | operator HANDLE(void) const noexcept { return *this->h_; } 91 | 92 | /** 93 | Return device size 94 | \return LARGE_INTEGER 95 | */ 96 | [[nodiscard]] virtual LARGE_INTEGER get_size(void) const = 0; 97 | 98 | virtual bool operator!(void) const noexcept { return !*this->h_; } 99 | 100 | protected: 101 | 102 | template 103 | static std::unique_ptr create(const Param& param) 104 | { 105 | std::unique_ptr u_ptr_return = std::make_unique(param); 106 | u_ptr_return->create(); 107 | return u_ptr_return; 108 | } 109 | 110 | handle h_{}; 111 | 112 | i_file(void) 113 | : h_(std::make_unique()) 114 | {} 115 | 116 | virtual i_file& create(void) = 0; 117 | }; 118 | 119 | } -------------------------------------------------------------------------------- /ved/libs/static-lib/source/interface/i_ved_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "open_file_info.h" 5 | #include "pch.h" 6 | 7 | namespace ved { 8 | 9 | /** 10 | \brief Main interface for classes that interact with the driver 11 | */ 12 | class i_ved_manager 13 | { 14 | 15 | public: 16 | i_ved_manager(const i_ved_manager& other) = delete; 17 | i_ved_manager(i_ved_manager&& other) noexcept = delete; 18 | i_ved_manager& operator=(const i_ved_manager& other) = delete; 19 | i_ved_manager& operator=(i_ved_manager&& other) noexcept = delete; 20 | virtual ~i_ved_manager(void) = default; 21 | i_ved_manager(void) = default; 22 | 23 | /** 24 | Mounting the disk to the system. 25 | \param[in] path Path to disk image (file) 26 | \param[in] password Disk image password 27 | \param[in] letter Disk letter 28 | */ 29 | virtual void mount(const std::wstring& path, 30 | const std::string& password, 31 | WCHAR letter) = 0; 32 | 33 | /** 34 | The method creates a disk image and immediately mounts it to the system. 35 | \param[in] path Path to disk image (file) 36 | \param[in] size Disk image size 37 | \param[in] password Disk image password 38 | \param[in] letter Disk letter 39 | \param[in] mode Disk image crypt mode (AES or RC4) 40 | 41 | \warning The size of the disk can be specified in kilobytes or megabytes, 42 | the class that implements this interface must determine this itself. 43 | */ 44 | virtual void mount_ex(const std::wstring& path, 45 | unsigned long long size, 46 | const std::string& password, 47 | WCHAR letter, 48 | Crypt mode) = 0; 49 | 50 | /** 51 | The method creates a disk image 52 | \param[in] path Path to disk image (file) 53 | \param[in] size Disk image size 54 | \param[in] password Disk image password 55 | \param[in] mode Disk image crypt mode (AES or RC4) 56 | 57 | \warning The size of the disk can be specified in kilobytes or megabytes, 58 | the class that implements this interface must determine this itself. 59 | */ 60 | virtual void create_file(const std::wstring& path, 61 | unsigned long long size, 62 | const std::string& password, 63 | Crypt mode) = 0; 64 | 65 | /** 66 | Unmount the disk 67 | \param[in] letter Disk letter 68 | */ 69 | virtual void un_mount(WCHAR letter) = 0; 70 | 71 | /** 72 | Registers and runs the driver on the system 73 | \param[in] flag_startup The driver launch flag. There can be several variants: 74 | SERVICE_DEMAND_START - A service started by the service control manager when a process calls the StartService function. 75 | SERVICE_AUTO_START - A service started automatically by the service control manager during system startup. 76 | \param[in] path_driver Path to the driver file. We assume it will be in System32\\Drivers\\ 77 | \param[in] name_service Driver service name 78 | */ 79 | virtual void run_driver(DWORD flag_startup = SERVICE_DEMAND_START, 80 | const std::wstring& path_driver = 81 | L"%SystemRoot%\\System32\\Drivers\\DriverVED.sys", 82 | const std::wstring& name_service = L"VEDriver") = 0; 83 | 84 | /** 85 | Returns the list of disks that are currently mounted to the system (our disks) 86 | \return std::vector 87 | */ 88 | virtual std::vector get_mounted_disks(void) = 0; 89 | 90 | /** 91 | Stop driver 92 | \param[in] device_name Driver service name 93 | */ 94 | virtual void stop_driver(const std::wstring& device_name = L"VEDriver") = 0; 95 | 96 | /** 97 | All files we create can be "sparse". They have to be copied in a special way. 98 | See also: https://en.wikipedia.org/wiki/Sparse_file 99 | \param[in] in Where to copy from 100 | \param[in] out Where to copy 101 | */ 102 | virtual void copy_image(const std::wstring& in, const std::wstring& out) = 0; 103 | 104 | /** 105 | Unmount all disks at once 106 | */ 107 | virtual void un_mount_all(void) = 0; 108 | 109 | /** 110 | Factory method 111 | */ 112 | template 113 | static std::unique_ptr create(void) 114 | { 115 | std::unique_ptr u_ptr_return = std::make_unique(); 116 | 117 | return u_ptr_return; 118 | } 119 | }; 120 | 121 | } 122 | -------------------------------------------------------------------------------- /ved/support/RegisterDriver/RegisterDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "classes/exceptions/exception.h" 2 | #include "classes/ved_manager/ved_manager.h" 3 | #include "interface/i_ved_manager.h" 4 | #include 5 | 6 | int 7 | main() 8 | { 9 | try { 10 | auto ved_manager = ved::i_ved_manager::create(); 11 | ved_manager->run_driver(SERVICE_AUTO_START); 12 | std::cout 13 | << "The driver was launched successfully!\nPress any key to continue.\n"; 14 | std::cin.get(); 15 | return 0; 16 | } 17 | catch (const ved::c_win_api_exception& error) { 18 | std::wcerr << error.GetMessageW() << std::endl; 19 | } 20 | catch (const std::exception& error) { 21 | std::cerr << error.what() << std::endl; 22 | } 23 | std::cin.get(); 24 | } 25 | -------------------------------------------------------------------------------- /ved/support/RegisterDriver/RegisterDriver.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/UserConsoleApplication.cpp: -------------------------------------------------------------------------------- 1 | #include "classes/ved_manager/ved_manager.h" 2 | #include "source/classes/engine/engine.h" 3 | 4 | int 5 | main(int argc, wchar_t** argv) 6 | { 7 | try { 8 | ved::engine::get_instance().execute(); 9 | std::wcout << "\nSuccess!" << std::endl; 10 | } 11 | 12 | catch (const ved::driver_exception& error) { 13 | std::wcout << error.GetMessageW() << std::endl; 14 | } 15 | catch (const ved::c_win_api_exception& error) { 16 | std::wcout << error.GetMessageW() << std::endl; 17 | } 18 | catch (const std::exception& error) { 19 | std::wcout << error.what() << std::endl; 20 | } 21 | catch (...) { 22 | std::wcout << "error!" << std::endl; 23 | } 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/UserConsoleApplication.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {fc089259-5e1d-4862-b1f1-37106c2954a8} 10 | 11 | 12 | {593b4006-34e0-4dfc-b0bf-17270ff4d9a9} 13 | 14 | 15 | {9587102a-a6b9-45f1-b0e6-25e02339bb02} 16 | 17 | 18 | {3842926c-db2e-4bf1-be3f-036f5fb203c0} 19 | 20 | 21 | {089483a8-8c8d-4fca-b7f6-d0c2e01313ef} 22 | 23 | 24 | 25 | 26 | Исходные файлы 27 | 28 | 29 | source\classes\comand_line_argument 30 | 31 | 32 | global_headers 33 | 34 | 35 | source\classes\engine 36 | 37 | 38 | 39 | 40 | source\classes\comand_line_argument 41 | 42 | 43 | global_headers 44 | 45 | 46 | source\classes\engine 47 | 48 | 49 | -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/global_headers/pch.cpp: -------------------------------------------------------------------------------- 1 | #include"pch.h" -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/global_headers/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/source/classes/comand_line_argument/comand_line_argument.cpp: -------------------------------------------------------------------------------- 1 | #include "comand_line_argument.h" 2 | #include "exceptions/exception.h" 3 | 4 | namespace ved { 5 | 6 | std::wstringstream 7 | command_line_argument::get_command_lines_stream() 8 | { 9 | 10 | auto n_args{ 0 }; 11 | 12 | const auto psz_arglist = CommandLineToArgvW(::GetCommandLine(), &n_args); 13 | if (!psz_arglist) 14 | throw ved::c_win_api_exception(L"Error CommandLineToArgvW", GetLastError()); 15 | 16 | std::wstringstream ss; 17 | 18 | for (auto i{ 1 }; i < n_args; i++) 19 | ss << psz_arglist[i] << L" "; 20 | 21 | ::LocalFree(psz_arglist); 22 | 23 | return ss; 24 | } 25 | 26 | std::vector 27 | command_line_argument::get_command_lines_vector(void) 28 | { 29 | 30 | auto res = ved::command_line_argument::get_command_lines_stream(); 31 | 32 | std::wstring line; 33 | std::vector data; 34 | 35 | while (res >> line) { 36 | data.emplace_back(line); 37 | } 38 | 39 | return data; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/source/classes/comand_line_argument/comand_line_argument.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | namespace ved { 5 | class command_line_argument 6 | { 7 | 8 | public: 9 | command_line_argument(void) = delete; 10 | command_line_argument(const command_line_argument&) = delete; 11 | command_line_argument(command_line_argument&&) = delete; 12 | command_line_argument& operator=(const command_line_argument&) = delete; 13 | command_line_argument& operator=(command_line_argument&&) = delete; 14 | ~command_line_argument(void) = delete; 15 | 16 | static std::wstringstream get_command_lines_stream(void); 17 | static std::vector get_command_lines_vector(void); 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /ved/user-program/ConsoleInterface/UserConsoleApplication/source/classes/engine/engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "classes/ved_manager/ved_manager.h" 3 | 4 | namespace ved { 5 | 6 | class engine 7 | { 8 | using uptr_ved_manager = std::unique_ptr; 9 | 10 | public: 11 | enum class Param 12 | { 13 | 14 | }; 15 | engine(const engine& other) = delete; 16 | engine(engine&& other) noexcept = delete; 17 | engine& operator=(const engine& other) = delete; 18 | engine& operator=(engine&& other) noexcept = delete; 19 | 20 | static engine& get_instance(void) 21 | { 22 | static engine engine_; 23 | return engine_; 24 | } 25 | 26 | void set_manager(uptr_ved_manager& manager) 27 | { 28 | this->ved_manager_ = std::move(manager); 29 | } 30 | 31 | void execute(void); 32 | 33 | private: 34 | void set_arguments(void); 35 | 36 | void mount(void); 37 | void create_and_mount(void); 38 | void un_mount(void); 39 | void create_file(void); 40 | void start_driver(void); 41 | void stop_driver(void) const; 42 | void help(void) const; 43 | void show_mounted_disks(void) const; 44 | void copy(void); 45 | 46 | std::map> functions_ = { 47 | 48 | { L"-mount", &engine::mount }, 49 | { L"-camount", &engine::create_and_mount }, 50 | { L"-unmount", &engine::un_mount }, 51 | { L"-create", &engine::create_file }, 52 | { L"-start", &engine::start_driver }, 53 | { L"-stop", &engine::stop_driver }, 54 | { L"-help", &engine::help }, 55 | { L"-show", &engine::show_mounted_disks }, 56 | { L"-copy", &engine::copy } 57 | 58 | }; 59 | 60 | std::wstringstream arguments_stream_{}; 61 | uptr_ved_manager ved_manager_; 62 | 63 | engine(void) 64 | : ved_manager_(ved::i_ved_manager::create()) 65 | {} 66 | ~engine(void) = default; 67 | }; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /ved/user-program/GUI/GUI.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | CONFIG += c++17 6 | win32:RC_ICONS += release\icon\1.ico 7 | 8 | # The following define makes your compiler emit warnings if you use 9 | # any Qt feature that has been marked deprecated (the exact warnings 10 | # depend on your compiler). Please consult the documentation of the 11 | # deprecated API in order to know how to port your code away from it. 12 | DEFINES += QT_DEPRECATED_WARNINGS 13 | 14 | # You can also make your code fail to compile if it uses deprecated APIs. 15 | # In order to do so, uncomment the following line. 16 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 17 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 18 | 19 | SOURCES += \ 20 | copy.cpp \ 21 | createnew.cpp \ 22 | main.cpp \ 23 | mainwindow.cpp \ 24 | mount.cpp 25 | 26 | HEADERS += \ 27 | copy.h \ 28 | createnew.h \ 29 | mainwindow.h \ 30 | mount.h 31 | 32 | FORMS += \ 33 | copy.ui \ 34 | createnew.ui \ 35 | mainwindow.ui \ 36 | mount.ui 37 | 38 | # Default rules for deployment. 39 | 40 | win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../bin/Lib/Win32/release/ -lLib 41 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../bin/Lib/Win32/debug/ -lLib 42 | 43 | INCLUDEPATH += $$PWD/../../Lib 44 | DEPENDPATH += $$PWD/../../Lib 45 | 46 | win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../bin/Lib/Win32/release/libLib.a 47 | else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../bin/Lib/Win32/debug/libLib.a 48 | else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../bin/Lib/Win32/release/Lib.lib 49 | else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../bin/Lib/Win32/debug/Lib.lib 50 | 51 | 52 | #win32: LIBS += -lntdll 53 | #win32: LIBS += -lAdvapi32 54 | 55 | #win32: LIBS += -lntdll 56 | 57 | 58 | win64: LIBS += -lntdll 59 | 60 | 61 | 62 | win32: LIBS += -lntdll32 63 | 64 | win32: LIBS += -lAdvAPI86 65 | 66 | DISTFILES += \ 67 | release/icon/1.png 68 | -------------------------------------------------------------------------------- /ved/user-program/GUI/GUI_resource.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | IDI_ICON1 ICON DISCARDABLE "C:\\Users\\Dimon\\Documents\\GitHub\\cpp-2019-2_VED\\ved\\UserPrograms\\GUI no connect\\release\\icon\\1.ico" 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION 0,0,0,0 7 | PRODUCTVERSION 0,0,0,0 8 | FILEFLAGSMASK 0x3fL 9 | #ifdef _DEBUG 10 | FILEFLAGS VS_FF_DEBUG 11 | #else 12 | FILEFLAGS 0x0L 13 | #endif 14 | FILEOS VOS__WINDOWS32 15 | FILETYPE VFT_DLL 16 | FILESUBTYPE 0x0L 17 | BEGIN 18 | BLOCK "StringFileInfo" 19 | BEGIN 20 | BLOCK "040904b0" 21 | BEGIN 22 | VALUE "CompanyName", "\0" 23 | VALUE "FileDescription", "\0" 24 | VALUE "FileVersion", "0.0.0.0\0" 25 | VALUE "LegalCopyright", "\0" 26 | VALUE "OriginalFilename", "GUI.exe\0" 27 | VALUE "ProductName", "GUI\0" 28 | VALUE "ProductVersion", "0.0.0.0\0" 29 | END 30 | END 31 | BLOCK "VarFileInfo" 32 | BEGIN 33 | VALUE "Translation", 0x0409, 1200 34 | END 35 | END 36 | /* End of Version info */ 37 | 38 | -------------------------------------------------------------------------------- /ved/user-program/GUI/copy.cpp: -------------------------------------------------------------------------------- 1 | #include "copy.h" 2 | #include "ui_copy.h" 3 | #include 4 | 5 | Copy::Copy(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::Copy) 8 | { 9 | ui->setupUi(this); 10 | ui->label->setVisible(false); 11 | } 12 | 13 | Copy::~Copy() 14 | { 15 | delete ui; 16 | } 17 | 18 | void Copy::on_Ok_clicked() 19 | { 20 | 21 | 22 | try { 23 | 24 | if(ui->Dir->text().isEmpty()||ui->File->text().isEmpty()){ 25 | ui->label->setVisible(true); 26 | return; 27 | } 28 | 29 | this->ui->label->setText("Process..."); 30 | this->ui->label->setVisible(true); 31 | 32 | MainWindow::uptr_ved_manager_->copy_image( 33 | this->ui->File->text().replace('/','\\').toStdWString(), 34 | this->ui->Dir->text().replace('/','\\').toStdWString()); 35 | 36 | this->message_.setText("Success!"); 37 | 38 | this->message_.exec(); 39 | 40 | close(); 41 | 42 | 43 | } 44 | catch (const ved::c_win_api_exception & error) { 45 | 46 | this->message_.critical( 47 | nullptr, 48 | "Error" 49 | ,QString::fromWCharArray(error.GetMessageW().c_str())); 50 | 51 | 52 | } 53 | catch(const std::exception & error){ 54 | 55 | this->message_.critical( 56 | nullptr, 57 | "Error" 58 | ,QString::fromUtf8(error.what())); 59 | 60 | } 61 | 62 | 63 | } 64 | 65 | void Copy::on_Cancel_clicked() 66 | { 67 | close(); 68 | } 69 | 70 | void Copy::on_PathButton_clicked() 71 | { 72 | ui->File->setText(QFileDialog::getOpenFileName(this, "Get Any File","C://")); 73 | } 74 | 75 | void Copy::on_PathButton_2_clicked() 76 | { 77 | ui->Dir->setText(QFileDialog::getSaveFileName(this, "Get Any File","C://")); 78 | } 79 | -------------------------------------------------------------------------------- /ved/user-program/GUI/copy.h: -------------------------------------------------------------------------------- 1 | #ifndef COPY_H 2 | #define COPY_H 3 | 4 | #include 5 | #include "mainwindow.h" 6 | #include "source/classes/exceptions/exception.h" 7 | 8 | namespace Ui { 9 | class Copy; 10 | } 11 | 12 | class Copy : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit Copy(QWidget *parent = nullptr); 18 | ~Copy(); 19 | 20 | signals: 21 | void signalToTable(); 22 | 23 | private slots: 24 | void on_Ok_clicked(); 25 | 26 | void on_Cancel_clicked(); 27 | 28 | void on_PathButton_clicked(); 29 | 30 | void on_PathButton_2_clicked(); 31 | 32 | private: 33 | Ui::Copy *ui; 34 | QMessageBox message_; 35 | 36 | }; 37 | 38 | #endif // COPY_H 39 | -------------------------------------------------------------------------------- /ved/user-program/GUI/copy.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Copy 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 125 11 | 12 | 13 | 14 | Copy File 15 | 16 | 17 | false 18 | 19 | 20 | 21 | 22 | 10 23 | 10 24 | 381 25 | 77 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | ... 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ... 46 | 47 | 48 | 49 | 50 | 51 | 52 | File 53 | 54 | 55 | 56 | 57 | 58 | 59 | To 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 220 69 | 90 70 | 75 71 | 23 72 | 73 | 74 | 75 | Ok 76 | 77 | 78 | 79 | 80 | 81 | 310 82 | 90 83 | 75 84 | 23 85 | 86 | 87 | 88 | Cancel 89 | 90 | 91 | 92 | 93 | true 94 | 95 | 96 | 97 | 10 98 | 90 99 | 88 100 | 16 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 255 110 | 0 111 | 0 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 255 121 | 0 122 | 0 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 120 132 | 120 133 | 120 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | *Fill in all the fields 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /ved/user-program/GUI/createnew.cpp: -------------------------------------------------------------------------------- 1 | #include "createnew.h" 2 | #include "ui_createnew.h" 3 | #include 4 | #include "source/classes/exceptions/exception.h" 5 | #include 6 | 7 | CreateNew::CreateNew(QWidget *parent) : 8 | QDialog(parent), 9 | ui(new Ui::CreateNew) 10 | { 11 | ui->setupUi(this); 12 | ui->Crypt->addItem("RC4"); 13 | ui->Crypt->addItem("AEC"); 14 | ui->label->setVisible(false); 15 | } 16 | 17 | CreateNew::~CreateNew() 18 | { 19 | delete ui; 20 | } 21 | 22 | void CreateNew::on_Ok_clicked() 23 | { 24 | try { 25 | 26 | 27 | if(ui->Path->text().isEmpty()||ui->Password->text().isEmpty()||this->ui->spinBox->text().toULongLong() < 10){ 28 | ui->label->setVisible(true); 29 | return; 30 | } 31 | 32 | 33 | int mode = this->ui->Crypt->itemData(this->ui->Crypt->currentIndex()+1).toInt(); 34 | 35 | 36 | 37 | MainWindow::uptr_ved_manager_->create_file( 38 | ui->Path->text().replace('/','\\').toStdWString(), 39 | this->ui->spinBox->text().toULongLong() * 1024 * 1024, 40 | ui->Password->text().toStdString(), 41 | static_cast(++mode) 42 | ); 43 | 44 | this->message_.setText("Success!"); 45 | this->message_.exec(); 46 | 47 | close(); 48 | 49 | 50 | } 51 | catch (const ved::c_win_api_exception & error) { 52 | 53 | 54 | this->message_.critical( 55 | nullptr, 56 | "Error" 57 | ,QString::fromWCharArray(error.GetMessageW().c_str())); 58 | 59 | 60 | } 61 | catch(const std::exception & error){ 62 | 63 | 64 | this->message_.critical( 65 | nullptr, 66 | "Error" 67 | ,QString::fromUtf8(error.what())); 68 | 69 | } 70 | 71 | } 72 | 73 | void CreateNew::on_Cancel_clicked() 74 | { 75 | close(); 76 | } 77 | 78 | void CreateNew::on_PathButton_clicked() 79 | { 80 | ui->Path->setText(QFileDialog::getSaveFileName(this, "Get Any File","C://")); 81 | } 82 | -------------------------------------------------------------------------------- /ved/user-program/GUI/createnew.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATENEW_H 2 | #define CREATENEW_H 3 | 4 | #include 5 | #include "mainwindow.h" 6 | 7 | namespace Ui { 8 | class CreateNew; 9 | } 10 | 11 | class CreateNew : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit CreateNew(QWidget *parent = nullptr); 17 | ~CreateNew(); 18 | 19 | signals: 20 | void signalToTable(); 21 | 22 | private slots: 23 | void on_Ok_clicked(); 24 | 25 | void on_Cancel_clicked(); 26 | 27 | void on_PathButton_clicked(); 28 | private: 29 | Ui::CreateNew *ui; 30 | QMessageBox message_; 31 | }; 32 | 33 | #endif // CREATENEW_H 34 | -------------------------------------------------------------------------------- /ved/user-program/GUI/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication a(argc, argv); 9 | MainWindow w; 10 | w.setFixedSize(650,280); 11 | w.show(); 12 | 13 | return a.exec(); 14 | } 15 | -------------------------------------------------------------------------------- /ved/user-program/GUI/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "source/interface/i_ved_manager.h" 11 | 12 | QT_BEGIN_NAMESPACE 13 | namespace Ui { class MainWindow; } 14 | QT_END_NAMESPACE 15 | 16 | class MainWindow : public QMainWindow 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | 22 | static std::unique_ptr uptr_ved_manager_; 23 | MainWindow(QWidget *parent = nullptr); 24 | ~MainWindow(); 25 | 26 | signals: 27 | void signalToTable(); 28 | 29 | private slots: 30 | 31 | void on_RunD_clicked(); 32 | 33 | void on_Create_clicked(); 34 | 35 | void on_Copy_clicked(); 36 | 37 | void on_Mount_clicked(); 38 | 39 | void CreateTable(); 40 | 41 | void on_StopD_clicked(); 42 | 43 | void on_Unmount_clicked(); 44 | 45 | void on_Refresh_clicked(); 46 | 47 | void on_pushButton_clicked(); 48 | 49 | void on_pushButton_2_clicked(); 50 | 51 | private: 52 | 53 | void update_table(void); 54 | 55 | Ui::MainWindow *ui; 56 | QMessageBox message_; 57 | 58 | QStandardItemModel *smodel{}; 59 | 60 | 61 | }; 62 | #endif // MAINWINDOW_H 63 | -------------------------------------------------------------------------------- /ved/user-program/GUI/mount.cpp: -------------------------------------------------------------------------------- 1 | #include "mount.h" 2 | #include "ui_mount.h" 3 | #include 4 | 5 | Mount::Mount(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::Mount) 8 | { 9 | ui->setupUi(this); 10 | ui->label->setVisible(false); 11 | this->ui->Letter->setValidator(new QRegExpValidator(QRegExp("[A-Z]+"), this)); 12 | } 13 | 14 | Mount::~Mount() 15 | { 16 | delete ui; 17 | } 18 | 19 | void Mount::on_PathButton_clicked() 20 | { 21 | ui->PathToFile->setText(QFileDialog::getOpenFileName(this, "Get Any File","C://")); 22 | } 23 | 24 | void Mount::on_Ok_clicked() 25 | { 26 | 27 | try { 28 | 29 | if(ui->PathToFile->text().isEmpty()||ui->Password->text().isEmpty()||this->ui->Letter->text().isEmpty()){ 30 | ui->label->setVisible(true); 31 | return; 32 | } 33 | 34 | if(!iswalpha(this->ui->Letter->text().toStdWString()[0])){ 35 | 36 | this->message_.critical( 37 | nullptr, 38 | "Error" 39 | ,"Drive letter cannot be that value"); 40 | return; 41 | 42 | } 43 | 44 | MainWindow::uptr_ved_manager_->mount( 45 | this->ui->PathToFile->text().replace('/','\\').toStdWString(), 46 | this->ui->Password->text().toStdString(), 47 | this->ui->Letter->text().toStdWString()[0] 48 | ); 49 | 50 | this->message_.setText("Success!"); 51 | this->message_.exec(); 52 | emit signalToTable(); 53 | close(); 54 | 55 | } 56 | catch (const ved::c_win_api_exception & error) { 57 | 58 | 59 | this->message_.critical( 60 | nullptr, 61 | "Error" 62 | ,QString::fromWCharArray(error.GetMessageW().c_str())); 63 | 64 | 65 | } 66 | catch(const std::exception & error){ 67 | 68 | this->message_.critical( 69 | nullptr, 70 | "Error" 71 | ,QString::fromUtf8(error.what())); 72 | 73 | } 74 | 75 | } 76 | 77 | void Mount::on_Cancel_clicked() 78 | { 79 | close(); 80 | } 81 | -------------------------------------------------------------------------------- /ved/user-program/GUI/mount.h: -------------------------------------------------------------------------------- 1 | #ifndef MOUNT_H 2 | #define MOUNT_H 3 | 4 | #include 5 | #include 6 | #include "mainwindow.h" 7 | #include "source/classes/exceptions/exception.h" 8 | 9 | namespace Ui { 10 | class Mount; 11 | } 12 | 13 | class Mount : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit Mount(QWidget *parent = nullptr); 19 | ~Mount(); 20 | 21 | signals: 22 | void signalToTable(); 23 | 24 | private slots: 25 | void on_PathButton_clicked(); 26 | 27 | void on_Ok_clicked(); 28 | 29 | void on_Cancel_clicked(); 30 | 31 | private: 32 | Ui::Mount *ui; 33 | QMessageBox message_; 34 | }; 35 | 36 | #endif // MOUNT_H 37 | -------------------------------------------------------------------------------- /ved/user-program/WPF-GUI/GUI/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ved/user-program/WPF-GUI/GUI/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace GUI 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | private void App_OnExit(object sender, ExitEventArgs e) 17 | { 18 | //throw new NotImplementedException(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ved/user-program/WPF-GUI/GUI/ApplicationSettings.cs: -------------------------------------------------------------------------------- 1 |  2 | using System.Collections.Generic; 3 | using System.IO; 4 | using GUI.View; 5 | using Newtonsoft.Json; 6 | 7 | namespace GUI 8 | { 9 | internal class ApplicationSettings 10 | { 11 | public string FilePath { get; set; } = "Setting.json"; 12 | 13 | private static string ToJson(List disks) => JsonConvert.SerializeObject(disks); 14 | private static List FromJson(string data) => JsonConvert.DeserializeObject>(data); 15 | private void SaveToFile(string data) => File.WriteAllText(this.FilePath, data); 16 | private string LoadFile() => File.ReadAllText(this.FilePath); 17 | 18 | public void SaveDisks(List disks) => this.SaveToFile(ToJson(disks)); 19 | 20 | public List LoadDisks() => !File.Exists(this.FilePath) ? new List() : FromJson(LoadFile()); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ved/user-program/WPF-GUI/GUI/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /ved/user-program/WPF-GUI/GUI/GUI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net5.0-windows 6 | true 7 | YzyDDxS.ico 8 | 9 | 10 | 11 | 2 12 | C:\Users\dev\Documents\GitHub\VED-v2\ved\bin\WPF-GUI-RELEASE\ 13 | 14 | 15 | 16 | C:\Users\dev\Documents\GitHub\VED-v2\ved\bin\WPF-GUI-DEBUG\ 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ved/user-program/WPF-GUI/GUI/MountDisk.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 38 |