From 93be7d4abfd4233228f58ee1fbbcd76d91be66a4 Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Sat, 16 Jul 2022 00:00:00 +0000 Subject: 22.01 --- CPP/Windows/SecurityUtils.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'CPP/Windows/SecurityUtils.cpp') diff --git a/CPP/Windows/SecurityUtils.cpp b/CPP/Windows/SecurityUtils.cpp index 8a7f45c..ede83fa 100644 --- a/CPP/Windows/SecurityUtils.cpp +++ b/CPP/Windows/SecurityUtils.cpp @@ -4,6 +4,9 @@ #include "SecurityUtils.h" +#define MY_CAST_FUNC (void(*)()) +// #define MY_CAST_FUNC + namespace NWindows { namespace NSecurity { @@ -50,8 +53,10 @@ static void MyLookupSids(CPolicy &policy, PSID ps) } */ +extern "C" { + #ifndef _UNICODE -typedef BOOL (WINAPI * LookupAccountNameWP)( +typedef BOOL (WINAPI * Func_LookupAccountNameW)( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, @@ -62,13 +67,17 @@ typedef BOOL (WINAPI * LookupAccountNameWP)( ); #endif +} + static PSID GetSid(LPWSTR accountName) { #ifndef _UNICODE HMODULE hModule = GetModuleHandle(TEXT("Advapi32.dll")); if (hModule == NULL) return NULL; - LookupAccountNameWP lookupAccountNameW = (LookupAccountNameWP)GetProcAddress(hModule, "LookupAccountNameW"); + Func_LookupAccountNameW lookupAccountNameW = (Func_LookupAccountNameW) + MY_CAST_FUNC + GetProcAddress(hModule, "LookupAccountNameW"); if (lookupAccountNameW == NULL) return NULL; #endif -- cgit v1.2.3-55-g6feb