[Commits] [SCM] claws branch, master, updated. 3.18.0-138-g0d164d3e2

jonathan at claws-mail.org jonathan at claws-mail.org
Thu Sep 16 02:56:30 CEST 2021


The branch, master has been updated
       via  0d164d3e260c44584e96f95df12fbea4b3466867 (commit)
       via  e0f1b46602c713c91d84c4e1929e30dbb9a01720 (commit)
       via  a1cb2c4c66fa5c36c8f3a23fc63b93a0a32d7b76 (commit)
      from  a96ead9bf3f7d4e5ae8371d95cf841b3db19607f (commit)

Summary of changes:
 src/common/Makefile.am                        |   6 +-
 src/common/log.c                              |   4 -
 src/common/socket.c                           |   1 -
 src/common/timing.h                           |   2 +-
 src/common/utils.c                            |   1 -
 src/common/w32_account.c                      | 151 -----------------
 src/common/w32_reg.c                          | 225 +++++++++++---------------
 src/{gtk/sslcertwindow.h => common/w32_reg.h} |  35 ++--
 src/common/w32_signal.c                       |  28 ----
 src/common/w32_stat.c                         |  30 ----
 src/common/w32_stdlib.c                       |  38 -----
 src/common/w32_string.c                       |  53 ------
 src/common/w32_time.c                         |  37 -----
 src/common/w32_unistd.c                       |  45 ------
 src/common/w32_wait.c                         |  28 ----
 src/common/w32lib.h                           | 224 -------------------------
 src/exporthtml.c                              |   4 -
 src/folder.c                                  |   3 -
 src/mainwindow.c                              | 130 +++++++++------
 src/mbox.c                                    |   4 -
 src/msgcache.c                                |   1 -
 src/plugins/pgpcore/passphrase.c              |   2 +-
 src/prefs_summaries.c                         |   4 -
 src/procheader.c                              |   4 -
 src/procmime.c                                |  15 +-
 src/recv.c                                    |   4 +-
 26 files changed, 207 insertions(+), 872 deletions(-)
 delete mode 100644 src/common/w32_account.c
 copy src/{gtk/sslcertwindow.h => common/w32_reg.h} (60%)
 delete mode 100644 src/common/w32_signal.c
 delete mode 100644 src/common/w32_stat.c
 delete mode 100644 src/common/w32_stdlib.c
 delete mode 100644 src/common/w32_string.c
 delete mode 100644 src/common/w32_time.c
 delete mode 100644 src/common/w32_unistd.c
 delete mode 100644 src/common/w32_wait.c
 delete mode 100644 src/common/w32lib.h


- Log -----------------------------------------------------------------
commit 0d164d3e260c44584e96f95df12fbea4b3466867
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Tue Sep 14 02:04:45 2021 -0700

    Update Windows registry code

diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index a9fcb7ea7..fb4710b60 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -15,7 +15,7 @@ noinst_LTLIBRARIES = libclawscommon.la
 
 if OS_WIN32
 arch_sources = w32_reg.c
-arch_headers = w32lib.h
+arch_headers = w32_reg.h
 else
 arch_files = 
 arch_header = 
diff --git a/src/common/w32_reg.c b/src/common/w32_reg.c
index 031b8d49c..05568ff7f 100644
--- a/src/common/w32_reg.c
+++ b/src/common/w32_reg.c
@@ -1,172 +1,127 @@
-/* w32_reg.c  - Posix emulation layer for Sylpheed (Claws)
+/*
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
  *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
- * w32lib is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
  */
 
-#include <windows.h>
+#include "w32_reg.h"
 #include "utils.h"
