[Commits] defs.h 1.9.2.62 1.9.2.63 w32_account.c 1.1.2.2 1.1.2.3

colin at claws-mail.org colin at claws-mail.org
Sat Feb 16 11:35:16 CET 2013


Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv19571/src/common

Modified Files:
      Tag: gtk2
	defs.h w32_account.c 
Log Message:
2013-02-16 [colin]	3.9.0cvs70

	* src/main.c
	* src/prefs_common.c
	* src/prefs_common.h
	* src/common/defs.h
	* src/common/w32_account.c
		Add an hidden preference to set the Windows theme
	* src/plugins/Makefile.am
	* src/plugins/rssyl/Makefile.am
	* src/plugins/rssyl/claws.def
	* src/plugins/rssyl/date.c
	* src/plugins/rssyl/date.h
	* src/plugins/rssyl/feed.c
	* src/plugins/rssyl/feed.h
	* src/plugins/rssyl/feedprops.c
	* src/plugins/rssyl/feedprops.h
	* src/plugins/rssyl/opml.c
	* src/plugins/rssyl/opml.h
	* src/plugins/rssyl/parsers.c
	* src/plugins/rssyl/parsers.h
	* src/plugins/rssyl/placeholder.txt
	* src/plugins/rssyl/plugin.c
	* src/plugins/rssyl/plugin.def
	* src/plugins/rssyl/rssyl.c
	* src/plugins/rssyl/rssyl.h
	* src/plugins/rssyl/rssyl_cb_gtk.c
	* src/plugins/rssyl/rssyl_cb_gtk.h
	* src/plugins/rssyl/rssyl_cb_menu.c
	* src/plugins/rssyl/rssyl_cb_menu.h
	* src/plugins/rssyl/rssyl_gtk.c
	* src/plugins/rssyl/rssyl_gtk.h
	* src/plugins/rssyl/rssyl_prefs.c
	* src/plugins/rssyl/rssyl_prefs.h
	* src/plugins/rssyl/strreplace.c
	* src/plugins/rssyl/strreplace.h
	* src/plugins/rssyl/version.rc
		Add RSSyl
	* src/plugins/vcalendar/Makefile.am
	* src/plugins/vcalendar/Makefile.in
	* src/plugins/vcalendar/plugin.c
	* src/plugins/vcalendar/libical/libical/icalversion.h
		Fix Curl flags :)

Index: w32_account.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/Attic/w32_account.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- w32_account.c	9 Jan 2009 17:47:13 -0000	1.1.2.2
+++ w32_account.c	16 Feb 2013 10:35:14 -0000	1.1.2.3
@@ -36,8 +36,11 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <windows.h>
+#include <sddl.h> // for ConvertSidToStringSid()
 
 #include "w32lib.h"
+#include "utils.h"
 
 #ifndef DIM
 #define DIM(v)  (sizeof(v)/sizeof((v)[0]))
@@ -147,3 +150,62 @@
   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;
+}

Index: defs.h
===================================================================
RCS file: /home/claws-mail/claws/src/common/defs.h,v
retrieving revision 1.9.2.62
retrieving revision 1.9.2.63
diff -u -d -r1.9.2.62 -r1.9.2.63
--- defs.h	21 Jan 2013 15:58:01 -0000	1.9.2.62
+++ defs.h	16 Feb 2013 10:35:14 -0000	1.9.2.63
@@ -112,6 +112,7 @@
 #  define ACTIONS_RC		"actionswinrc"
 #  define COMMAND_HISTORY	"command_history_win"
 #  define DEFAULT_SIGNATURE	"signature.txt"
+#  define DEFAULT_W32_GTK_THEME "MS-Windows"
 #else
 #  define ACTIONS_RC		"actionsrc"
 #  define COMMAND_HISTORY	"command_history"



More information about the Commits mailing list