apiw-sys 0.1.0

This crate provides core API bindings for Windows according to ECMA-234.
Documentation
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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
#![allow(unused_doc_comments)]
#[cfg(any(
    feature = "application-support-functions-string-helpers",
    feature = "application-support-functions-char-helpers"
))]
use windows_sys::Win32::Globalization as g11n;
#[cfg(feature = "application-support-functions-rect-helpers")]
use windows_sys::Win32::Graphics::Gdi as gdi;
#[cfg(feature = "application-support-functions-compressionpath-helpers")]
use windows_sys::Win32::Storage::FileSystem as storefs;
#[cfg(any(
    feature = "application-support-functions-errorlog",
    feature = "application-support-functions-errorexit",
    feature = "application-support-functions-alert"
))]
use windows_sys::Win32::System::Diagnostics::Debug as diagdbg;
#[cfg(any(
    feature = "application-support-functions-ini",
    feature = "application-support-functions-ini-nonisolated",
    feature = "application-support-functions-compute",
))]
use windows_sys::Win32::System::WindowsProgramming as winprg;
#[cfg(any(
    feature = "application-support-functions-extracticon",
    feature = "application-support-functions-findexecutable"
))]
use windows_sys::Win32::UI::Shell as shell;
#[cfg(any(
    feature = "application-support-functions-char-helpers",
    feature = "application-support-functions-string-helpers",
    feature = "application-support-functions-alert",
))]
use windows_sys::Win32::UI::WindowsAndMessaging as winmsg;
// FIXME: remove this import
#[cfg(feature = "application-support-functions-char-helpers")]
use windows_sys::Win32::UI::Controls as ctrls;
#[cfg(all(
    feature = "application-support-functions-dialog-color",
    feature = "application-support-functions-dialog-font",
    feature = "application-support-functions-dialog-findreplace",
    feature = "application-support-functions-dialog-filename",
    feature = "application-support-functions-path-helpers",
    feature = "application-support-functions-dialog-print",
))]
use windows_sys::Win32::UI::Controls::Dialogs as ctrlsdlgs;
#[cfg(feature = "application-support-functions-keycode-helpers")]
use windows_sys::Win32::UI::Input::KeyboardAndMouse as kbdmse;

/// `#403` ExtractIcon
///
/// returns a handle to an icon stored inside the `szBinary` executable, DLL, or
/// icon file
#[cfg(feature = "application-support-functions-extracticon")]
pub use shell::ExtractIconW as ExtractIcon;

/// `#404` FindExecutable
///
/// finds and retrieves the executable filename that is associated with a
/// specified filename
#[cfg(feature = "application-support-functions-findexecutable")]
pub use shell::FindExecutableW as FindExecutable;

/// `#405` GetPrivateProfileString
///
/// return a string of data from an initialization file
#[cfg(feature = "application-support-functions-ini")]
pub use winprg::GetPrivateProfileStringW as GetPrivateProfileString;

/// `#405` GetProfileString
///
/// return a string of data from the default win.ini initialization file
#[cfg(feature = "application-support-functions-ini-nonisolated")]
pub use winprg::GetProfileStringW as GetProfileString;

/// `#406` WritePrivateProfileString
///
/// write out a key string and its associated data to the requested section of
/// the specified file
#[cfg(feature = "application-support-functions-ini")]
pub use winprg::WritePrivateProfileStringW as WritePrivateProfileString;

/// `#406` WriteProfileString
///
/// write out a key string and its associated data to the requested section of
/// the default win.ini file
#[cfg(feature = "application-support-functions-ini-nonisolated")]
pub use winprg::WriteProfileStringW as WriteProfileString;

/// `#407` GetPrivateProfileInt
///
/// return an integer value from an initialization file
#[cfg(feature = "application-support-functions-ini")]
pub use winprg::GetPrivateProfileIntW as GetPrivateProfileInt;

/// `#407` GetProfileInt
///
/// return an integer value from the default win.ini initialization file
#[cfg(feature = "application-support-functions-ini-nonisolated")]
pub use winprg::GetProfileIntW as GetProfileInt;

/// `#408` AnsiLower
///
/// convert character strings to lowercase
removed_item!(
    pub use winmsg::AnsiLower;
);

/// `#408` AnsiLowerBuff
///
/// convert character strings to lowercase
removed_item!(
    pub use winmsg::AnsiLowerBuff;
);

