From d2e5bcf2ed412c01f18b964f2e82e63888c43359 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 17 Aug 2026 10:22:37 +0800 Subject: [PATCH] feat: add wrapper for WFHasPrivilege in c++ header --- wfassoc-cdylib/cbinding/wfassoc++.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wfassoc-cdylib/cbinding/wfassoc++.h b/wfassoc-cdylib/cbinding/wfassoc++.h index df91eeb..662c13c 100644 --- a/wfassoc-cdylib/cbinding/wfassoc++.h +++ b/wfassoc-cdylib/cbinding/wfassoc++.h @@ -79,6 +79,18 @@ inline void _Check(wfassoc::WFError result) { } } +/** + * @brief Check if the current process has administrative privileges + * + * @return true if the current process has administrative privileges, false otherwise + * @throws std::runtime_error if the operation fails + */ +inline bool HasPrivilege() { + bool result = false; + _Check(wfassoc::WFHasPrivilege(&result)); + return result; +} + /** * @brief Schema object for defining a program's file association configuration *