gwin32.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /*
  20. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GLib Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #ifndef __G_WIN32_H__
  26. #define __G_WIN32_H__
  27. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  28. #error "Only <glib.h> can be included directly."
  29. #endif
  30. #include <glib/gtypes.h>
  31. #ifdef G_PLATFORM_WIN32
  32. G_BEGIN_DECLS
  33. #ifndef MAXPATHLEN
  34. #define MAXPATHLEN 1024
  35. #endif
  36. #ifdef G_OS_WIN32
  37. /*
  38. * To get prototypes for the following POSIXish functions, you have to
  39. * include the indicated non-POSIX headers. The functions are defined
  40. * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). But note that
  41. * for POSIX functions that take or return file names in the system
  42. * codepage, in many cases you would want to use the GLib wrappers in
  43. * gstdio.h and UTF-8 instead.
  44. *
  45. * getcwd: <direct.h> (MSVC), <io.h> (mingw32)
  46. * getpid: <process.h>
  47. * access: <io.h>
  48. * unlink: <stdio.h> or <io.h>
  49. * open, read, write, lseek, close: <io.h>
  50. * rmdir: <io.h>
  51. * pipe: <io.h> (actually, _pipe())
  52. */
  53. /* For some POSIX functions that are not provided by the MS runtime,
  54. * we provide emulation functions in glib, which are prefixed with
  55. * g_win32_. Or that was the idea at some time, but there is just one
  56. * of those:
  57. */
  58. GLIB_AVAILABLE_IN_ALL
  59. gint g_win32_ftruncate (gint f,
  60. guint size);
  61. #endif /* G_OS_WIN32 */
  62. /* The MS setlocale uses locale names of the form "English_United
  63. * States.1252" etc. We want the Unixish standard form "en", "zh_TW"
  64. * etc. This function gets the current thread locale from Windows and
  65. * returns it as a string of the above form for use in forming file
  66. * names etc. The returned string should be deallocated with g_free().
  67. */
  68. GLIB_AVAILABLE_IN_ALL
  69. gchar* g_win32_getlocale (void);
  70. /* Translate a Win32 error code (as returned by GetLastError()) into
  71. * the corresponding message. The returned string should be deallocated
  72. * with g_free().
  73. */
  74. GLIB_AVAILABLE_IN_ALL
  75. gchar* g_win32_error_message (gint error);
  76. GLIB_DEPRECATED
  77. gchar* g_win32_get_package_installation_directory (const gchar *package,
  78. const gchar *dll_name);
  79. GLIB_DEPRECATED
  80. gchar* g_win32_get_package_installation_subdirectory (const gchar *package,
  81. const gchar *dll_name,
  82. const gchar *subdir);
  83. GLIB_AVAILABLE_IN_ALL
  84. gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
  85. GLIB_DEPRECATED_IN_2_44_FOR(g_win32_check_windows_version)
  86. guint g_win32_get_windows_version (void);
  87. GLIB_AVAILABLE_IN_ALL
  88. gchar* g_win32_locale_filename_from_utf8 (const gchar *utf8filename);
  89. GLIB_AVAILABLE_IN_2_40
  90. gchar ** g_win32_get_command_line (void);
  91. /* As of GLib 2.14 we only support NT-based Windows */
  92. #define G_WIN32_IS_NT_BASED() TRUE
  93. #define G_WIN32_HAVE_WIDECHAR_API() TRUE
  94. /**
  95. * GWin32OSType:
  96. * @G_WIN32_OS_ANY: The running system can be a workstation or a server edition of
  97. * Windows. The type of the running system is therefore not checked.
  98. * @G_WIN32_OS_WORKSTATION: The running system is a workstation edition of Windows,
  99. * such as Windows 7 Professional.
  100. * @G_WIN32_OS_SERVER: The running system is a server edition of Windows, such as
  101. * Windows Server 2008 R2.
  102. *
  103. * Type of Windows edition to check for at run-time.
  104. **/
  105. typedef enum
  106. {
  107. G_WIN32_OS_ANY,
  108. G_WIN32_OS_WORKSTATION,
  109. G_WIN32_OS_SERVER,
  110. } GWin32OSType;
  111. GLIB_AVAILABLE_IN_2_44
  112. gboolean g_win32_check_windows_version (const gint major,
  113. const gint minor,
  114. const gint spver,
  115. const GWin32OSType os_type);
  116. G_END_DECLS
  117. #endif /* G_PLATFORM_WIN32 */
  118. #endif /* __G_WIN32_H__ */