/// `#409` AnsiUpper
///
/// convert character strings to uppercase
removed_item!(
    pub use winmsg::AnsiUpper;
);

/// `#409` AnsiUpperBuff
///
/// convert character strings to uppercase
removed_item!(
    pub use winmsg::AnsiUpperBuff;
);

/// `#410` AnsiNext
///
/// move to the next characters in the string
removed_item!(
    pub use winmsg::AnsiNext;
);

/// `#410` AnsiPrev
///
/// move to the previous characters in the string
removed_item!(
    pub use winmsg::AnsiPrev;
);

/// `#411` IsCharAlpha
///
/// tests if the character is in the set of alphabetic characters
#[cfg(feature = "application-support-functions-char-helpers")]
pub use winmsg::IsCharAlphaW as IsCharAlpha;

/// `#412` IsCharAlphaNumeric
///
/// tests if the character is in the set of alphabetic or numeric characters
#[cfg(feature = "application-support-functions-char-helpers")]
pub use winmsg::IsCharAlphaNumericW as IsCharAlphaNumeric;

/// `#413` IsCharLower
///
/// tests if the character is lower case
// FIXME: https://github.com/microsoft/windows-rs/issues/3839
#[cfg(feature = "application-support-functions-char-helpers")]
pub use ctrls::IsCharLowerW as IsCharLower;

/// `#414` IsCharUpper
///
/// tests if the character is in the set of alphabetic characters
#[cfg(feature = "application-support-functions-char-helpers")]
pub use winmsg::IsCharUpperW as IsCharUpper;

/// `#415` lstrcmp
///
/// compare two strings
#[cfg(feature = "application-support-functions-string-helpers")]
pub use g11n::lstrcmpW as lstrcmp;

/// `#415` lstrcmpi
///
/// compare two strings
#[cfg(feature = "application-support-functions-string-helpers")]
pub use g11n::lstrcmpiW as lstrcmpi;

/// `#416` lstrcat
///
/// concatenates the string `lpszSrc` to the end of `lpszDest`
#[cfg(feature = "application-support-functions-string-helpers")]
pub use g11n::lstrcatW as lstrcat;

/// `#416` lstrcpy
///
/// copy the contents from the string `lpszSrc` to the string `lpszDest`,
/// including the NULL character
#[cfg(feature = "application-support-functions-string-helpers")]
pub use g11n::lstrcpyW as lstrcpy;

/// `#416` lstrcpyn
///
/// copy the contents from the string `lpszSrc` to the string `lpszDest`,
/// including the NULL character
#[cfg(feature = "application-support-functions-string-helpers")]
pub use g11n::lstrcpynW as lstrcpyn;

/// `#417` lstrlen
///
/// returns the number of characters contained in the string, not including the
/// NULL terminator
#[cfg(feature = "application-support-functions-string-helpers")]
pub use g11n::lstrlenW as lstrlen;

/// `#418` wsprintf
///
/// format and convert the characters and values into the string `lpszOut`
#[cfg(feature = "application-support-functions-string-helpers")]
pub use winmsg::wsprintfW as wsprintf;

/// `#418` wvsprintf
///
/// format and convert the characters and values into the string `lpszOut`
#[cfg(feature = "application-support-functions-string-helpers")]
pub use winmsg::wvsprintfW as wvsprintf;

/// `#419` IsDBCSLeadByte
///
/// identifies whether the character specified by the TestChar parameter is a
/// lead byte, meaning it is the first character in a double-byte character set
/// (DBCS)
#[cfg(feature = "application-support-functions-char-helpers")]
pub use g11n::IsDBCSLeadByte;

/// `#420` ToAscii
///
/// converts the specified virtual-keycode and keyboard state to the
/// corresponding windows character or characters
#[cfg(feature = "application-support-functions-keycode-helpers")]
pub use kbdmse::ToAscii;

/// `#421` AnsiToOem
///
/// takes the string defined by `WindowsSet` and converts it into the OEM format
/// specified
removed_item!(
    pub use winmsg::AnsiToOem;
);

/// `#421` AnsiToOemBuff
///
/// takes the string defined by `WindowsSet` and converts it into the OEM format
/// specified
removed_item!(
    pub use winmsg::AnsiToOemBuff;
);

/// `#422` OemToAnsi
///
/// takes an OEM-defined string, `OemBuffer`, and converts it into a window
/// string, placing the resultant string in the buffer, `WindowsBuffer`
removed_item!(
    pub use winmsg::OemToAnsi;
);

