From 661e16d0dc42c4693c597292d35b0759408e6be1 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Tue, 9 Jul 2024 16:42:05 +0530 Subject: [PATCH] feat: add set-permission-flag function --- lexfloatclient.go | 27 +++++++++++++++++++++++++++ lexfloatclient/LexFloatClient.h | 22 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/lexfloatclient.go b/lexfloatclient.go index 0862ca6..bbb5202 100644 --- a/lexfloatclient.go +++ b/lexfloatclient.go @@ -22,6 +22,8 @@ const ( LA_USER uint = 0 LA_SYSTEM uint = 1 LA_IN_MEMORY uint = 2 + LF_USER uint = 10 + LF_ALL_USERS uint = 11 ) var floatingLicenseCallbackFunction callbackType @@ -32,6 +34,31 @@ func floatingLicenseCallbackWrapper(status int) { floatingLicenseCallbackFunction(status) } } +/* + FUNCTION: SetPermissionFlag() + + PURPOSE: Sets the permission flag. + + This function must be called on every start of your program after SetHostProductId() + function in case the application allows borrowing of licenses or system wide activation. + + PARAMETERS: + * flags - depending on your application's requirements, choose one of + the following values: LF_USER, LF_ALL_USERS. + + - LF_USER: This flag indicates that the application does not require + admin or root permissions to run. + + - LF_ALL_USERS: This flag is specifically designed for Windows and should be used + for system-wide activations. + + RETURN CODES: LF_OK, LF_E_PRODUCT_ID +*/ +func SetPermissionFlag(flags uint) int { + cFlags := (C.uint)(flags) + status := C.SetPermissionFlag(cFlags) + return int(status) +} /* FUNCTION: SetHostProductId() diff --git a/lexfloatclient/LexFloatClient.h b/lexfloatclient/LexFloatClient.h index 619e290..a344f3c 100644 --- a/lexfloatclient/LexFloatClient.h +++ b/lexfloatclient/LexFloatClient.h @@ -60,6 +60,28 @@ #endif typedef void (LF_CC *CallbackType)(uint32_t); +/* + FUNCTION: SetPermissionFlag() + + PURPOSE: Sets the permission flag. + + This function must be called on every start of your program after SetHostProductId() + function in case the application allows borrowing of licenses or system wide activation. + + PARAMETERS: + * flags - depending on your application's requirements, choose one of + the following values: LF_USER, LF_ALL_USERS. + + - LF_USER: This flag indicates that the application does not require + admin or root permissions to run. + + - LF_ALL_USERS: This flag is specifically designed for Windows and should be used + for system-wide activations. + + RETURN CODES: LF_OK, LF_E_PRODUCT_ID +*/ +LEXFLOATCLIENT_API int LF_CC SetPermissionFlag(uint32_t flags); + /* FUNCTION: SetHostProductId()