-#include "w32lib.h"
-
-static HKEY get_root_key_from_str(char *parent)
-{
-	HKEY rootKey = NULL;
-	if (!parent || !strlen(parent))
-		rootKey = HKEY_CURRENT_USER ;
-	else if (!strcmp(parent, "HKCR") || !strcmp(parent,"HKEY_CLASSES_ROOT"))
-		rootKey = HKEY_CLASSES_ROOT ;
-	else if (!strcmp(parent, "HKCU") || !strcmp(parent,"HKEY_CURRENT_USER"))
-		rootKey = HKEY_CURRENT_USER ;
-	else if (!strcmp(parent, "HKLM") || !strcmp(parent,"HKEY_LOCAL_MACHINE"))
-		rootKey = HKEY_LOCAL_MACHINE ;
-	else if (!strcmp(parent, "HKU")  || !strcmp(parent,"HKEY_USERS"))
-		rootKey = HKEY_USERS ;
-	else if (!strcmp(parent, "HKCC") || !strcmp(parent,"HKEY_CURRENT_CONFIG"))
-		rootKey = HKEY_CURRENT_CONFIG ;
-	return rootKey;
 
-}
-
-int write_w32_registry_string( char *parent, char *section, char *value, char *data )
+gboolean reg_set_value(HKEY root,
+	const gchar *subkey,
+	const gchar *value,
+	DWORD type,
+	const BYTE *data,
+	DWORD data_size)
 {
-	HKEY hKey, rootKey;
-	int ret;
+	DWORD ret;
+	HKEY key;
+	gchar *tmp;
 
-	rootKey = get_root_key_from_str(parent);
-	ret = RegCreateKeyEx(rootKey, section, 0, NULL, 
-		REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
+	ret = RegCreateKeyEx(root, subkey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL);
 	if (ret != ERROR_SUCCESS) {
-		debug_print("can't write key %s\\%s: %d\n", parent, section, ret);
-		return -1;
+		tmp = g_win32_error_message(ret);
+		debug_print("RegCreateKeyEx %p \"%s\" had error: \"%s\"\n", root, subkey, tmp);
+		g_free(tmp);
+		return FALSE;
 	}
-	ret = RegSetValueEx(hKey, value, 0, REG_SZ, (LPVOID)data, strlen(data)+1);
+
+	ret = RegSetValueEx(key, value, 0, type, data, data_size);
 	if (ret != ERROR_SUCCESS) {
-		RegCloseKey(hKey);
-		debug_print("can't write key %s\\%s: %d\n", parent, section, ret);
-		return -1;
+		tmp = g_win32_error_message(ret);
+		debug_print("RegSetValueEx %p \"%s\" had error: \"%s\"\n", root, subkey, tmp);
+		g_free(tmp);
 	}
-	RegCloseKey(hKey);
-	return 0;
+
+	RegCloseKey(key);
+	return (ret == ERROR_SUCCESS);
 }
 
-int write_w32_registry_dword( char *parent, char *section, char *value, int data )
+gboolean write_w32_registry_string(HKEY root,
+	const gchar *subkey,
+	const gchar *value,
+	const gchar *data)
 {
-	HKEY hKey, rootKey;
-	int ret;
-
-	rootKey = get_root_key_from_str(parent);
-	ret = RegCreateKeyEx(rootKey, section, 0, NULL, 
-		REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
-	if (ret != ERROR_SUCCESS) {
-		debug_print("can't write key %s\\%s: %d\n", parent, section, ret);
-		return -1;
-	}
-	ret = RegSetValueEx(hKey, value, 0, REG_DWORD, (LPBYTE)&data, sizeof(data));
-	if (ret != ERROR_SUCCESS) {
-		RegCloseKey(hKey);
-		debug_print("can't write key %s\\%s: %d\n", parent, section, ret);
-		return -1;
-	}
-	RegCloseKey(hKey);
-	return 0;
+	return reg_set_value(root, subkey, value, REG_SZ, (BYTE *)data, strlen(data) + 1);
 }
 
-char *read_w32_registry_string( char *parent, char *section, char *key )
+gboolean write_w32_registry_dword(HKEY root,
+	const gchar *subkey,
+	const gchar *value,
+	DWORD data)
 {
-	HKEY hKey, rootKey;
-	char *str;
-	int ret;
-
-	char buf[ MAX_PATH ];
-	DWORD bufsiz = sizeof( buf );
-
-	rootKey = get_root_key_from_str(parent);
-
-        if (!rootKey) 
-          return NULL;
-
-	str = NULL;
-	ret = RegOpenKeyEx( rootKey, section, 0, KEY_READ, &hKey );
-	if ( ERROR_SUCCESS == ret ){
-		ret = RegQueryValueEx( hKey, key, 0, NULL, 
-				(LPBYTE)buf, &bufsiz );
-		if ( ERROR_SUCCESS == ret ){
-			str = strdup( buf );
-		}
-		RegCloseKey( hKey );
-	}
-	return str;
+	return reg_set_value(root, subkey, value, REG_DWORD, (BYTE *)&data, sizeof(DWORD));
 }
 
-char *get_content_type_from_registry_with_ext( char *ext )
+gchar *read_w32_registry_string(HKEY root, const gchar *subkey, const gchar *value)
 {
-	HKEY hKey, parent;
-	int ret;
-	char buf[ MAX_PATH ];
-	DWORD bufsiz;
-	char *section, *key, *value;
-
-	if (ext == NULL)
+	HKEY hkey;
+	DWORD ret;
+	DWORD type;
+	BYTE *data;
+	DWORD data_size;
+	gchar *tmp;
+
+	if (subkey == NULL)
 		return NULL;
 
-	// parent	: HKEY_CLASSES_ROOT
-	// section	: ".txt"
-	parent = HKEY_CLASSES_ROOT;
-        section = malloc ( 1 + strlen (ext) + 1);
-        if (!section)
-          return NULL;
-        *section = '.';
-        strcpy (section+1, ext);
-
-	value = NULL;
-	while ( 1 ) {
-		ret = RegOpenKeyEx( parent, section, 0, KEY_READ, &hKey );
-		if ( ERROR_SUCCESS != ret ) {
-			// If section is not found...
-			value = NULL;
-			break;
-		}
-
-		// key		: "Content Type"
-		key = "Content Type";
-		bufsiz = sizeof( buf );
-		ret = RegQueryValueEx( hKey, key, 0, NULL, (LPBYTE)buf, &bufsiz );
-		if ( ERROR_SUCCESS == ret ) {
-			// If value is found!
-			RegCloseKey( hKey );
-			value = strdup( buf );
-			break;
-		}
+	ret = RegOpenKeyEx(root, subkey, 0, KEY_READ, &hkey);
+	if (ret != ERROR_SUCCESS) {
+		tmp = g_win32_error_message(ret);
+		debug_print("RegOpenKeyEx %p \"%s\" had error: \"%s\"\n", root, subkey, tmp);
+		g_free(tmp);
+		return NULL;
+	}
 
-		key = "";
-		bufsiz = sizeof( buf );
-		ret = RegQueryValueEx( hKey, key, 0, NULL, (LPBYTE)buf, &bufsiz );
-		if ( ERROR_SUCCESS != ret ) {
-			RegCloseKey( hKey );
-			value = NULL;
-			break;
-		}
+	// Get the needed buffer size
+	ret = RegQueryValueEx(hkey, value, 0, &type, NULL, &data_size);
+	if (ret != ERROR_SUCCESS) {
+		tmp = g_win32_error_message(ret);
+		debug_print("RegQueryValueEx %p \"%s\" \"%s\" had error: \"%s\" when getting buffer size\n",
+			root, subkey, value, tmp);
+		RegCloseKey(hkey);
+		g_free(tmp);
+		return NULL;
+	} else if (type != REG_SZ) {
+		debug_print("RegQueryValueEx %p \"%s\" \"%s\" returned type %lu instead of REG_SZ\n",
+			root, subkey, value, type);
+		RegCloseKey(hkey);
+		return NULL;
+	} else if (data_size == 0) {
+		debug_print("RegQueryValueEx %p \"%s\" \"%s\" returned data size 0\n",
+			root, subkey, value);
+		RegCloseKey(hkey);
+		return NULL;
+	}
 
-		RegCloseKey( hKey );
-		free( section );
-		section = strdup( buf );
-                break; //XXX:tm-gtk2
+	// The raw value is not necessarily NUL-terminated
+	data = g_malloc(data_size + 1);
+
+	ret = RegQueryValueEx(hkey, value, 0, NULL, data, &data_size);
+	if (ret == ERROR_SUCCESS) {
+		data[data_size] = '\0';
+	} else {
+		tmp = g_win32_error_message(ret);
+		debug_print("RegQueryValueEx %p \"%s\" \"%s\" had error: \"%s\"\n",
+			root, subkey, value, tmp);
+		RegCloseKey(hkey);
+		g_free(data);
+		g_free(tmp);
+		return NULL;
 	}
 
-	free( section );
-	return value;
+	RegCloseKey(hkey);
+	return (gchar *)data;
 }
diff --git a/src/common/w32_reg.h b/src/common/w32_reg.h
new file mode 100644
index 000000000..a75ed43ed
--- /dev/null
+++ b/src/common/w32_reg.h
@@ -0,0 +1,40 @@
+/*
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __W32_REG_H__
+#define __W32_REG_H__
+
+#include <windows.h>
+#include <glib.h>
+
+gboolean write_w32_registry_string(HKEY root,
+	const gchar *subkey,
+	const gchar *value,
+	const gchar *data);
+
+gboolean write_w32_registry_dword(HKEY root,
+	const gchar *subkey,
+	const gchar *value,
+	DWORD data);
+
+// Caller should deallocate the return value with g_free()
+gchar *read_w32_registry_string(HKEY root,
+	const gchar *subkey,
+	const gchar *value);
+
+#endif
diff --git a/src/common/w32lib.h b/src/common/w32lib.h
deleted file mode 100644
index 249c39835..000000000
--- a/src/common/w32lib.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* w32lib.h  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * The code has been taken from the package
- *    http://claws.sylpheed.org/win32/sylpheed/w32lib-dev-2004.2.3.0.zip
- * on 2005-11-17 by Werner Koch <wk at gnupg.org>. There are no regular
- * copyright notices but the file version.rc from the ZIP archive
- * claims:
- *
- *     #define FILEVER "2004.2.3.0\0"
- *     #define PRODVER "2004.2.3\0"
- *
- *     [...]
- *      VALUE "FileDescription", "Posix emulation layer for Sylpheed (Claws)\0"
- *      VALUE "FileVersion", FILEVER
- *      VALUE "ProductVersion", PRODVER
- *      VALUE "LegalCopyright", "GPL\0"
- *      VALUE "CompanyName", "GNU / Free Software Foundation\0"
- *      VALUE "ProductName", "w32lib\0"
- *
- * Along with the fact that Sylpheed is under the GPL we can assume
- * that this code is under the GPL.  No author information or
- * changelogs have been found.
- * Files taken form the package are:
- *    w32_dirent.c w32_reg.c w32_stat.c w32_stdlib.c w32_time.c w32_wait.c
- *    w32_gettext.c w32_signal.c w32_stdio.c w32_string.c w32_unistd.c
- */
-
-/* Changes are:
-
-2007-05-21  Werner Koch  <wk at g10code.com>
-
-	* src/common/w32_account.c: New.
-
-	* src/common/w32lib.h: Undef "interface".
-
-2005-11-17  Werner Koch  <wk at g10code.com>
-
-	Add boilerplate text to all files and explain legal status.
-
-	* w32_reg.c: Replaced g_free and g_strdup by regular C functions.
-	(get_content_type_from_registry_with_ext): Ditto.
-	* w32_dirent.c (readdir): Ditto. 
-	(opendir): Ditto.
-	(closedir): Reformatted.
-	(readdir): Reformatted, replaced use of g_strdup_printf and other
-	g-style malloc function by regular ones.  Use DIR structure from mingw.
-        * w32lib.h: Don't define finddata_t for mingw. Replaced replacement
-        DIR structure by the one form mingw.  Allocate filename in dirent
-        statically to match the defintion ussed by mingw.
-	* w32_reg.c (read_w32_registry_string): Return error for invalid root
-        key.
-
-  */
-
-
-#ifndef _W32LIB_H_
-#define _W32LIB_H_
-
-#include <windows.h>
-
-/*** misc ***/
-int write_w32_registry_string( char *parent, char *section, char *value, char *data );
-int write_w32_registry_dword( char *parent, char *section, char *value, int data );
-char *read_w32_registry_string( char *parent, char *section, char *key );
-char *get_content_type_from_registry_with_ext( char *ext );
-
-#endif
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 1cc8d6eef..ef2257989 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -98,7 +98,7 @@
 #include "printing.h"
 #include "send_message.h"
 #ifdef G_OS_WIN32
-#include "w32lib.h"
+#include "w32_reg.h"
 #endif
 
 #define AC_LABEL_WIDTH	240
@@ -5205,7 +5205,7 @@ static void set_default_client_cb(GtkAction *action, gpointer data)
 	gchar *binary_icon = NULL;
 	gchar *binary_compose = NULL;
 	gchar *binary_run = NULL;
-	int r = 0;
+	gboolean r;
 	if ( !GetModuleFileNameA (0, exename, sizeof (exename)) ) {
 		alertpanel_error(_("Can not register as default client: impossible to get executable path."));
 		return;
@@ -5215,56 +5215,88 @@ static void set_default_client_cb(GtkAction *action, gpointer data)
 	binary_run = g_strconcat(exename, NULL);
 
 	/* Try to set the Mail Start menu item to Claws. It may fail if we're not root; we don't care */
-	r = write_w32_registry_string("HKLM", "Software\\Clients\\Mail", 
-			"", "Claws Mail");
+	r = write_w32_registry_string(HKEY_LOCAL_MACHINE,
+		"Software\\Clients\\Mail",
+		"",
+		"Claws Mail");
 	
-	r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail", 
-				"", "Claws Mail");
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail", 
-				"DLLPath", "");
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
-				"", "URL:MailTo-Protocol");
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
-				"URL Protocol", "");
-	if (!r)
-		r = write_w32_registry_dword ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
-				"EditFlags", 2);
-	if (!r)
-		r = write_w32_registry_string ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
-				"FriendlyTypeName", "Claws-Mail URL");
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\DefaultIcon", 
-				"", binary_icon);
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\shell\\open\\command", 
-				"", binary_compose);
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\shell\\open\\command", 
-				"", binary_run);
+	r = write_w32_registry_string(HKEY_CURRENT_USER,
+		"Software\\Clients\\Mail\\Claws Mail",
+		"",
+		"Claws Mail");
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail",
+			"DLLPath",
+			"");
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
+			"",
+			"URL:MailTo-Protocol");
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
+			"URL Protocol",
+			"");
+	if (r)
+		r = write_w32_registry_dword (HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
+			"EditFlags",
+			2);
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto",
+			"FriendlyTypeName",
+			"Claws-Mail URL");
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\DefaultIcon",
+			"",
+			binary_icon);
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\shell\\open\\command",
+			"",
+			binary_compose);
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Clients\\Mail\\Claws Mail\\shell\\open\\command",
+			"",
+			binary_run);
 	
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto", 
-				"", "URL:MailTo-Protocol");
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto", 
-				"URL Protocol", "");
-	if (!r)
-		r = write_w32_registry_dword ("HKCU", "Software\\Classes\\mailto", 
-				"EditFlags", 2);
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto", 
-				"FriendlyTypeName", "Claws-Mail URL");
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\DefaultIcon", 
-				"", binary_icon);
-	if (!r)
-		r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\shell\\open\\command", 
-				"", binary_compose);
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Classes\\mailto",
+			"",
+			"URL:MailTo-Protocol");
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Classes\\mailto",
+			"URL Protocol",
+			"");
+	if (r)
+		r = write_w32_registry_dword (HKEY_CURRENT_USER,
+			"Software\\Classes\\mailto",
+			"EditFlags",
+			2);
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Classes\\mailto",
+			"FriendlyTypeName",
+			"Claws-Mail URL");
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Classes\\mailto\\DefaultIcon",
+			"",
+			binary_icon);
+	if (r)
+		r = write_w32_registry_string(HKEY_CURRENT_USER,
+			"Software\\Classes\\mailto\\shell\\open\\command",
+			"",
+			binary_compose);
 	