/// `#422` OemToAnsiBuff
///
/// takes an OEM-defined string, `OemBuffer`, and converts it into a window
/// string, placing the resultant string in the buffer, `WindowsBuffer`
removed_item!(
    pub use winmsg::OemToAnsiBuff;
);

/// `#423` CopyRect
///
/// copies the elements from the source rectangle to the destination rectangle
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::CopyRect;

/// `#423` SetRect
///
/// copies the given parameters, `nLeft`, `nTop`, `nRight`, and `nBottom`, to
/// the corresponding elements in the specified rectangle
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::SetRect;

/// `#423` SetRectEmpty
///
/// sets each of the elements in the specified rectangle to zero
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::SetRectEmpty;

/// `#423` InflateRect
///
/// adds x to the right and left elements, and y to the top and bottom elements
/// of the specified triangle
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::InflateRect;

/// `#423` OffsetRect
///
/// moves the specified rectangle by the amounts given
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::OffsetRect;

/// `#424` EqualRect
///
/// compares each element of the first rectangle to its corresponding element in
/// the second rectangle
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::EqualRect;

/// `#424` IsRectEmpty
///
/// checks to see if the given rectangle is empty
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::IsRectEmpty;

/// `#424` PtInRect
///
/// checks to see if the point `lprc` lies within the rectangle
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::PtInRect;

/// `#425` IntersectRect
///
/// creates a new rectangle consisting of the largest rectangle that is
/// contained in both source rectangles
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::IntersectRect;

/// `#425` UnionRect
///
/// creates the minimum rectangle that completely encloses both of the two
/// source rectangles
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::UnionRect;

/// `#425` SubtractRect
///
/// creates a new rectangle that is the result of subtracting one rectangle from
/// another
#[cfg(feature = "application-support-functions-rect-helpers")]
pub use gdi::SubtractRect;

/// `#426` OutputDebugString
///
/// outputs the null-terminated string `lpszStr` to the debugger
#[cfg(feature = "application-support-functions-errorlog")]
pub use diagdbg::OutputDebugStringW as OutputDebugString;

/// `#427` DebugOutput
///
/// outputs the null-terminated string `lpszStr` to the debugger
removed_item!(
    pub use diagdbg::DebugOutput;
);

/// `#428` FatalAppExit
///
/// displays the null-terminated string `lpszMessage` in a message box. When the
/// user acknowledges the message, the application is terminated
#[cfg(feature = "application-support-functions-errorexit")]
pub use diagdbg::FatalAppExitW as FatalAppExit;

/// `#429` FatalExit
///
/// displays the error code `nErrCode` in the debugger and halts execution
#[cfg(feature = "application-support-functions-errorexit")]
pub use diagdbg::FatalExit;

/// `#430` QuerySendMessage
///
/// determines whether a message sent by the SendMessage() function was
/// originally sent by the current task
removed_item!(
    pub use winmsg::QuerySendMessage;
);

/// `#431` LockInput
///
/// locks keyboard and mouse input to all tasks except the current one; or all
/// locked windows are unlocked
removed_item!(
    pub use kbdmse::LockInput;
);

/// `#432` FlashWindow
///
/// flashes a window by toggling its title bar
#[cfg(feature = "application-support-functions-alert")]
pub use winmsg::FlashWindow;

/// `#433` MessageBeep
///
/// plays a sound corresponding to the alert level specified by `uAlert`
#[cfg(feature = "application-support-functions-alert")]
pub use diagdbg::MessageBeep;

/// `#434` MessageBox
///
/// displays the null-terminated string `lpszMessage` in a dialog box window
#[cfg(feature = "application-support-functions-alert")]
pub use winmsg::MessageBoxW as MessageBox;

/// `#435` SetErrorMode
///
/// allows the application to control the appearance of MS-DOS interrupt error
/// messages
#[cfg(feature = "application-support-functions-errormode")]
pub use diagdbg::SetErrorMode;

/// `#436` GetExpandedName
///
/// return the name of the original compressed file, `SourceFile`
#[cfg(feature = "application-support-functions-compressionpath-helpers")]
pub use storefs::GetExpandedNameW as GetExpandedName;

/// `#437` ChooseColor
///
/// provides the user with a modal dialog box, under the control of the `lpcc`
/// parameter, to allow for the interactive selection of a color or colors
#[cfg(feature = "application-support-functions-dialog-color")]
pub use ctrlsdlgs::ChooseColorW as ChooseColor;

