diff options
| author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-07-16 00:00:00 +0000 |
|---|---|---|
| committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2023-12-17 14:35:38 +0500 |
| commit | 93be7d4abfd4233228f58ee1fbbcd76d91be66a4 (patch) | |
| tree | 9b11631a70ca7150321838d9d6bd473e52d6684d /CPP/Windows/SecurityUtils.cpp | |
| parent | a3e1d227377188734b82f023f96f8e25dc40f3e6 (diff) | |
| download | 7zip-93be7d4abfd4233228f58ee1fbbcd76d91be66a4.tar.gz 7zip-93be7d4abfd4233228f58ee1fbbcd76d91be66a4.tar.bz2 7zip-93be7d4abfd4233228f58ee1fbbcd76d91be66a4.zip | |
22.0122.01
Diffstat (limited to 'CPP/Windows/SecurityUtils.cpp')
| -rw-r--r-- | CPP/Windows/SecurityUtils.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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 @@ | |||
| 4 | 4 | ||
| 5 | #include "SecurityUtils.h" | 5 | #include "SecurityUtils.h" |
| 6 | 6 | ||
| 7 | #define MY_CAST_FUNC (void(*)()) | ||
| 8 | // #define MY_CAST_FUNC | ||
| 9 | |||
| 7 | namespace NWindows { | 10 | namespace NWindows { |
| 8 | namespace NSecurity { | 11 | namespace NSecurity { |
| 9 | 12 | ||
| @@ -50,8 +53,10 @@ static void MyLookupSids(CPolicy &policy, PSID ps) | |||
| 50 | } | 53 | } |
| 51 | */ | 54 | */ |
| 52 | 55 | ||
| 56 | extern "C" { | ||
| 57 | |||
| 53 | #ifndef _UNICODE | 58 | #ifndef _UNICODE |
| 54 | typedef BOOL (WINAPI * LookupAccountNameWP)( | 59 | typedef BOOL (WINAPI * Func_LookupAccountNameW)( |
| 55 | LPCWSTR lpSystemName, | 60 | LPCWSTR lpSystemName, |
| 56 | LPCWSTR lpAccountName, | 61 | LPCWSTR lpAccountName, |
| 57 | PSID Sid, | 62 | PSID Sid, |
| @@ -62,13 +67,17 @@ typedef BOOL (WINAPI * LookupAccountNameWP)( | |||
| 62 | ); | 67 | ); |
| 63 | #endif | 68 | #endif |
| 64 | 69 | ||
| 70 | } | ||
| 71 | |||
| 65 | static PSID GetSid(LPWSTR accountName) | 72 | static PSID GetSid(LPWSTR accountName) |
| 66 | { | 73 | { |
| 67 | #ifndef _UNICODE | 74 | #ifndef _UNICODE |
| 68 | HMODULE hModule = GetModuleHandle(TEXT("Advapi32.dll")); | 75 | HMODULE hModule = GetModuleHandle(TEXT("Advapi32.dll")); |
| 69 | if (hModule == NULL) | 76 | if (hModule == NULL) |
| 70 | return NULL; | 77 | return NULL; |
| 71 | LookupAccountNameWP lookupAccountNameW = (LookupAccountNameWP)GetProcAddress(hModule, "LookupAccountNameW"); | 78 | Func_LookupAccountNameW lookupAccountNameW = (Func_LookupAccountNameW) |
| 79 | MY_CAST_FUNC | ||
| 80 | GetProcAddress(hModule, "LookupAccountNameW"); | ||
| 72 | if (lookupAccountNameW == NULL) | 81 | if (lookupAccountNameW == NULL) |
| 73 | return NULL; | 82 | return NULL; |
| 74 | #endif | 83 | #endif |