-	if (!r) {
+	if (r) {
 		SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\Mail");
 		alertpanel_notice(_("Claws Mail has been registered as default client."));
 	} else {
diff --git a/src/procmime.c b/src/procmime.c
index 59d239c09..b2eb7081c 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -55,7 +55,8 @@
 #include "file-utils.h"
 
 #ifdef G_OS_WIN32
-#include "w32lib.h"
+#include "w32_reg.h"
+#define REG_MIME_TYPE_VALUE "Content Type"
 #endif
 
 static GHashTable *procmime_get_mime_type_table	(void);
@@ -1047,6 +1048,7 @@ gchar *procmime_get_mime_type(const gchar *filename)
 	const gchar *p;
 	gchar *ext = NULL;
 	gchar *base;
+	gchar *str;
 #ifndef G_OS_WIN32
 	static GHashTable *mime_type_table = NULL;
 	MimeType *mime_type;
@@ -1062,7 +1064,11 @@ gchar *procmime_get_mime_type(const gchar *filename)
 
 	base = g_path_get_basename(filename);
 	if ((p = strrchr(base, '.')) != NULL)
+#ifndef G_OS_WIN32
 		ext = g_utf8_strdown(p + 1, -1);
+#else
+		ext = g_utf8_strdown(p, -1);
+#endif
 	else
 		ext = g_utf8_strdown(base, -1);
 	g_free(base);
@@ -1071,7 +1077,6 @@ gchar *procmime_get_mime_type(const gchar *filename)
 	mime_type = g_hash_table_lookup(mime_type_table, ext);
 	
 	if (mime_type) {
-		gchar *str;
 		str = g_strconcat(mime_type->type, "/", mime_type->sub_type,
 				  NULL);
 		debug_print("got type %s for %s\n", str, ext);
@@ -1081,8 +1086,8 @@ gchar *procmime_get_mime_type(const gchar *filename)
 	g_free(ext);
 	return NULL;
 #else
-	gchar *str = get_content_type_from_registry_with_ext(ext);
-
+	str = read_w32_registry_string(HKEY_CLASSES_ROOT, ext, REG_MIME_TYPE_VALUE);
+	debug_print("got type %s for %s\n", str, ext);
 	g_free(ext);
 	return str;
 #endif

commit e0f1b46602c713c91d84c4e1929e30dbb9a01720
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 23:33:51 2021 -0700

    Cleanup w32lib.h

diff --git a/src/common/log.c b/src/common/log.c
index 6bdc6d709..c06ffea63 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -24,10 +24,6 @@
 
 #include "defs.h"
 
-#ifdef G_OS_WIN32
-#  include <w32lib.h>
-#endif
-
 #include <glib.h>
 #include <glib/gi18n.h>
 
diff --git a/src/common/socket.c b/src/common/socket.c
index 7446187b6..a26b58340 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -37,7 +37,6 @@
 #  ifndef EINPROGRESS
 #    define EINPROGRESS WSAEINPROGRESS
 #  endif
-#  include "w32lib.h"
 #else
 #  if HAVE_SYS_WAIT_H
 #    include <sys/wait.h>
diff --git a/src/common/timing.h b/src/common/timing.h
index f97bfb147..9a0436e93 100644
--- a/src/common/timing.h
+++ b/src/common/timing.h
@@ -53,7 +53,7 @@
 
 #ifdef G_OS_WIN32
 
-#include <w32lib.h>
+#include <windows.h>
 
 /* no {} by purpose */
 #define START_TIMING(str) \
diff --git a/src/common/utils.c b/src/common/utils.c
index d9637af44..14eca4707 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -80,7 +80,6 @@
 #ifdef G_OS_WIN32
 #  include <direct.h>
 #  include <io.h>
-#  include <w32lib.h>
 #endif
 
 #include "utils.h"
diff --git a/src/common/w32lib.h b/src/common/w32lib.h
index b9ddf1860..249c39835 100644
--- a/src/common/w32lib.h
+++ b/src/common/w32lib.h
@@ -72,110 +72,6 @@
 #define _W32LIB_H_
 
 #include <windows.h>
-#include <io.h>
-#include <stdio.h>
-
-#ifdef __MINGW32__
-# include <_mingw.h>
-# define MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 100 \
-			 + __MINGW32_MINOR_VERSION)
-# define MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 100 \
-			 + __MINGW64_VERSION_MINOR)
-# include <wchar.h>
-# include <dirent.h>
-# include <sys/time.h>
-# if MINGW64_VERSION >= 200
-#  include <sys/types.h>
-# endif
-#endif /* __MINGW32__ */
-
-#include <glib/gstdio.h>
-
-/* Mingw32 3.4.4 defines interface to struct and thus breaks our own
-   use of that symbol.  Undef it here. */
-#if defined(_BASETYPS_H) && defined(interface) 
-#undef interface
-#endif
-
-
-/* types */
-/*** ??? ***/
-#ifndef __MINGW32__
-typedef long int off_t;
-typedef int pid_t;
-typedef unsigned char u_char;
-#endif /* __MINGW32__ */
-typedef unsigned int uid_t;
-
-#ifndef __MINGW32__
-/*** stat ***/
-#define S_IRUSR	_S_IREAD
-#define S_IWUSR	_S_IWRITE
-#define S_IXUSR	_S_IEXEC
-#define S_IRWXU	(_S_IREAD|_S_IWRITE|_S_IEXEC)
-#endif /* __MINGW32__ */
-
-
-/* (signal?) */
-#define SIGPIPE	_S_IFIFO
-
-
-/* (directory) */
-#define __S_ISTYPE(mode, mask)  (((mode) & _S_IFMT) == (mask))
-#ifndef __MINGW32__
-#define S_ISFIFO(mode)	__S_ISTYPE((mode), _S_IFIFO)
-#define S_ISDIR(mode)	__S_ISTYPE((mode), _S_IFDIR)
-#define S_ISREG(mode)	__S_ISTYPE((mode), _S_IFREG)
-#endif /* __MINGW32__ */
-
-/*** dir ***/
-#ifndef __MINGW32__
-typedef void * HANDLE;
-
-#ifndef _FINDDATA_T_DEFINED
-typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
-struct _finddata_t {
-    unsigned    attrib;
-    time_t      time_create;    /* -1 for FAT file systems */
-    time_t      time_access;    /* -1 for FAT file systems */
-    time_t      time_write;
-    _fsize_t    size;
-    char        name[260];
-};
-#endif /* !_FINDDATA_T_DEFINED */
-
-struct dirent {
-	long d_ino;
-	unsigned short d_reclen;
-	unsigned short d_namlen;
-	char d_name[FILENAME_MAX];
-};
-
-typedef struct
-{
-	struct _finddata_t	dd_dta;
-	struct dirent		dd_dir;
-	long			dd_handle;
-	int			dd_stat;
-	char			dd_name[1];
-} DIR;
-
-#endif /* !__MINGW32__ */
-
-#if defined (__MINGW32__) && MINGW32_VERSION < 312
-# if MINGW64_VERSION < 200
-struct timezone {
-  int tz_minuteswest;
-  int tz_dsttime;
-};
-# endif
-#endif
-
-/*** stdio ***/
-#if MINGW64_VERSION < 200
-FILE *popen( const char *command, const char *type );
-int pclose( FILE *stream );
-#endif
 
 /*** misc ***/
 int write_w32_registry_string( char *parent, char *section, char *value, char *data );
diff --git a/src/exporthtml.c b/src/exporthtml.c
index 86bfdfe1c..7bc77533c 100644
--- a/src/exporthtml.c
+++ b/src/exporthtml.c
@@ -38,10 +38,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
-#ifdef G_OS_WIN32
-#  include <w32lib.h>
-#endif
-
 #include "mgutils.h"
 #include "utils.h"
 #include "exporthtml.h"
diff --git a/src/folder.c b/src/folder.c
index 8f3e9a363..b6ff994d3 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -31,9 +31,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdlib.h>
-#ifdef WIN32
-#include <w32lib.h>
-#endif
 
 #include "alertpanel.h"
 #include "folder.h"
diff --git a/src/mbox.c b/src/mbox.c
index 717df9ca3..c7a54ac18 100644
--- a/src/mbox.c
+++ b/src/mbox.c
@@ -41,10 +41,6 @@
 #include <time.h>
 #include <errno.h>
 
-#ifdef G_OS_WIN32
-#  include <w32lib.h>
-#endif
-
 #include "mbox.h"
 #include "procmsg.h"
 #include "folder.h"
diff --git a/src/msgcache.c b/src/msgcache.c
index d1abccd89..2fc9edcdb 100644
--- a/src/msgcache.c
+++ b/src/msgcache.c
@@ -29,7 +29,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #ifdef _WIN32
-# include <w32lib.h>
 # define MAP_FAILED	((char *) -1)
 #else
 # include <sys/mman.h>
diff --git a/src/plugins/pgpcore/passphrase.c b/src/plugins/pgpcore/passphrase.c
index 781728b1c..9ef1ae55b 100644
--- a/src/plugins/pgpcore/passphrase.c
+++ b/src/plugins/pgpcore/passphrase.c
@@ -32,7 +32,7 @@
 #include <string.h>
 #include <sys/types.h>
 #ifdef G_OS_WIN32
-#include <w32lib.h>
+#include <windows.h>
 #else
 #include <sys/mman.h>
 #endif
diff --git a/src/prefs_summaries.c b/src/prefs_summaries.c
index 411412891..dd87456ed 100644
--- a/src/prefs_summaries.c
+++ b/src/prefs_summaries.c
@@ -31,10 +31,6 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
-#ifdef G_OS_WIN32
-#  include <w32lib.h>
-#endif
-
 #include "prefs_common.h"
 #include "prefs_gtk.h"
 #include "prefs_summary_open.h"
diff --git a/src/procheader.c b/src/procheader.c
index 653a000fb..fa09943b6 100644
--- a/src/procheader.c
+++ b/src/procheader.c
@@ -30,10 +30,6 @@
 #include <time.h>
 #include <sys/stat.h>
 
-#ifdef G_OS_WIN32
-#  include <w32lib.h>
-#endif
-
 #include "procheader.h"
 #include "procmsg.h"
 #include "codeconv.h"
diff --git a/src/procmime.c b/src/procmime.c
index 07488dc11..59d239c09 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -54,6 +54,10 @@
 #include "account.h"
 #include "file-utils.h"
 
+#ifdef G_OS_WIN32
+#include "w32lib.h"
+#endif
+
 static GHashTable *procmime_get_mime_type_table	(void);
 static MimeInfo *procmime_scan_file_short(const gchar *filename);
 static MimeInfo *procmime_scan_queue_file_short(const gchar *filename);
diff --git a/src/recv.c b/src/recv.c
index 8aa38216d..ce2e61d39 100644
--- a/src/recv.c
+++ b/src/recv.c
@@ -30,9 +30,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef G_OS_WIN32
-#include "w32lib.h"
-#else
+#ifndef G_OS_WIN32
 #include <sys/time.h>
 #endif
 

commit a1cb2c4c66fa5c36c8f3a23fc63b93a0a32d7b76
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 22:33:00 2021 -0700

    Remove old windows compatibility code

diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index b5a5759fb..a9fcb7ea7 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -14,9 +14,7 @@ DESKTOPFILEPATH=$(datadir)/applications/claws-mail.desktop
 noinst_LTLIBRARIES = libclawscommon.la
 
 if OS_WIN32
-arch_sources = w32_reg.c w32_signal.c w32_stat.c \
-               w32_stdlib.c w32_string.c w32_time.c \
-               w32_unistd.c w32_wait.c w32_account.c
+arch_sources = w32_reg.c
 arch_headers = w32lib.h
 else
 arch_files = 
diff --git a/src/common/w32_account.c b/src/common/w32_account.c
deleted file mode 100644
index 5bd9a0f62..000000000
--- a/src/common/w32_account.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* w32_account.c - Account related W32 functions.
-   Copyright (C) 2007-2009 g10 Code GmbH 
-   Copyright (C) 1999-2005 Nullsoft, Inc.
-
-   This software is provided 'as-is', without any express or implied
-   warranty. In no event will the authors be held liable for any
-   damages arising from the use of this software.
-   
-   Permission is granted to anyone to use this software for any
-   purpose, including commercial applications, and to alter it and
-   redistribute it freely, subject to the following restrictions:
-   
-   1. The origin of this software must not be misrepresented; you must
-      not claim that you wrote the original software. If you use this
-      software in a product, an acknowledgment in the product
-      documentation would be appreciated but is not required.
-   
-   2. Altered source versions must be plainly marked as such, and must
-      not be misrepresented as being the original software.
-   
-   3. This notice may not be removed or altered from any source
-      distribution.
-
- =======[ wk 2007-05-21 ]====
-   The code for get_group_name has been taken from NSIS 2.05, module
-   UserInfo.c.  NSIS bears the above license and along with the
-   notice:
-     This license applies to everything in the NSIS package, except where
-     otherwise noted.
-   Thus we make this module available under the same license - note,
-   that this lincese is fully compatibe with the GNU GPL 2.0.
-*/ 
-  
-  
-
-
-#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]))
-#endif
-
-
-/* Return a malloced name of our user group.  */
-static char *
-get_group_name (void)
-{
-  HANDLE        hThread;
-  TOKEN_GROUPS  *ptg = NULL;
-  DWORD         cbTokenGroups;
-  DWORD         i, j;
-  SID_IDENTIFIER_AUTHORITY SystemSidAuthority = { SECURITY_NT_AUTHORITY };
-  char *group;
-  struct
-  {
-    DWORD auth_id;
-    char *name;
-  } groups[] = 
-    {
-      /* Every user belongs to the users group, hence
-         users comes before guests */
-      {DOMAIN_ALIAS_RID_USERS, "User"},
-      {DOMAIN_ALIAS_RID_GUESTS, "Guest"},
-      {DOMAIN_ALIAS_RID_POWER_USERS, "Power"},
-      {DOMAIN_ALIAS_RID_ADMINS, "Admin"}
-    };
-
-
-  group = NULL;
-  if (GetVersion() & 0x80000000) 
-    {
-      /* This is not NT; thus we are always Admin. */
-      group = "Admin";
-    }
-  else if (OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &hThread) 
-           || OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hThread))
-    {
-      /* With the token for the current thread or process in hand we
-         query the size of the associated group information.  Note
-         that we expect an error because buffer has been passed as
-         NULL. cbTokenGroups will then tell use the required size.  */
-      if (!GetTokenInformation (hThread, TokenGroups, NULL, 0, &cbTokenGroups)
-          && GetLastError () == ERROR_INSUFFICIENT_BUFFER)
-        {
-          ptg = GlobalAlloc (GPTR, cbTokenGroups);
-          if (ptg)
-            {
-              if (GetTokenInformation ( hThread, TokenGroups, ptg,
-                                        cbTokenGroups, &cbTokenGroups))
-                {
-
-                  /* Now iterate through the list of groups for this
-                     access token looking for a match against the SID
-                     we created above. */
-                  for (i = 0; i < DIM (groups); i++)
-                    {
-                      PSID psid = 0;
-                      
-                      AllocateAndInitializeSid (&SystemSidAuthority,
-                                                2,
-                                                SECURITY_BUILTIN_DOMAIN_RID,
-                                                groups[i].auth_id,
-                                                0, 0, 0, 0, 0, 0,
-                                                &psid);
-                      if (!psid) 
-                        continue;
-                      for (j = 0; j < ptg->GroupCount; j++)
-                        if (EqualSid(ptg->Groups[j].Sid, psid))
-                          group = groups[i].name;
-                      FreeSid(psid);
-                    }
-                }
-              
-              GlobalFree(ptg);
-            }
-        }
-      
-      CloseHandle(hThread);
-    }
-
-  return group? strdup (group):NULL;
-}
-
-
-/* Return true if we are an administrator.  The chekc is done only
-   once so if the current user has been hadded to the Administrator
-   group the process needs to be rerstarted. */
-int
-w32_is_administrator (void)
-{
-  static int got_it;
-  static int is_admin;
-
-  if (!got_it)
-    {
-      char *name = get_group_name ();
-
-      if (name && !strcmp (name, "Admin"))
-        is_admin = 1;
-      got_it = 1;
-      free (name);
-    }
-
-  return is_admin;
-}
diff --git a/src/common/w32_signal.c b/src/common/w32_signal.c
deleted file mode 100644
index a757b6031..000000000
--- a/src/common/w32_signal.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* w32_signal.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "w32lib.h"
-
-int kill( pid_t pid, int sig ){
-  return -1;
-}
diff --git a/src/common/w32_stat.c b/src/common/w32_stat.c
deleted file mode 100644
index 8abbec7cf..000000000
--- a/src/common/w32_stat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* w32_stat.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "w32lib.h"
-
-int lstat( const char *file_name, GStatBuf *buf ){
-  return g_stat( file_name, buf );
-}
-
diff --git a/src/common/w32_stdlib.c b/src/common/w32_stdlib.c
deleted file mode 100644
index a55a17efe..000000000
--- a/src/common/w32_stdlib.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* w32_stdlib.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "w32lib.h"
-
-long int random( void ){
-  return rand();
-}
-
-void srandom( unsigned int seed ){
-  srand( seed );
-}
-
-#if MINGW64_VERSION < 200
-int truncate( const char *path, off_t length ){
-  return -1;
-}
-#endif
diff --git a/src/common/w32_string.c b/src/common/w32_string.c
deleted file mode 100644
index 6c238e3b9..000000000
--- a/src/common/w32_string.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* w32_string.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "w32lib.h"
-
-#if MINGW64_VERSION < 200
-int strcasecmp( const char *s1, const char *s2 ){
-  size_t len1, len2, len;
-
-  len1 = strlen( s1 );
-  len2 = strlen( s2 );
-  len = ( len1 > len2 )? len1 : len2;
-
-  return strncasecmp( s1, s2, len );
-}
-
-int strncasecmp( const char *s1, const char *s2, size_t n ){
-  int c1;
-  int c2;
-
-  while (n--) {
-    c1 = tolower(*(const unsigned char*)s1++);
-    c2 = tolower(*(const unsigned char*)s2++);
-    if (c1 != c2)
-      return c1 - c2;
-    else if (c1 == 0 && c2 == 0)
-      break;
-   }
-
-   return 0;
-}
-#endif /* MINGW64_VERSION < 200 */
diff --git a/src/common/w32_time.c b/src/common/w32_time.c
deleted file mode 100644
index ef7df8f9c..000000000
--- a/src/common/w32_time.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* w32_time.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/timeb.h>
-
-#include "w32lib.h"
-
-#if ! defined (__MINGW32__) || MINGW32_VERSION < 312
-# if MINGW64_VERSION < 200
-int gettimeofday( struct timeval *tv, struct timezone *tz ){
-  struct _timeb tstruct;
-  _ftime( &tstruct );
-  tv->tv_sec = tstruct.time ;
-  tv->tv_usec = tstruct.millitm;
-  return 1;
-}
-# endif
-#endif
diff --git a/src/common/w32_unistd.c b/src/common/w32_unistd.c
deleted file mode 100644
index 11a2dda63..000000000
--- a/src/common/w32_unistd.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* w32_unistd.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "w32lib.h"
-
-int setpgid( pid_t pid, pid_t pgid ){
-  return -1;
-}
-
-pid_t getppid( void ){
-  return -1;
-}
-
-pid_t fork( void ){
-  return -1;
-}
-
-unsigned int sleep( unsigned int seconds ){
-  Sleep(seconds * 1000);
-  return 0;
-}
-
-int usleep( unsigned long usec ){
-  return sleep( 1 );
-}
diff --git a/src/common/w32_wait.c b/src/common/w32_wait.c
deleted file mode 100644
index 411a2f7e9..000000000
--- a/src/common/w32_wait.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* w32_wait.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "w32lib.h"
-
-pid_t waitpid( pid_t pid, int *status, int options ){
-  return -1;
-}
diff --git a/src/common/w32lib.h b/src/common/w32lib.h
index 26e2c8ac2..b9ddf1860 100644
--- a/src/common/w32lib.h
+++ b/src/common/w32lib.h
@@ -128,13 +128,6 @@ typedef unsigned int uid_t;
 #define S_ISREG(mode)	__S_ISTYPE((mode), _S_IFREG)
 #endif /* __MINGW32__ */
 