/// `C.6` CHOOSECOLOR
///
/// contains information that is used by the system to initialize the Color
/// common dialog box and to return the user's Color common dialog box
/// selections
#[cfg(feature = "application-support-functions-dialog-color")]
pub use ctrlsdlgs::CHOOSECOLORW as CHOOSECOLOR;

/// `#438` ChooseFont
///
/// provides the user with a modal dialog box, under the control of the `lpcf`
/// parameter, which allows for the interactive selection of a font
#[cfg(feature = "application-support-functions-dialog-font")]
pub use ctrlsdlgs::ChooseFontW as ChooseFont;

/// `C.7` CHOOSEFONT
///
/// contains information that is used by the system to initialize the Font
/// common dialog box and to return the user's Font common dialog box selections
#[cfg(feature = "application-support-functions-dialog-font")]
pub use ctrlsdlgs::CHOOSEFONTW as CHOOSEFONT;

/// `#439` FindText
///
/// create modeless dialog boxes, under the control of the `lpfr` parameter,
/// that make it possible for users to find text within a document
#[cfg(feature = "application-support-functions-dialog-findreplace")]
pub use ctrlsdlgs::FindTextW as FindText;

/// `#439` ReplaceText
///
/// create modeless dialog boxes, under the control of the `lpfr` parameter,
/// that make it possible for users to find text within a document
#[cfg(feature = "application-support-functions-dialog-findreplace")]
pub use ctrlsdlgs::ReplaceTextW as ReplaceText;

/// `C.14` FINDREPLACE
///
/// contains information that is used by the system to initialize the Find and
/// Replace common dialog boxes and to return the user's dialog box selections
#[cfg(feature = "application-support-functions-dialog-findreplace")]
pub use ctrlsdlgs::FINDREPLACEW as FINDREPLACE;

/// `#440` GetOpenFileName
///
/// provide the user with a modal dialog box, under the control of the `lpof`
/// parameter, which allows for the interactive selection of a file, with the
/// ability to open, create and verify the file
#[cfg(feature = "application-support-functions-dialog-filename")]
pub use ctrlsdlgs::GetOpenFileNameW as GetOpenFileName;

/// `#440` GetSaveFileName
///
/// provide the user with a modal dialog box, under the control of the `lpof`
/// parameter, which allows for the interactive selection of a file, with the
/// ability to open, create and verify the file
#[cfg(feature = "application-support-functions-dialog-filename")]
pub use ctrlsdlgs::GetSaveFileNameW as GetSaveFileName;

/// `C.28` OPENFILENAME
///
/// contains information that is used by the system to initialize the Open and
/// Save common dialog boxes and to return the user's dialog box selections
#[cfg(feature = "application-support-functions-dialog-filename")]
pub use ctrlsdlgs::OPENFILENAMEW as OPENFILENAME;

/// `#441` GetFileTitle
///
/// a utility that extracts the actual filename from a filename specification,
/// `lpszFile`, that includes path information
#[cfg(feature = "application-support-functions-path-helpers")]
pub use ctrlsdlgs::GetFileTitleW as GetFileTitle;

/// `#442` PrintDlg
///
/// shows the Print or Print Setup common dialog box
#[cfg(feature = "application-support-functions-dialog-print")]
pub use ctrlsdlgs::PrintDlgW as PrintDlg;

/// `C.32` PRINTDLG
///
/// contains information that is used by the system to initialize the Print
/// common dialog box and to return the user's dialog box selections
#[cfg(feature = "application-support-functions-dialog-print")]
pub use ctrlsdlgs::PRINTDLGW as PRINTDLG;

/// `#443` CommDlgExtendedError
///
/// The last error encountered during execution of one of the common dialog
/// functions is saved and can be retrieved by this function
#[cfg(any(
    feature = "application-support-functions-dialog-color",
    feature = "application-support-functions-dialog-font",
    feature = "application-support-functions-dialog-findreplace",
    feature = "application-support-functions-dialog-filename",
    feature = "application-support-functions-dialog-print"
))]
pub use ctrlsdlgs::CommDlgExtendedError;

/// `#444` MulDiv
///
/// performs the following operation: `(Multiplicand * Multiplier) / Divisor =
/// return value`
#[cfg(feature = "application-support-functions-compute")]
pub use winprg::MulDiv;