gwin32.h 4.6 KB

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