2000-10-19 17:52:12 +00:00
|
|
|
/* GLIB - Library of useful routines for C programming
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
2022-05-18 09:15:38 +01:00
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*
|
2000-10-19 17:52:12 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-01-05 12:47:07 +01:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2000-10-19 17:52:12 +00:00
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2014-01-23 12:58:29 +01:00
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2000-10-19 17:52:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
|
|
|
* file for a list of people on the GLib Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
2008-03-14 19:30:38 +00:00
|
|
|
* GLib at ftp://ftp.gtk.org/pub/gtk/.
|
2000-10-19 17:52:12 +00:00
|
|
|
*/
|
|
|
|
|
2012-12-27 23:43:14 -05:00
|
|
|
#ifndef __G_WIN32_H__
|
|
|
|
#define __G_WIN32_H__
|
|
|
|
|
2011-10-12 00:24:46 -04:00
|
|
|
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
2008-03-14 19:30:38 +00:00
|
|
|
#error "Only <glib.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:01:21 +00:00
|
|
|
#include <glib/gtypes.h>
|
2000-10-19 17:52:12 +00:00
|
|
|
|
2001-03-09 21:31:21 +00:00
|
|
|
#ifdef G_PLATFORM_WIN32
|
2000-10-19 17:52:12 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2001-03-09 21:31:21 +00:00
|
|
|
#ifndef MAXPATHLEN
|
2000-10-19 17:52:12 +00:00
|
|
|
#define MAXPATHLEN 1024
|
2001-03-09 21:31:21 +00:00
|
|
|
#endif
|
2000-10-19 17:52:12 +00:00
|
|
|
|
2001-03-09 21:31:21 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
2000-10-19 17:52:12 +00:00
|
|
|
/*
|
|
|
|
* To get prototypes for the following POSIXish functions, you have to
|
|
|
|
* include the indicated non-POSIX headers. The functions are defined
|
2007-05-13 20:46:59 +00:00
|
|
|
* in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). But note that
|
|
|
|
* for POSIX functions that take or return file names in the system
|
|
|
|
* codepage, in many cases you would want to use the GLib wrappers in
|
|
|
|
* gstdio.h and UTF-8 instead.
|
2000-10-19 17:52:12 +00:00
|
|
|
*
|
|
|
|
* getcwd: <direct.h> (MSVC), <io.h> (mingw32)
|
|
|
|
* getpid: <process.h>
|
|
|
|
* access: <io.h>
|
|
|
|
* unlink: <stdio.h> or <io.h>
|
|
|
|
* open, read, write, lseek, close: <io.h>
|
2003-01-02 00:30:22 +00:00
|
|
|
* rmdir: <io.h>
|
2007-05-13 20:46:59 +00:00
|
|
|
* pipe: <io.h> (actually, _pipe())
|
2000-10-19 17:52:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* For some POSIX functions that are not provided by the MS runtime,
|
2004-09-15 19:12:19 +00:00
|
|
|
* we provide emulation functions in glib, which are prefixed with
|
|
|
|
* g_win32_. Or that was the idea at some time, but there is just one
|
|
|
|
* of those:
|
2000-10-19 17:52:12 +00:00
|
|
|
*/
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2001-03-09 21:31:21 +00:00
|
|
|
gint g_win32_ftruncate (gint f,
|
2000-10-19 17:52:12 +00:00
|
|
|
guint size);
|
2001-03-09 21:31:21 +00:00
|
|
|
#endif /* G_OS_WIN32 */
|
|
|
|
|
2000-10-19 17:52:12 +00:00
|
|
|
/* The MS setlocale uses locale names of the form "English_United
|
|
|
|
* States.1252" etc. We want the Unixish standard form "en", "zh_TW"
|
|
|
|
* etc. This function gets the current thread locale from Windows and
|
|
|
|
* returns it as a string of the above form for use in forming file
|
|
|
|
* names etc. The returned string should be deallocated with g_free().
|
|
|
|
*/
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2001-02-17 23:30:48 +00:00
|
|
|
gchar* g_win32_getlocale (void);
|
2000-10-19 17:52:12 +00:00
|
|
|
|
|
|
|
/* Translate a Win32 error code (as returned by GetLastError()) into
|
|
|
|
* the corresponding message. The returned string should be deallocated
|
|
|
|
* with g_free().
|
|
|
|
*/
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2001-02-17 23:30:48 +00:00
|
|
|
gchar* g_win32_error_message (gint error);
|
2000-10-19 17:52:12 +00:00
|
|
|
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_DEPRECATED
|
2006-12-27 14:50:17 +00:00
|
|
|
gchar* g_win32_get_package_installation_directory (const gchar *package,
|
|
|
|
const gchar *dll_name);
|
2001-01-17 21:37:32 +00:00
|
|
|
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_DEPRECATED
|
2006-12-27 14:50:17 +00:00
|
|
|
gchar* g_win32_get_package_installation_subdirectory (const gchar *package,
|
|
|
|
const gchar *dll_name,
|
|
|
|
const gchar *subdir);
|
2008-09-13 20:23:17 +00:00
|
|
|
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-02-24 00:38:01 +00:00
|
|
|
gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
|
|
|
|
|
gwin32: Add g_win32_check_windows_version() API
This adds a public API where one can use to see whether the running version
of Windows where the code is run is at least the specified version, service
pack level, and the type (non-server, server, any) of the running Windows
OS.
This API is done as:
-GetVersion()/GetVersionEx() changed in the way they work since Windows 8.1
[1][2], so a newer mechanism to check the version of the running Windows
operating system is needed. MSDN also states that GetVersion() might be
further changed or removed after Windows 8.1. This provides a wrapper for
VerfyVersionInfo() as well in GLib for most cases, which was recommended
in place of g_win32_get_windows_version() for more detailed Windows
version checking.
-Provides an OS-level functionality check, for those that we don't need to
venture into GetProcAddress(), and also to determine system API behavior
changes due to differences in OS versions.
Also added a note for the g_win32_get_windows_version() API that since the
behavior of GetVersion() which it uses, is changed since Windows 8.1, users
of the API should be aware.
[1]:
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724451%28v=vs.85%29.aspx
[2]:
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724451%28v=vs.85%29.aspx
https://bugzilla.gnome.org/show_bug.cgi?id=741895
2015-01-26 11:11:48 +08:00
|
|
|
GLIB_DEPRECATED_IN_2_44_FOR(g_win32_check_windows_version)
|
2004-08-25 15:32:50 +00:00
|
|
|
guint g_win32_get_windows_version (void);
|
|
|
|
|
2013-01-13 15:34:27 -05:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2005-04-27 09:50:09 +00:00
|
|
|
gchar* g_win32_locale_filename_from_utf8 (const gchar *utf8filename);
|
|
|
|
|
2014-01-12 12:13:42 -05:00
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
gchar ** g_win32_get_command_line (void);
|
|
|
|
|
2006-08-29 22:45:00 +00:00
|
|
|
/* As of GLib 2.14 we only support NT-based Windows */
|
|
|
|
#define G_WIN32_IS_NT_BASED() TRUE
|
|
|
|
#define G_WIN32_HAVE_WIDECHAR_API() TRUE
|
2004-08-25 15:32:50 +00:00
|
|
|
|
gwin32: Add g_win32_check_windows_version() API
This adds a public API where one can use to see whether the running version
of Windows where the code is run is at least the specified version, service
pack level, and the type (non-server, server, any) of the running Windows
OS.
This API is done as:
-GetVersion()/GetVersionEx() changed in the way they work since Windows 8.1
[1][2], so a newer mechanism to check the version of the running Windows
operating system is needed. MSDN also states that GetVersion() might be
further changed or removed after Windows 8.1. This provides a wrapper for
VerfyVersionInfo() as well in GLib for most cases, which was recommended
in place of g_win32_get_windows_version() for more detailed Windows
version checking.
-Provides an OS-level functionality check, for those that we don't need to
venture into GetProcAddress(), and also to determine system API behavior
changes due to differences in OS versions.
Also added a note for the g_win32_get_windows_version() API that since the
behavior of GetVersion() which it uses, is changed since Windows 8.1, users
of the API should be aware.
[1]:
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724451%28v=vs.85%29.aspx
[2]:
http://msdn.microsoft.com/zh-tw/library/windows/desktop/ms724451%28v=vs.85%29.aspx
https://bugzilla.gnome.org/show_bug.cgi?id=741895
2015-01-26 11:11:48 +08:00
|
|
|
/**
|
|
|
|
* GWin32OSType:
|
|
|
|
* @G_WIN32_OS_ANY: The running system can be a workstation or a server edition of
|
|
|
|
* Windows. The type of the running system is therefore not checked.
|
|
|
|
* @G_WIN32_OS_WORKSTATION: The running system is a workstation edition of Windows,
|
|
|
|
* such as Windows 7 Professional.
|
|
|
|
* @G_WIN32_OS_SERVER: The running system is a server edition of Windows, such as
|
|
|
|
* Windows Server 2008 R2.
|
|
|
|
*
|
|
|
|
* Type of Windows edition to check for at run-time.
|
|
|
|
**/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
G_WIN32_OS_ANY,
|
|
|
|
G_WIN32_OS_WORKSTATION,
|
|
|
|
G_WIN32_OS_SERVER,
|
|
|
|
} GWin32OSType;
|
|
|
|
|
|
|
|
GLIB_AVAILABLE_IN_2_44
|
|
|
|
gboolean g_win32_check_windows_version (const gint major,
|
|
|
|
const gint minor,
|
|
|
|
const gint spver,
|
|
|
|
const GWin32OSType os_type);
|
|
|
|
|
2015-01-28 12:25:10 -05:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* G_PLATFORM_WIN32 */
|
2012-11-15 18:18:54 -05:00
|
|
|
|
2000-11-14 21:40:28 +00:00
|
|
|
#endif /* __G_WIN32_H__ */
|