blob: b510785e9e7f372e0b0e7262d3725adc1bcfec99 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Windows Compatibility Functions</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Testing.html" title="Testing">
<link rel="next" href="glib-data-types.html" title="GLib Data Types">
<meta name="generator" content="GTK-Doc V1.14 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Testing.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-data-types.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-Windows-Compatibility-Functions.synopsis" class="shortcut">Top</a>
 | 
<a href="#glib-Windows-Compatibility-Functions.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="Windows Compatibility Functions">
<a name="glib-Windows-Compatibility-Functions"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Windows-Compatibility-Functions.top_of_page"></a>Windows Compatibility Functions</span></h2>
<p>Windows Compatibility Functions — UNIX emulation on Windows</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="glib-Windows-Compatibility-Functions.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;glib.h&gt;
#define <a class="link" href="glib-Windows-Compatibility-Functions.html#MAXPATHLEN:CAPS" title="MAXPATHLEN">MAXPATHLEN</a>
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-error-message" title="g_win32_error_message ()">g_win32_error_message</a> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> error</code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-getlocale" title="g_win32_getlocale ()">g_win32_getlocale</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory" title="g_win32_get_package_installation_directory ()">g_win32_get_package_installation_directory</a>
(<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *package</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dll_name</code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module" title="g_win32_get_package_installation_directory_of_module ()">g_win32_get_package_installation_directory_of_module</a>
(<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> hmodule</code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-subdirectory" title="g_win32_get_package_installation_subdirectory ()">g_win32_get_package_installation_subdirectory</a>
(<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *package</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dll_name</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *subdir</code></em>);
<a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-windows-version" title="g_win32_get_windows_version ()">g_win32_get_windows_version</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* <a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-locale-filename-from-utf8" title="g_win32_locale_filename_from_utf8 ()">g_win32_locale_filename_from_utf8</a> (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *utf8filename</code></em>);
#define <a class="link" href="glib-Windows-Compatibility-Functions.html#G-WIN32-DLLMAIN-FOR-DLL-NAME:CAPS" title="G_WIN32_DLLMAIN_FOR_DLL_NAME()">G_WIN32_DLLMAIN_FOR_DLL_NAME</a> (static,
dll_name)
#define <a class="link" href="glib-Windows-Compatibility-Functions.html#G-WIN32-HAVE-WIDECHAR-API:CAPS" title="G_WIN32_HAVE_WIDECHAR_API">G_WIN32_HAVE_WIDECHAR_API</a>
#define <a class="link" href="glib-Windows-Compatibility-Functions.html#G-WIN32-IS-NT-BASED:CAPS" title="G_WIN32_IS_NT_BASED">G_WIN32_IS_NT_BASED</a>
</pre>
</div>
<div class="refsect1" title="Description">
<a name="glib-Windows-Compatibility-Functions.description"></a><h2>Description</h2>
<p>
These functions provide some level of UNIX emulation on the Windows platform.
If your application really needs the POSIX APIs, we suggest you try the Cygwin
project.
</p>
</div>
<div class="refsect1" title="Details">
<a name="glib-Windows-Compatibility-Functions.details"></a><h2>Details</h2>
<div class="refsect2" title="MAXPATHLEN">
<a name="MAXPATHLEN:CAPS"></a><h3>MAXPATHLEN</h3>
<pre class="programlisting">#define MAXPATHLEN 1024
</pre>
<p>
Provided for UNIX emulation on Windows; equivalent to UNIX
macro <a class="link" href="glib-Windows-Compatibility-Functions.html#MAXPATHLEN:CAPS" title="MAXPATHLEN"><code class="literal">MAXPATHLEN</code></a>, which is the maximum length of a filename
(including full path).
</p>
</div>
<hr>
<div class="refsect2" title="g_win32_error_message ()">
<a name="g-win32-error-message"></a><h3>g_win32_error_message ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_win32_error_message (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> error</code></em>);</pre>
<p>
Translate a Win32 error code (as returned by <code class="function">GetLastError()</code>) into
the corresponding message. The message is either language neutral,
or in the thread's language, or the user's language, the system's
language, or US English (see docs for <code class="function">FormatMessage()</code>). The
returned string is in UTF-8. It should be deallocated with
<a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>error code.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> newly-allocated error message
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_win32_getlocale ()">
<a name="g-win32-getlocale"></a><h3>g_win32_getlocale ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_win32_getlocale (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
The <a class="link" href="glib-running.html#setlocale" title="Locale"><code class="function">setlocale()</code></a> function in the Microsoft C library uses locale
names of the form "English_United States.1252" etc. We want the
UNIXish standard form "en_US", "zh_TW" etc. This function gets the
current thread locale from Windows - without any encoding info -
and returns it as a string of the above form for use in forming
file names etc. The returned string should be deallocated with
<a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> newly-allocated locale name.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_win32_get_package_installation_directory ()">
<a name="g-win32-get-package-installation-directory"></a><h3>g_win32_get_package_installation_directory ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_win32_get_package_installation_directory
(<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *package</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dll_name</code></em>);</pre>
<div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_win32_get_package_installation_directory</code> has been deprecated since version 2.18 and should not be used in newly-written code. Pass the HMODULE of a DLL or EXE to
<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module" title="g_win32_get_package_installation_directory_of_module ()"><code class="function">g_win32_get_package_installation_directory_of_module()</code></a> instead.</p>
</div>
<p>
Try to determine the installation directory for a software package.
</p>
<p>
This function is deprecated. Use
<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module" title="g_win32_get_package_installation_directory_of_module ()"><code class="function">g_win32_get_package_installation_directory_of_module()</code></a> instead.
</p>
<p>
The use of <em class="parameter"><code>package</code></em> is deprecated. You should always pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. A
warning is printed if non-NULL is passed as <em class="parameter"><code>package</code></em>.
</p>
<p>
The original intended use of <em class="parameter"><code>package</code></em> was for a short identifier of
the package, typically the same identifier as used for
<code class="literal">GETTEXT_PACKAGE</code> in software configured using GNU
autotools. The function first looks in the Windows Registry for the
value <code class="literal">#InstallationDirectory</code> in the key
<code class="literal">#HKLM\Software@package</code>, and if that value
exists and is a string, returns that.
</p>
<p>
It is strongly recommended that packagers of GLib-using libraries
for Windows do not store installation paths in the Registry to be
used by this function as that interfers with having several
parallel installations of the library. Enabling multiple
installations of different versions of some GLib-using library, or
GLib itself, is desirable for various reasons.
</p>
<p>
For this reason it is recommeded to always pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> as
<em class="parameter"><code>package</code></em> to this function, to avoid the temptation to use the
Registry. In version 2.20 of GLib the <em class="parameter"><code>package</code></em> parameter
will be ignored and this function won't look in the Registry at all.
</p>
<p>
If <em class="parameter"><code>package</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, or the above value isn't found in the
Registry, but <em class="parameter"><code>dll_name</code></em> is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, it should name a DLL loaded
into the current process. Typically that would be the name of the
DLL calling this function, looking for its installation
directory. The function then asks Windows what directory that DLL
was loaded from. If that directory's last component is "bin" or
"lib", the parent directory is returned, otherwise the directory
itself. If that DLL isn't loaded, the function proceeds as if
<em class="parameter"><code>dll_name</code></em> was <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
</p>
<p>
If both <em class="parameter"><code>package</code></em> and <em class="parameter"><code>dll_name</code></em> are <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, the directory from where
the main executable of the process was loaded is used instead in
the same way as above.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>package</code></em> :</span></p></td>
<td>You should pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> for this.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dll_name</code></em> :</span></p></td>
<td>The name of a DLL that a package provides in UTF-8, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a string containing the installation directory for
<em class="parameter"><code>package</code></em>. The string is in the GLib file name encoding,
i.e. UTF-8. The return value should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when not
needed any longer. If the function fails <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_win32_get_package_installation_directory_of_module ()">
<a name="g-win32-get-package-installation-directory-of-module"></a><h3>g_win32_get_package_installation_directory_of_module ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_win32_get_package_installation_directory_of_module
(<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> hmodule</code></em>);</pre>
<p>
This function tries to determine the installation directory of a
software package based on the location of a DLL of the software
package.
</p>
<p>
<em class="parameter"><code>hmodule</code></em> should be the handle of a loaded DLL or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The
function looks up the directory that DLL was loaded from. If
<em class="parameter"><code>hmodule</code></em> is NULL, the directory the main executable of the current
process is looked up. If that directory's last component is "bin"
or "lib", its parent directory is returned, otherwise the directory
itself.
</p>
<p>
It thus makes sense to pass only the handle to a "public" DLL of a
software package to this function, as such DLLs typically are known
to be installed in a "bin" or occasionally "lib" subfolder of the
installation folder. DLLs that are of the dynamically loaded module
or plugin variety are often located in more private locations
deeper down in the tree, from which it is impossible for GLib to
deduce the root of the package installation.
</p>
<p>
The typical use case for this function is to have a <code class="function">DllMain()</code> that
saves the handle for the DLL. Then when code in the DLL needs to
construct names of files in the installation tree it calls this
function passing the DLL handle.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>hmodule</code></em> :</span></p></td>
<td>The Win32 handle for a DLL loaded into the current process, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a string containing the guessed installation directory for
the software package <em class="parameter"><code>hmodule</code></em> is from. The string is in the GLib
file name encoding, i.e. UTF-8. The return value should be freed
with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when not needed any longer. If the function fails
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2" title="g_win32_get_package_installation_subdirectory ()">
<a name="g-win32-get-package-installation-subdirectory"></a><h3>g_win32_get_package_installation_subdirectory ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_win32_get_package_installation_subdirectory
(<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *package</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dll_name</code></em>,
<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *subdir</code></em>);</pre>
<div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_win32_get_package_installation_subdirectory</code> has been deprecated since version 2.18 and should not be used in newly-written code. Pass the HMODULE of a DLL or EXE to
<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module" title="g_win32_get_package_installation_directory_of_module ()"><code class="function">g_win32_get_package_installation_directory_of_module()</code></a> instead, and
then construct a subdirectory pathname with <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-build-filename" title="g_build_filename ()"><code class="function">g_build_filename()</code></a>.</p>
</div>
<p>
This function is deprecated. Use
<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory-of-module" title="g_win32_get_package_installation_directory_of_module ()"><code class="function">g_win32_get_package_installation_directory_of_module()</code></a> and
<a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-build-filename" title="g_build_filename ()"><code class="function">g_build_filename()</code></a> instead.
</p>
<p>
Returns a newly-allocated string containing the path of the
subdirectory <em class="parameter"><code>subdir</code></em> in the return value from calling
<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory" title="g_win32_get_package_installation_directory ()"><code class="function">g_win32_get_package_installation_directory()</code></a> with the <em class="parameter"><code>package</code></em> and
<em class="parameter"><code>dll_name</code></em> parameters. See the documentation for
<a class="link" href="glib-Windows-Compatibility-Functions.html#g-win32-get-package-installation-directory" title="g_win32_get_package_installation_directory ()"><code class="function">g_win32_get_package_installation_directory()</code></a> for more details. In
particular, note that it is deprecated to pass anything except NULL
as <em class="parameter"><code>package</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>package</code></em> :</span></p></td>
<td>You should pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> for this.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dll_name</code></em> :</span></p></td>
<td>The name of a DLL that a package provides, in UTF-8, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>subdir</code></em> :</span></p></td>
<td>A subdirectory of the package installation directory, also in UTF-8
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a string containing the complete path to <em class="parameter"><code>subdir</code></em> inside
the installation directory of <em class="parameter"><code>package</code></em>. The returned string is in
the GLib file name encoding, i.e. UTF-8. The return value should be
freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no longer needed. If something goes wrong,
<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_win32_get_windows_version ()">
<a name="g-win32-get-windows-version"></a><h3>g_win32_get_windows_version ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a> g_win32_get_windows_version (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Returns version information for the Windows operating system the
code is running on. See MSDN documentation for the <code class="function">GetVersion()</code>
function. To summarize, the most significant bit is one on Win9x,
and zero on NT-based systems. Since version 2.14, GLib works only
on NT-based systems, so checking whether your are running on Win9x
in your own software is moot. The least significant byte is 4 on
Windows NT 4, and 5 on Windows XP. Software that needs really
detailled version and feature information should use Win32 API like
<code class="function">GetVersionEx()</code> and <code class="function">VerifyVersionInfo()</code>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The version information.
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="g_win32_locale_filename_from_utf8 ()">
<a name="g-win32-locale-filename-from-utf8"></a><h3>g_win32_locale_filename_from_utf8 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>* g_win32_locale_filename_from_utf8 (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *utf8filename</code></em>);</pre>
<p>
Converts a filename from UTF-8 to the system codepage.
</p>
<p>
On NT-based Windows, on NTFS file systems, file names are in
Unicode. It is quite possible that Unicode file names contain
characters not representable in the system codepage. (For instance,
Greek or Cyrillic characters on Western European or US Windows
installations, or various less common CJK characters on CJK Windows
installations.)
</p>
<p>
In such a case, and if the filename refers to an existing file, and
the file system stores alternate short (8.3) names for directory
entries, the short form of the filename is returned. Note that the
"short" name might in fact be longer than the Unicode name if the
Unicode name has very short pathname components containing
non-ASCII characters. If no system codepage name for the file is
possible, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned.
</p>
<p>
The return value is dynamically allocated and should be freed with
<a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no longer needed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>utf8filename</code></em> :</span></p></td>
<td>a UTF-8 encoded filename.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The converted filename, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> on conversion
failure and lack of short names.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" title="G_WIN32_DLLMAIN_FOR_DLL_NAME()">
<a name="G-WIN32-DLLMAIN-FOR-DLL-NAME:CAPS"></a><h3>G_WIN32_DLLMAIN_FOR_DLL_NAME()</h3>
<pre class="programlisting">#define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)</pre>
<div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">G_WIN32_DLLMAIN_FOR_DLL_NAME</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
On Windows, this macro defines a <code class="function">DllMain()</code> function that stores the actual
DLL name that the code being compiled will be included in.
</p>
<p>
On non-Windows platforms, expands to nothing.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>static</code></em> :</span></p></td>
<td>empty or "static".
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dll_name</code></em> :</span></p></td>
<td>the name of the (pointer to the) char array where the DLL name
will be stored. If this is used, you must also include
<code class="filename">windows.h</code>. If you need a more complex DLL entry
point function, you cannot use this.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="G_WIN32_HAVE_WIDECHAR_API">
<a name="G-WIN32-HAVE-WIDECHAR-API:CAPS"></a><h3>G_WIN32_HAVE_WIDECHAR_API</h3>
<pre class="programlisting">#define G_WIN32_HAVE_WIDECHAR_API() TRUE
</pre>
<p>
On Windows, this macro defines an expression which evaluates to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>
if the code is running on a version of Windows where the wide
character versions of the Win32 API functions, and the wide chaacter
versions of the C library functions work. (They are always present in
the DLLs, but don't work on Windows 9x and Me.)
</p>
<p>
On non-Windows platforms, it is not defined.
</p>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2" title="G_WIN32_IS_NT_BASED">
<a name="G-WIN32-IS-NT-BASED:CAPS"></a><h3>G_WIN32_IS_NT_BASED</h3>
<pre class="programlisting">#define G_WIN32_IS_NT_BASED() TRUE
</pre>
<p>
On Windows, this macro defines an expression which evaluates to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>
if the code is running on an NT-based Windows operating system.
</p>
<p>
On non-Windows platforms, it is not defined.
</p>
<p class="since">Since 2.6</p>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.14</div>
</body>
</html>