Removed unused w32_get_uid_equiv() function.
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 24 Nov 2016 19:19:31 +0000 (20:19 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 24 Nov 2016 20:03:34 +0000 (21:03 +0100)
src/common/w32_account.c

index 37faa97..5bd9a0f 100644 (file)
@@ -149,63 +149,3 @@ w32_is_administrator (void)
 
   return is_admin;
 }
-
-/* Vomit bags are available under your seats */
-int w32_get_uid_equiv(void)
-{
-       HANDLE Thandle;
-       DWORD size;
-       PSID sid;
-       char *sidStr = NULL;
-       char *last_sep = NULL;
-       static int siduid = -1;
-       static BOOL (WINAPI *GetTokenInformation)(
-         HANDLE TokenHandle,
-         TOKEN_INFORMATION_CLASS TokenInformationClass,
-         LPVOID TokenInformation,
-         DWORD TokenInformationLength,
-         PDWORD ReturnLength
-       );
-       static  BOOL (WINAPI *ConvertSidToStringSid)(
-         PSID Sid,
-         LPTSTR *StringSid
-       );
-       static int TokenLogonSid = 28 /* according to Google. */;
-
-       if (siduid == -1) {
-               void *handle = LoadLibrary ("advapi32.dll");
-               if (handle) {
-                       GetTokenInformation = GetProcAddress (handle, "GetTokenInformation");
-                       if (!GetTokenInformation) {
-                               FreeLibrary (handle);
-                               debug_print("can't resolve GetTokenInformation\n");
-                               return -1;
-                       }
-               }
-
-               if (OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &Thandle) == 0
-                   && OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &Thandle) == 0) {
-                       debug_print("OpenProcessToken error %d\n", GetLastError());
-                       return -1;
-               }
-
-               if (GetTokenInformation(Thandle, TokenLogonSid, &sid, sizeof(sid), &size) == 0) {
-                       debug_print("GetTokenInformation error %d\n", GetLastError());
-                       return -1;
-               }
-               if (ConvertSidToStringSid((PSID)sid, &sidStr) == 0) {
-                       debug_print("ConvertSidToStringSid error %d\n", GetLastError());
-                       return -1;
-               }
-
-               debug_print("SID %s\n", sidStr);
-               last_sep = strrchr(sidStr, '-');
-               if (last_sep != NULL) {
-                       last_sep++;
-                       siduid = strtol(last_sep, NULL, 10);
-                       debug_print("Using UID equivalent %d\n", siduid);
-               }
-               LocalFree(sidStr);
-       }
-       return siduid;
-}