gwin32.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 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. #ifndef _WIN64
  75. GLIB_DEPRECATED
  76. gchar* g_win32_get_package_installation_directory (const gchar *package,
  77. const gchar *dll_name);
  78. GLIB_DEPRECATED
  79. gchar* g_win32_get_package_installation_subdirectory (const gchar *package,
  80. const gchar *dll_name,
  81. const gchar *subdir);
  82. #endif
  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. #ifndef __GTK_DOC_IGNORE__
  95. #ifdef G_OS_WIN32
  96. #ifdef _WIN64
  97. #define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8
  98. #define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8
  99. #endif
  100. GLIB_AVAILABLE_IN_ALL
  101. gchar *g_win32_get_package_installation_directory_utf8 (const gchar *package,
  102. const gchar *dll_name);
  103. GLIB_AVAILABLE_IN_ALL
  104. gchar *g_win32_get_package_installation_subdirectory_utf8 (const gchar *package,
  105. const gchar *dll_name,
  106. const gchar *subdir);
  107. #endif /* G_OS_WIN32 */
  108. #endif /* __GTK_DOC_IGNORE__ */
  109. /**
  110. * GWin32OSType:
  111. * @G_WIN32_OS_ANY: The running system can be a workstation or a server edition of
  112. * Windows. The type of the running system is therefore not checked.
  113. * @G_WIN32_OS_WORKSTATION: The running system is a workstation edition of Windows,
  114. * such as Windows 7 Professional.
  115. * @G_WIN32_OS_SERVER: The running system is a server edition of Windows, such as
  116. * Windows Server 2008 R2.
  117. *
  118. * Type of Windows edition to check for at run-time.
  119. **/
  120. typedef enum
  121. {
  122. G_WIN32_OS_ANY,
  123. G_WIN32_OS_WORKSTATION,
  124. G_WIN32_OS_SERVER,
  125. } GWin32OSType;
  126. GLIB_AVAILABLE_IN_2_44
  127. gboolean g_win32_check_windows_version (const gint major,
  128. const gint minor,
  129. const gint spver,
  130. const GWin32OSType os_type);
  131. G_END_DECLS
  132. #endif /* G_PLATFORM_WIN32 */
  133. #endif /* __G_WIN32_H__ */