summaryrefstree
path: root/usr/share/gtk-doc/html/glib/glib-Windows-Compatibility-Functions.html
blob: 440db3180eda1942d93a05333a3a4770f3f2dd1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
<!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.78.1">
<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-UNIX-specific-utilities-and-integration.html" title="UNIX-specific utilities and integration">
<link rel="next" href="glib-data-types.html" title="GLib Data Types">
<meta name="generator" content="GTK-Doc V1.19 (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-UNIX-specific-utilities-and-integration.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">
<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">
<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">
<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">
<a name="glib-Windows-Compatibility-Functions.details"></a><h2>Details</h2>
<div class="refsect2">
<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">
<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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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">
<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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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">
<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" 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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</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>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</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">
<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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</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">
<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" 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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</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>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</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">
<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
detailed 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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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">
<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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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">
<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" 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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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">
<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 character
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">
<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.19</div>
</body>
</html>