00001 /* GLIB - Library of useful routines for C programming 00002 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /* 00021 * Modified by the GLib Team and others 1997-2000. See the AUTHORS 00022 * file for a list of people on the GLib Team. See the ChangeLog 00023 * files for a list of changes. These files are distributed with 00024 * GLib at ftp://ftp.gtk.org/pub/gtk/. 00025 */ 00026 00027 #ifndef __G_WIN32_H__ 00028 #define __G_WIN32_H__ 00029 00030 #include <glib/gtypes.h> 00031 00032 #ifdef G_PLATFORM_WIN32 00033 00034 G_BEGIN_DECLS 00035 00036 #ifndef MAXPATHLEN 00037 #define MAXPATHLEN 1024 00038 #endif 00039 00040 #ifdef G_OS_WIN32 00041 00042 /* 00043 * To get prototypes for the following POSIXish functions, you have to 00044 * include the indicated non-POSIX headers. The functions are defined 00045 * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). 00046 * 00047 * getcwd: <direct.h> (MSVC), <io.h> (mingw32) 00048 * getpid: <process.h> 00049 * access: <io.h> 00050 * unlink: <stdio.h> or <io.h> 00051 * open, read, write, lseek, close: <io.h> 00052 * rmdir: <io.h> 00053 * pipe: <io.h> 00054 */ 00055 00056 /* pipe is not in OLDNAMES.LIB or -lmoldname-msvc. */ 00057 #define pipe(phandles) _pipe (phandles, 4096, _O_BINARY) 00058 00059 /* For some POSIX functions that are not provided by the MS runtime, 00060 * we provide emulation functions in glib, which are prefixed with 00061 * g_win32_. Or that was the idea at some time, but there is just one 00062 * of those: 00063 */ 00064 gint g_win32_ftruncate (gint f, 00065 guint size); 00066 #endif /* G_OS_WIN32 */ 00067 00068 /* The MS setlocale uses locale names of the form "English_United 00069 * States.1252" etc. We want the Unixish standard form "en", "zh_TW" 00070 * etc. This function gets the current thread locale from Windows and 00071 * returns it as a string of the above form for use in forming file 00072 * names etc. The returned string should be deallocated with g_free(). 00073 */ 00074 gchar* g_win32_getlocale (void); 00075 00076 /* Translate a Win32 error code (as returned by GetLastError()) into 00077 * the corresponding message. The returned string should be deallocated 00078 * with g_free(). 00079 */ 00080 gchar* g_win32_error_message (gint error); 00081 00082 #define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8 00083 #define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8 00084 00085 gchar* g_win32_get_package_installation_directory (gchar *package, 00086 gchar *dll_name); 00087 00088 gchar* g_win32_get_package_installation_subdirectory (gchar *package, 00089 gchar *dll_name, 00090 gchar *subdir); 00091 00092 guint g_win32_get_windows_version (void); 00093 00094 gchar* g_win32_locale_filename_from_utf8 (const gchar *utf8filename); 00095 00096 #define G_WIN32_IS_NT_BASED() (g_win32_get_windows_version () < 0x80000000) 00097 #define G_WIN32_HAVE_WIDECHAR_API() (G_WIN32_IS_NT_BASED ()) 00098 00099 G_END_DECLS 00100 00101 #endif /* G_PLATFORM_WIN32 */ 00102 00103 #endif /* __G_WIN32_H__ */