{"id":28717225,"url":"https://github.com/binracer/yanlib","last_synced_at":"2026-04-30T03:42:10.618Z","repository":{"id":299064919,"uuid":"1001886336","full_name":"BinRacer/YanLib","owner":"BinRacer","description":"YanLib is a Windows runtime library implemented in C++ based on the RAII paradigm, delivering fully automatic resource management while maintaining high performance and security.","archived":false,"fork":false,"pushed_at":"2025-06-14T12:15:43.000Z","size":2221,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-14T13:24:58.580Z","etag":null,"topics":["cpp17","gui-lib","gui-library","library","win32","win32api","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BinRacer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-14T08:43:12.000Z","updated_at":"2025-06-14T12:15:45.000Z","dependencies_parsed_at":"2025-06-14T13:25:10.588Z","dependency_job_id":"64dc3431-0e26-4b17-a4ef-5a10f5eec019","html_url":"https://github.com/BinRacer/YanLib","commit_stats":null,"previous_names":["binracer/yanlib"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BinRacer/YanLib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinRacer%2FYanLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinRacer%2FYanLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinRacer%2FYanLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinRacer%2FYanLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BinRacer","download_url":"https://codeload.github.com/BinRacer/YanLib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinRacer%2FYanLib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259914929,"owners_count":22931334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp17","gui-lib","gui-library","library","win32","win32api","windows"],"created_at":"2025-06-15T03:13:50.053Z","updated_at":"2026-04-30T03:42:10.576Z","avatar_url":"https://github.com/BinRacer.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"```text                \n                                                                                     bbbbbbbb            \nYYYYYYY       YYYYYYY                                 LLLLLLLLLLL               iiii b::::::b            \nY:::::Y       Y:::::Y                                 L:::::::::L              i::::ib::::::b            \nY:::::Y       Y:::::Y                                 L:::::::::L               iiii b::::::b            \nY::::::Y     Y::::::Y                                 LL:::::::LL                     b:::::b            \nYYY:::::Y   Y:::::YYYaaaaaaaaaaaaa  nnnn  nnnnnnnn      L:::::L               iiiiiii b:::::bbbbbbbbb    \n   Y:::::Y Y:::::Y   a::::::::::::a n:::nn::::::::nn    L:::::L               i:::::i b::::::::::::::bb  \n    Y:::::Y:::::Y    aaaaaaaaa:::::an::::::::::::::nn   L:::::L                i::::i b::::::::::::::::b \n     Y:::::::::Y              a::::ann:::::::::::::::n  L:::::L                i::::i b:::::bbbbb:::::::b\n      Y:::::::Y        aaaaaaa:::::a  n:::::nnnn:::::n  L:::::L                i::::i b:::::b    b::::::b\n       Y:::::Y       aa::::::::::::a  n::::n    n::::n  L:::::L                i::::i b:::::b     b:::::b\n       Y:::::Y      a::::aaaa::::::a  n::::n    n::::n  L:::::L                i::::i b:::::b     b:::::b\n       Y:::::Y     a::::a    a:::::a  n::::n    n::::n  L:::::L         LLLLLL i::::i b:::::b     b:::::b\n       Y:::::Y     a::::a    a:::::a  n::::n    n::::nLL:::::::LLLLLLLLL:::::Li::::::ib:::::bbbbbb::::::b\n    YYYY:::::YYYY  a:::::aaaa::::::a  n::::n    n::::nL::::::::::::::::::::::Li::::::ib::::::::::::::::b \n    Y:::::::::::Y   a::::::::::aa:::a n::::n    n::::nL::::::::::::::::::::::Li::::::ib:::::::::::::::b  \n    YYYYYYYYYYYYY    aaaaaaaaaa  aaaa nnnnnn    nnnnnnLLLLLLLLLLLLLLLLLLLLLLLLiiiiiiiibbbbbbbbbbbbbbbb                                                                                                     \n```\n\n[![license](https://img.shields.io/badge/license-MIT-blue)](https://img.shields.io/badge/license-MIT-blue)\n[![C++17](https://img.shields.io/badge/C++-17-blue)](https://img.shields.io/badge/C++-17-blue)\n[![CMake](https://img.shields.io/badge/CMake-v3.30-blue)](https://img.shields.io/badge/CMake-v3.30-blue)\n[![GoogleTest](https://img.shields.io/badge/GoogleTest-v1.16.0-blue)](https://img.shields.io/badge/GoogleTest-v1.16.0-blue)\n[![Platform](https://img.shields.io/badge/Platform-Windows-blue)](https://img.shields.io/badge/Platform-Windows-blue)\n\n**YanLib** is a Windows runtime library implemented in **C++** based on the **RAII** paradigm,\ndelivering fully automatic resource management while maintaining high performance and security.\n\nThe library currently encompasses seven core modules essential for **Win32** development:\n**crypto**, **hash**, **io**, **mem**, **sync**, **sys**, and **ui**.\n\nThe **ui** module further includes three submodules: **core**, **gdi**, and **components**,\nprimarily responsible for Windows graphical interface handling.\n\n## 🤔Why Create?\n\nDespite undergoing several iterations across Windows operating systems,\nthe **Win32API** maintains exceptional compatibility and efficiency even in today's Windows 11.\nHowever, its long history has resulted in verbose **Win32API**-based code that often causes resource leaks.\nTo ensure clean and secure coding practices for myself, I conceived the idea for this project several months ago.\n\n## 💼Project Architecture\n\n```text\nsrc\n├── crypto\n├── hash\n├── helper\n├── io\n├── mem\n├── sync\n├── sys\n└── ui\n    ├── components\n    ├── core\n    └── gdi\n```\n\n## 📜Detailed Information\n\n+ 🏷️crypto module\n    + 🔖aes codec\n        - aes128\n        - aes192\n        - aes256\n    + 🔖rsa codec\n        - rsa384\n        - rsa512\n        - rsa768\n        - rsa1024\n        - rsa1536\n        - rsa2048\n        - rsa3072\n        - rsa4096\n        - rsa8192\n        - rsa16384\n    + 🔖base codec\n        - base16\n        - base32\n        - base58\n        - base62\n        - base64\n        - base85\n        - base91\n        - base92\n        - base100\n    + 🔖other codec\n        - vigenere\n        - uuencode\n        - xxencode\n+ 🏷️hash module\n    - md5\n    - sha1\n    - sha256\n    - sha384\n    - sha512\n+ 🏷️io module\n    - fs (File and Directory)\n    - comp_port (Completion Port)\n    - ftp (FTP Client)\n    - http (HTTP Client and HTTPS Client)\n    - tcp_server (TCP Server)\n    - tcp_client (TCP Client)\n    - udp_server (UDP Server)\n    - udp_client (UDP Client)\n+ 🏷️mem module\n    - allocate (Virtual Memory)\n    - heap (Heap Memory)\n    - mmap (Memory-Mapped)\n+ 🏷️sync module\n    - mutex\n    - rwlock (Read-Write Lock)\n    - condvar (Conditional Variable)\n    - semaphore\n    - barrier\n    - fence\n    - timer\n    - event\n+ 🏷️sys module\n    - proc (Process)\n    - thread\n    - thread_pool\n    - fiber\n    - job\n    - processor\n    - security\n    - snapshot\n+ 🏷️ui module\n    + 🔖core module\n        - keyboard\n        - mouse\n        - touch\n        - caret\n        - accelerator\n        - cursor\n        - desktop\n        - dialog\n        - menu\n        - clipboard\n        - icon\n        - image\n        - message\n        - notify\n        - window\n        - window_aware\n        - window_behavior\n        - window_class\n        - window_hook\n        - window_pos\n        - window_prop\n    + 🔖gdi module\n        + 📌Core Object\n            - dc(Device Context)\n            - coordinate\n            - palette\n        + 📌Drawing Tools\n            - pen\n            - brush\n            - font\n        + 📌Basic Graphic\n            - rect\n            - line\n            - arc\n            - bezier\n        + 📌Advance Graphic\n            - shape\n            - path\n            - region\n            - clip\n        + 📌Content Drawing\n            - text\n            - paint\n            - bitmap\n        + 📌Display Device\n            - display\n            - monitor\n        + 📌File Format\n            - meta(Enhance Meta File)\n    + 🔖components module\n        + 📌Basic Controls\n            - button\n            - edit\n            - label\n            - link\n        + 📌List Selection Controls\n            - list_box\n            - list_view\n            - combo_box\n            - tree\n        + 📌Date and Time Controls\n            - calendar\n            - datetime\n        + 📌Rich Text Control\n            - rich_edit\n        + 📌Professional Controls\n            - header\n            - hot_key\n            - ip_addr\n            - scroll\n            - track\n            - up_down\n        + 📌Progress Status Control\n            - progress\n            - status\n        + 📌Container Control\n            - page\n            - property\n            - rebar\n            - tab\n        + 📌Interactive Controls\n            - tool_bar\n            - tool_tips\n            - task_dialog\n        + 📌Multimedia Controls\n            - animate\n            - image_list\n        + 📌Other Control\n            - general\n\n## 🤔How to Use？\n\n### Prepare the Environment\n\nInstall and configure **git-bash**, **clang-format**, **code editor** (**Visual Studio**, **Visual Studio Code**,\n**Clion**, etc.), **CMake**, **MSVC compiler**.\n\n### Build Source Code\n\nAll set. Proceed with the following steps:\n\n```shell\ngit clone https://github.com/BinRacer/YanLib.git\ncd YanLib\n# Build and Run Debug\nmkdir cmake-build-debug\ncmake -S . -B cmake-build-debug\ncmake --build cmake-build-debug --config Debug --target YanLib\ncmake --build cmake-build-debug --config Debug\nctest --test-dir cmake-build-debug/test --output-on-failure -C Debug\n# Build and Run Release\nmkdir cmake-build-release\ncmake -S . -B cmake-build-release\ncmake --build cmake-build-release --config Release --target YanLib\ncmake --build cmake-build-release --config Release\nctest --test-dir cmake-build-release/test --output-on-failure -C Release\n```\n\nAfter passing the tests, inspect the **build** and **dist** directories generated during the compilation.\nThe **build** directory contains public header files and library files,\nwhile the **dist** directory stores the zipped archive of the build directory.\n\n### Example\n\nUnless otherwise specified, **Visual Studio** will be used as the code editor.\n\n1. Open **Visual Studio 2022** code editor, select the **Windows Desktop Wizard**,\n   and set the project name to **HelloWorld**.\n   ![step01.png](images/HelloWorld/step01.png)\n\n2. Select the **HelloWorld** project, right-click it, and choose **Properties** from the context menu.\n   Navigate to **Configuration Properties \u003e General \u003e C++ Language Standard** and set it to **ISO C++17 Standard (/std:\n   c++17)**.\n   Then go to **Configuration Properties \u003e General \u003e C Language Standard** and select **ISO C17 (2018) Standard (/std:\n   c17)**.\n   ![step02.png](images/HelloWorld/step02.png)\n\n3. Navigate to **Configuration Properties \u003e Advanced \u003e Character Set** and select **Use Unicode Character Set**.\n   ![step03.png](images/HelloWorld/step03.png)\n\n4. Navigate to **Configuration Properties \u003e C/C++ \u003e General**, select **Additional Include Directories**, click the Edit\n   button, and add the full path to the generated header files directory – specifically **build\\include**.\n   ![step04.png](images/HelloWorld/step04.png)\n\n5. Navigate to **Configuration Properties \u003e Linker \u003e General**, select **Additional Library Directories**, click the\n   Edit button, and add the full path to the generated library directory – specifically **build\\lib\\Debug**.\n   ![step05.png](images/HelloWorld/step05.png)\n\n6. Navigate to **Configuration Properties \u003e Linker \u003e Input**, select **Additional Dependencies**, click the Edit button,\n   and add the built library filename: **YanLibd.lib**.\n   ![step06.png](images/HelloWorld/step06.png)\n\n7. After completing the file modifications above, save your changes by clicking Apply followed by OK to ensure\n   configuration updates take effect. Then clear the content of the auto-generated HelloWorld.cpp file and replace it\n   with the following code:\n\n```c++\n// HelloWorld.cpp : Defines the entry point for the application.\n//\n\n#include \"framework.h\"\n#include \"HelloWorld.h\"\n#include \u003chash/sha1.h\u003e\n#include \u003chelper/convert.h\u003e\nnamespace hash = YanLib::hash;\nnamespace helper = YanLib::helper;\n\nint APIENTRY wWinMain(_In_ HINSTANCE hInstance,\n                     _In_opt_ HINSTANCE hPrevInstance,\n                     _In_ LPWSTR    lpCmdLine,\n                     _In_ int       nCmdShow)\n{\n    UNREFERENCED_PARAMETER(hPrevInstance);\n    UNREFERENCED_PARAMETER(lpCmdLine);\n\n    auto data_str = L\"Hello World!你好世界\";\n    auto convert = helper::convert::wstr_to_str(data_str,\n        helper::CodePage::UTF8);\n    hash::sha1 sha1(convert);\n    auto result = sha1.hash_wstring();\n    MessageBox(NULL, result.data(), L\"Hello World!你好世界 SHA1：\", MB_OK);\n}\n```\n\nSelect the Solution in Solution Explorer, right-click it, and choose **Rebuild Solution**. Then navigate to the Debug\nmenu and select **Start Without Debugging** 🎉 – alternatively, press **Ctrl+F5**.\n\n![step07.png](images/HelloWorld/step07.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinracer%2Fyanlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinracer%2Fyanlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinracer%2Fyanlib/lists"}