-/* functions */
-/*** str ***/
-#if MINGW64_VERSION < 200
-int strcasecmp( const char *s1, const char *s2 );
-int strncasecmp( const char *s1, const char *s2, size_t n );
-#endif
-
 /*** dir ***/
 #ifndef __MINGW32__
 typedef void * HANDLE;
@@ -178,43 +171,12 @@ struct timezone {
 # endif
 #endif
 
-/*** stat ***/
-int lstat( const char *file_name, GStatBuf *buf );
-
-/*** sys/wait ***/
-pid_t waitpid( pid_t pid, int *status, int options );
-
-/*** sys/time ***/
-#if ! defined (__MINGW32__) || MINGW32_VERSION < 312
-# if MINGW64_VERSION < 200
-int gettimeofday( struct timeval *tv, struct timezone *tz );
-# endif
-#endif
-
-/*** unistd ***/
-int setpgid( pid_t pid, pid_t pgid );
-pid_t getppid( void );
-unsigned int sleep( unsigned int seconds );
-
-/*** stdlib ***/
-long int random( void );
-void srandom( unsigned int seed );
-#if MINGW64_VERSION < 200
-int truncate( const char *path, off_t length );
-#endif
-
-/*** signal ***/
-int kill( pid_t pid, int sig );
-
 /*** stdio ***/
 #if MINGW64_VERSION < 200
 FILE *popen( const char *command, const char *type );
 int pclose( FILE *stream );
 #endif
 
-/*** w32_account.c ***/
-int w32_is_administrator (void);
-
 /*** misc ***/
 int write_w32_registry_string( char *parent, char *section, char *value, char *data );
 int write_w32_registry_dword( char *parent, char *section, char *value, int data );

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list