apiw_sys/
lib.rs

1#![deny(unused_imports, missing_docs)]
2
3//! Application Programming Interface for Windows (APIW) is a functional
4//! specification of the Microsoft Windows application programming interface,
5//! published as ECMA-234 in 1995.
6//!
7//! This crate tries its best to faithfully provided the original interface
8//! defined within the specification, the implementation is based on the awesome
9//! `windows-sys` crate provided by Microsoft for the Rust community. It is well
10//! known that some of the functions has been deleted after the specification is
11//! published over the years, sometimes replaced by something else (usually with
12//! similiar namings!), so we also included those functions within this crate
13//! too.
14//!
15//! Also, for the completeness of the EMF representable graphics subsystem
16//! operations, we expanded the API surface of `graphics_subsystem` feature to
17//! also include those operations added since then. EMF stands for Enhanced
18//! Metafile Format, an EMF metafile is a sequence of variable-length records
19//! that contain drawing commands, object definitions, and graphics properties
20//! to render a graphical image on any output device. Thus those drawing
21//! commands are provided as the major part of the `graphics_subsystem`. See the
22//! \[MS-EMF\] document supplied as part of the Microsoft Open Specifications
23//! collection for more details about it.
24
25#[macro_use]
26mod macros;
27
28/// Section 2 - Windows Subsystem (6-167)
29#[cfg(any(
30    feature = "windows-subsystem-basic",
31    feature = "windows-subsystem",
32    feature = "graphics-subsystem"
33))]
34pub mod windows_subsystem;
35
36/// Section 3 - Graphics Subsystem (168-304)
37#[cfg(any(feature = "graphics-subsystem-basic", feature = "graphics-subsystem"))]
38pub mod graphics_subsystem;
39
40/// Section 4 - System Services (305-402)
41#[cfg(feature = "system-services")]
42pub mod system_services;
43
44/// Section 5 - Application Support Functions (403-444)
45#[cfg(feature = "application-support-functions")]
46pub mod application_support_functions;
47
48#[cfg(any(
49    feature = "extension-compression",
50    feature = "extension-control-panel",
51    feature = "extension-dde",
52    feature = "extension-debugging",
53    feature = "extension-drag-and-drop",
54    feature = "extension-driver",
55    feature = "extension-edit-control",
56    feature = "extension-file-io",
57    feature = "extension-font",
58    feature = "extension-hook-callback",
59    feature = "extension-networking",
60    feature = "extension-shell",
61    feature = "extension-version"
62))]
63/// Annex B - Unsupported Windows Functions (provided here as extensions)
64pub mod extensions {
65    #![allow(missing_docs)]
66    #[cfg(feature = "extension-compression")]
67    pub mod compression;
68    #[cfg(feature = "extension-control-panel")]
69    pub mod control_panel;
70    #[cfg(feature = "extension-dde")]
71    pub mod dde;
72    #[cfg(feature = "extension-debugging")]
73    pub mod debugging;
74    #[cfg(feature = "extension-drag-and-drop")]
75    pub mod drag_and_drop;
76    #[cfg(feature = "extension-driver")]
77    pub mod driver;
78    #[cfg(feature = "extension-edit-control")]
79    pub mod edit_control;
80    #[cfg(feature = "extension-file-io")]
81    pub mod file_io;
82    removed_item!(
83        pub mod file_manager {
84            pub use storefs::UndeleteFile;
85            use windows_sys::Win32::Storage::FileSystem as storefs;
86        }
87    );
88    #[cfg(feature = "extension-font")]
89    pub mod font;
90    removed_item!(
91        pub mod hardware {
92            pub use kbdmse::EnableHardwareInput;
93            use windows_sys::Win32::UI::Input::KeyboardAndMouse as kbdmse;
94        }
95    );
96    #[cfg(feature = "extension-hook-callback")]
97    pub mod hook_callback;
98    removed_item!(
99        pub mod memory_management {
100            use windows_sys::Win32::System::Memory as sysmem;
101
102            pub use sysmem::GetSelectorBase;
103            pub use sysmem::GetSelectorLimit;
104            pub use sysmem::GlobalDosAlloc;
105            pub use sysmem::GlobalDosFree;
106            pub use sysmem::LimitEmsPages;
107            pub use sysmem::LockSegment;
108            pub use sysmem::SetSelectorBase;
109            pub use sysmem::SetSelectorLimit;
110            pub use sysmem::SetSwapAreaSize;
111            pub use sysmem::SwitchStackBack;
112            pub use sysmem::SwitchStackTo;
113            pub use sysmem::UnlockSegment;
114            pub use sysmem::hmemcopy;
115        }
116    );
117    removed_item!(
118        pub mod module_management {
119            use windows_sys::Win32::System::Memory as sysmem;
120
121            pub use sysmem::GetCodeHandle;
122        }
123    );
124    removed_item!(
125        pub mod message {
126            use windows_sys::Win32::UI::WindowsAndMessaging as winmsg;
127
128            pub use winmsg::hardware_event;
129        }
130    );
131    #[cfg(feature = "extension-networking")]
132    pub mod networking;
133    removed_item!(
134        pub mod ole {
135            use windows_sys::Win32::System::Ole as ole;
136
137            pub use ole::OleActivate;
138            pub use ole::OleBlockServer;
139            pub use ole::OleClone;
140            pub use ole::OleClose;
141            pub use ole::OleCopyFromLink;
142            pub use ole::OleCopyToClipboard;
143            pub use ole::OleCreate;
144            pub use ole::OleCreateFromClip;
145            pub use ole::OleCreateFromFile;
146            pub use ole::OleCreateFromTemplate;
147            pub use ole::OleCreateInvisible;
148            pub use ole::OleCreateLinkFromClip;
149            pub use ole::OleCreateLinkFromFile;
150            pub use ole::OleDelete;
151            pub use ole::OleDraw;
152            pub use ole::OleEnumFormats;
153            pub use ole::OleEnumObjects;
154            pub use ole::OleEqual;
155            pub use ole::OleExecute;
156            pub use ole::OleGetData;
157            pub use ole::OleGetLinkUpdateOptions;
158            pub use ole::OleIsDcMeta;
159            pub use ole::OleLoadFromStream;
160            pub use ole::OleLockServer;
161            pub use ole::OleObjectConvert;
162            pub use ole::OleQueryBounds;
163            pub use ole::OleQueryClientVersion;
164            pub use ole::OleQueryCreateFromClip;
165            pub use ole::OleQueryLinkFromClip;
166            pub use ole::OleQueryName;
167            pub use ole::OleQueryOpen;
168            pub use ole::OleQueryOutOfDate;
169            pub use ole::OleQueryProtocol;
170            pub use ole::OleQueryReleaseError;
171            pub use ole::OleQueryReleaseMethod;
172            pub use ole::OleQueryReleaseStatus;
173            pub use ole::OleQueryServerVersion;
174            pub use ole::OleQuerySize;
175            pub use ole::OleQueryType;
176            pub use ole::OleReconnect;
177            pub use ole::OleRegisterClientDoc;
178            pub use ole::OleRegisterServer;
179            pub use ole::OleRegisterServerDoc;
180            pub use ole::OleRelease;
181            pub use ole::OleRename;
182            pub use ole::OleRenameClientDoc;
183            pub use ole::OleRenameServerDoc;
184            pub use ole::OleRequestData;
185            pub use ole::OleRevertClientDoc;
186            pub use ole::OleRevertServerDoc;
187            pub use ole::OleRevokeClientDoc;
188            pub use ole::OleRevokeObject;
189            pub use ole::OleRevokeServer;
190            pub use ole::OleRevokeServerDoc;
191            pub use ole::OleSaveToStream;
192            pub use ole::OleSavedClientDoc;
193            pub use ole::OleSavedServerDoc;
194            pub use ole::OleSetBounds;
195            pub use ole::OleSetColorScheme;
196            pub use ole::OleSetData;
197            pub use ole::OleSetHostNames;
198            pub use ole::OleSetLinkUpdateOptions;
199            pub use ole::OleSetTargetDevice;
200            pub use ole::OleUnblockServer;
201            pub use ole::OleUnlockServer;
202            pub use ole::OleUpdate;
203            pub use ole::Open;
204        }
205    );
206    removed_item!(
207        pub mod profiler {
208            pub use diagdbg::ProfClear;
209            pub use diagdbg::ProfFinish;
210            pub use diagdbg::ProfFlush;
211            pub use diagdbg::ProfInsChk;
212            pub use diagdbg::ProfSampRate;
213            pub use diagdbg::ProfSetup;
214            pub use diagdbg::ProfStart;
215            pub use diagdbg::ProfStop;
216            use windows_sys::Win32::System::Diagnostics::Debug as diagdbg;
217        }
218    );
219    removed_item!(
220        pub mod program_manager {
221            use windows_sys::Win32::System::WindowsProgramming as winprg;
222            pub use winprg::FMExtensionProc;
223        }
224    );
225    removed_item!(
226        pub mod process_management {
227            pub use diagdbg::GetCurrentPDB;
228            use windows_sys::Win32::System::Diagnostics::Debug as diagdbg;
229        }
230    );
231    removed_item!(
232        pub mod resource_manager {
233            pub use libloader::AccessResource;
234            use windows_sys::Win32::System::LibraryLoader as libloader;
235        }
236    );
237    removed_item!(
238        pub mod segment {
239            pub use sysmem::AllocDStoCSAlias;
240            pub use sysmem::AllocSelector;
241            pub use sysmem::FreeSelector;
242            pub use sysmem::GetCodeInfo;
243            pub use sysmem::GlobalPageLock;
244            pub use sysmem::GlobalPageUnlock;
245            pub use sysmem::PrestoChangoSelector;
246            use windows_sys::Win32::System::Memory as sysmem;
247        }
248    );
249    #[cfg(feature = "extension-shell")]
250    pub mod shell;
251    removed_item!(
252        pub mod stress {
253            use windows_sys::Win32::System::WindowsProgramming as winprg;
254            pub use winprg::AllocDiskSpace;
255            pub use winprg::AllocFileHandles;
256            pub use winprg::AllocGDIMem;
257            pub use winprg::AllocMem;
258            pub use winprg::AllocUserMem;
259            pub use winprg::FreeAllGDIMem;
260            pub use winprg::FreeAllMem;
261            pub use winprg::FreeAllUserMem;
262            pub use winprg::GetFreeFileHandles;
263            pub use winprg::UnAllocDiskSpace;
264            pub use winprg::UnAllocFileHandles;
265        }
266    );
267    removed_item!(
268        pub mod system_services {
269            use windows_sys::Win32::System::WindowsProgramming as winprg;
270            pub use winprg::DOS3Call;
271            pub use winprg::GetDOSEnvironment;
272            pub use winprg::NetBIOSCall;
273            pub use winprg::WaitEvent;
274        }
275    );
276    removed_item!(
277        pub mod toolhelp {
278            use windows_sys::Win32::System::Diagnostics::Debug as diagdbg;
279
280            pub use diagdbg::ClassFirst;
281            pub use diagdbg::ClassNext;
282            pub use diagdbg::GlobalEntryHandle;
283            pub use diagdbg::GlobalEntryModule;
284            pub use diagdbg::GlobalFirst;
285            pub use diagdbg::GlobalHandleToSel;
286            pub use diagdbg::GlobalInfo;
287            pub use diagdbg::GlobalNext;
288            pub use diagdbg::InterruptRegister;
289            pub use diagdbg::InterruptUnRegister;
290            pub use diagdbg::LocalFirst;
291            pub use diagdbg::LocalInfo;
292            pub use diagdbg::LocalNext;
293            pub use diagdbg::MemManInfo;
294            pub use diagdbg::MemoryRead;
295            pub use diagdbg::MemoryWrite;
296            pub use diagdbg::ModuleFindHandle;
297            pub use diagdbg::ModuleFindName;
298            pub use diagdbg::ModuleFirst;
299            pub use diagdbg::ModuleNext;
300            pub use diagdbg::NotifyRegister;
301            pub use diagdbg::NotifyUnregister;
302            pub use diagdbg::StackTraceCSIPFirst;
303            pub use diagdbg::StackTraceFirst;
304            pub use diagdbg::StackTraceNext;
305            pub use diagdbg::SystemHeapInfo;
306            pub use diagdbg::TaskFindHandle;
307            pub use diagdbg::TaskFirst;
308            pub use diagdbg::TaskGetCSIP;
309            pub use diagdbg::TaskNext;
310            pub use diagdbg::TaskSetCSIP;
311            pub use diagdbg::TaskSwitch;
312            pub use diagdbg::TerminateApp;
313            pub use diagdbg::TimerCount;
314        }
315    );
316    #[cfg(feature = "extension-version")]
317    pub mod version;
318    removed_item!(
319        pub mod winmem32 {
320            use windows_sys::Win32::System::Memory as sysmem;
321
322            pub use sysmem::GetWinMem32Version;
323            pub use sysmem::Global16PointerAlloc;
324            pub use sysmem::Global16PointerFree;
325            pub use sysmem::Global32Alloc;
326            pub use sysmem::Global32CodeAlias;
327            pub use sysmem::Global32CodeAliasFree;
328            pub use sysmem::Global32Free;
329            pub use sysmem::Global32Realloc;
330        }
331    );
332}
333
334/// Annex C - Data Structures
335#[cfg(any(
336    feature = "windows-subsystem-basic",
337    feature = "graphics-subsystem-basic",
338    feature = "system-services",
339    feature = "application-support-functions"
340))]
341pub mod all_data_structures {
342    #![allow(unused_doc_comments)]
343
344    #[cfg(feature = "graphics-subsystem-basic")]
345    use windows_sys::Win32::Graphics::Gdi as gdi;
346
347    #[cfg(feature = "graphics-subsystem-basic")]
348    #[doc(inline)]
349    pub use crate::graphics_subsystem::BITMAP;
350
351    /// `C.2` BITMAPCOREHEADER
352    ///
353    /// contains information about a device-independent bitmap's (DIB)
354    /// dimensions and color format
355    #[cfg(feature = "graphics-subsystem-basic")]
356    pub use gdi::BITMAPCOREHEADER;
357
358    /// `C.3` BITMAPCOREINFO
359    ///
360    /// contains information about a device-independent bitmap's (DIB)
361    /// dimensions, color format, and colors used in the bitmap
362    #[cfg(feature = "graphics-subsystem-basic")]
363    pub use gdi::BITMAPCOREINFO;
364
365    #[cfg(feature = "graphics-subsystem-basic")]
366    #[doc(inline)]
367    pub use crate::graphics_subsystem::BITMAPINFOHEADER;
368
369    #[cfg(feature = "graphics-subsystem-basic")]
370    #[doc(inline)]
371    pub use crate::graphics_subsystem::BITMAPINFO;
372
373    #[cfg(feature = "application-support-functions-dialog-color")]
374    #[doc(inline)]
375    pub use crate::application_support_functions::CHOOSECOLOR;
376
377    #[cfg(feature = "application-support-functions-dialog-font")]
378    #[doc(inline)]
379    pub use crate::application_support_functions::CHOOSEFONT;
380
381    /// `C.8` CLASSENTRY
382    ///
383    /// contains the handle to the owner and name of a class
384    removed_item!(
385        pub use crate::extensions::toolhelp::CLASSENTRY;
386    );
387
388    #[cfg(feature = "windows-subsystem-mdi")]
389    #[doc(inline)]
390    pub use crate::windows_subsystem::CLIENTCREATESTRUCT;
391
392    #[cfg(all(
393        feature = "windows-subsystem-message",
394        any(
395            feature = "windows-subsystem-control-combobox",
396            feature = "windows-subsystem-control-listbox"
397        )
398    ))]
399    #[doc(inline)]
400    pub use crate::windows_subsystem::COMPAREITEMSTRUCT;
401
402    #[cfg(feature = "windows-subsystem-basic")]
403    #[doc(inline)]
404    pub use crate::windows_subsystem::CREATESTRUCT;
405
406    #[cfg(all(
407        feature = "windows-subsystem-message",
408        any(
409            feature = "windows-subsystem-control-combobox",
410            feature = "windows-subsystem-control-listbox"
411        )
412    ))]
413    #[doc(inline)]
414    pub use crate::windows_subsystem::DELETEITEMSTRUCT;
415
416    #[cfg(feature = "windows-subsystem-message")]
417    #[doc(inline)]
418    pub use crate::windows_subsystem::DRAWITEMSTRUCT;
419
420    #[cfg(feature = "application-support-functions-dialog-findreplace")]
421    #[doc(inline)]
422    pub use crate::application_support_functions::FINDREPLACE;
423
424    #[cfg(feature = "system-services-winhelp")]
425    #[doc(inline)]
426    pub use crate::system_services::HELPWININFO;
427
428    #[cfg(feature = "graphics-subsystem-basic")]
429    #[doc(inline)]
430    pub use crate::graphics_subsystem::LOGBRUSH;
431
432    #[cfg(feature = "graphics-subsystem-basic")]
433    #[doc(inline)]
434    pub use crate::graphics_subsystem::LOGFONT;
435
436    #[cfg(feature = "graphics-subsystem-basic")]
437    #[doc(inline)]
438    pub use crate::graphics_subsystem::LOGPALETTE;
439
440    #[cfg(feature = "graphics-subsystem-basic")]
441    #[doc(inline)]
442    pub use crate::graphics_subsystem::LOGPEN;
443
444    #[cfg(feature = "windows-subsystem-mdi")]
445    #[doc(inline)]
446    pub use crate::windows_subsystem::MDICREATESTRUCT;
447
448    #[cfg(feature = "windows-subsystem-message")]
449    #[doc(inline)]
450    pub use crate::windows_subsystem::MEASUREITEMSTRUCT;
451
452    #[cfg(feature = "system-services-resource")]
453    #[doc(inline)]
454    pub use crate::system_services::MENUITEMTEMPLATE;
455
456    #[cfg(feature = "system-services-resource")]
457    #[doc(inline)]
458    pub use crate::system_services::MENUITEMTEMPLATEHEADER;
459
460    #[cfg(feature = "windows-subsystem-message")]
461    #[doc(inline)]
462    pub use crate::windows_subsystem::MINMAXINFO;
463
464    #[cfg(feature = "windows-subsystem-message")]
465    #[doc(inline)]
466    pub use crate::windows_subsystem::MSG;
467
468    #[cfg(feature = "graphics-subsystem-basic")]
469    #[doc(inline)]
470    pub use crate::graphics_subsystem::NEWTEXTMETRIC;
471
472    #[cfg(feature = "system-services-fileop-deprecated")]
473    #[doc(inline)]
474    pub use crate::system_services::OFSTRUCT;
475
476    #[cfg(feature = "application-support-functions-dialog-filename")]
477    #[doc(inline)]
478    pub use crate::application_support_functions::OPENFILENAME;
479
480    #[cfg(feature = "windows-subsystem-paint")]
481    #[doc(inline)]
482    pub use crate::windows_subsystem::PAINTSTRUCT;
483
484    #[cfg(feature = "graphics-subsystem-basic")]
485    #[doc(inline)]
486    pub use crate::graphics_subsystem::PALETTEENTRY;
487
488    #[cfg(feature = "graphics-subsystem-basic")]
489    #[doc(inline)]
490    pub use crate::graphics_subsystem::POINT;
491
492    #[cfg(feature = "application-support-functions-dialog-print")]
493    #[doc(inline)]
494    pub use crate::application_support_functions::PRINTDLG;
495
496    #[cfg(feature = "graphics-subsystem-basic")]
497    #[doc(inline)]
498    pub use crate::graphics_subsystem::RECT;
499
500    #[cfg(feature = "graphics-subsystem-basic")]
501    #[doc(inline)]
502    pub use crate::graphics_subsystem::RGBQUAD;
503
504    #[cfg(feature = "graphics-subsystem-basic")]
505    #[doc(inline)]
506    pub use crate::graphics_subsystem::RGBTRIPLE;
507
508    #[cfg(feature = "graphics-subsystem-basic")]
509    #[doc(inline)]
510    pub use crate::graphics_subsystem::SIZE;
511
512    #[cfg(feature = "graphics-subsystem-basic")]
513    #[doc(inline)]
514    pub use crate::graphics_subsystem::TEXTMETRIC;
515
516    #[cfg(feature = "windows-subsystem-placement")]
517    #[doc(inline)]
518    pub use crate::windows_subsystem::WINDOWPLACEMENT;
519
520    #[cfg(feature = "windows-subsystem-placement")]
521    #[doc(inline)]
522    pub use crate::windows_subsystem::WINDOWPOS;
523
524    #[cfg(feature = "windows-subsystem-basic")]
525    #[doc(inline)]
526    pub use crate::windows_subsystem::WNDCLASS;
527}
528
529/// Annex D - Window Messages
530#[cfg(feature = "windows-subsystem")]
531pub mod all_messages {
532    // Window messages for button (D.1 - D.5)
533    #[cfg(all(
534        feature = "windows-subsystem-message",
535        feature = "windows-subsystem-control-button"
536    ))]
537    #[doc(inline)]
538    pub use crate::windows_subsystem::window_messages_for_button::*;
539
540    // Window messages for combo box (D.6 - D.30)
541    #[cfg(all(
542        feature = "windows-subsystem-message",
543        feature = "windows-subsystem-control-combobox"
544    ))]
545    #[doc(inline)]
546    pub use crate::windows_subsystem::window_messages_for_combobox::*;
547
548    // Window messages for dialog box (D.31 - D.32)
549    #[cfg(all(
550        feature = "windows-subsystem-message",
551        feature = "windows-subsystem-dialogbox"
552    ))]
553    #[doc(inline)]
554    pub use crate::windows_subsystem::window_messages_for_dialogbox::*;
555
556    // Window messages for edit (D.33 - D.60)
557    #[cfg(all(
558        feature = "windows-subsystem-message",
559        feature = "windows-subsystem-control-edit"
560    ))]
561    #[doc(inline)]
562    pub use crate::windows_subsystem::window_messages_for_edit::*;
563
564    // Window messages for combo box (D.61 - D.91)
565    #[cfg(all(
566        feature = "windows-subsystem-message",
567        feature = "windows-subsystem-control-listbox"
568    ))]
569    #[doc(inline)]
570    pub use crate::windows_subsystem::window_messages_for_listbox::*;
571
572    // Window messages for static (D.92 - D.93)
573    #[cfg(all(
574        feature = "windows-subsystem-message",
575        feature = "windows-subsystem-control-static"
576    ))]
577    #[doc(inline)]
578    pub use crate::windows_subsystem::window_messages_for_static::*;
579
580    // General window messages (D.94 - D.217)
581    #[cfg(feature = "windows-subsystem-message")]
582    #[doc(inline)]
583    pub use crate::windows_subsystem::general_window_messages::*;
584}
585
586/// Annex E - Control Notifications
587#[cfg(feature = "windows-subsystem")]
588pub mod all_control_notifications {
589    // Control notifications for button (E.1 - E.6)
590    #[cfg(all(
591        feature = "windows-subsystem-message",
592        feature = "windows-subsystem-control-button"
593    ))]
594    #[doc(inline)]
595    pub use crate::windows_subsystem::control_notifications_for_button::*;
596
597    // Control notifications for combo box (E.7 - E.17)
598    #[cfg(all(
599        feature = "windows-subsystem-message",
600        feature = "windows-subsystem-control-combobox"
601    ))]
602    #[doc(inline)]
603    pub use crate::windows_subsystem::control_notifications_for_combobox::*;
604
605    // Control notifications for edit (E.18 - E.25)
606    #[cfg(all(
607        feature = "windows-subsystem-message",
608        feature = "windows-subsystem-control-edit"
609    ))]
610    #[doc(inline)]
611    pub use crate::windows_subsystem::control_notifications_for_edit::*;
612
613    // Control notifications for list box (E.26 - E.31)
614    #[cfg(all(
615        feature = "windows-subsystem-message",
616        feature = "windows-subsystem-control-listbox"
617    ))]
618    #[doc(inline)]
619    pub use crate::windows_subsystem::control_notifications_for_listbox::*;
620}
621
622/// Annex F - Window Styles
623#[cfg(feature = "windows-subsystem")]
624pub mod all_window_styles {
625    // General window styles (F.1)
626    #[cfg(feature = "windows-subsystem-basic")]
627    #[doc(inline)]
628    pub use crate::windows_subsystem::general_window_styles::*;
629
630    // Button styles (F.2)
631    #[cfg(all(
632        feature = "windows-subsystem-basic",
633        feature = "windows-subsystem-control-button"
634    ))]
635    #[doc(inline)]
636    pub use crate::windows_subsystem::window_styles_for_button::*;
637
638    // Combo box styles (F.3)
639    #[cfg(all(
640        feature = "windows-subsystem-basic",
641        feature = "windows-subsystem-control-combobox"
642    ))]
643    #[doc(inline)]
644    pub use crate::windows_subsystem::window_styles_for_combobox::*;
645
646    // Edit control styles (F.4)
647    #[cfg(all(
648        feature = "windows-subsystem-basic",
649        feature = "windows-subsystem-control-edit"
650    ))]
651    #[doc(inline)]
652    pub use crate::windows_subsystem::window_styles_for_edit::*;
653
654    // List box styles (F.5)
655    #[cfg(all(
656        feature = "windows-subsystem-basic",
657        feature = "windows-subsystem-control-listbox"
658    ))]
659    #[doc(inline)]
660    pub use crate::windows_subsystem::window_styles_for_listbox::*;
661
662    // Scroll bar styles (F.6)
663    #[cfg(all(
664        feature = "windows-subsystem-basic",
665        feature = "windows-subsystem-control-scrollbar"
666    ))]
667    #[doc(inline)]
668    pub use crate::windows_subsystem::window_styles_for_scrollbar::*;
669
670    // Static control styles (F.7)
671    #[cfg(all(
672        feature = "windows-subsystem-basic",
673        feature = "windows-subsystem-control-static"
674    ))]
675    #[doc(inline)]
676    pub use crate::windows_subsystem::window_styles_for_static::*;
677
678    // Dialog box styles (F.8)
679    #[cfg(all(
680        feature = "windows-subsystem-basic",
681        feature = "windows-subsystem-dialogbox"
682    ))]
683    #[doc(inline)]
684    pub use crate::windows_subsystem::window_styles_for_dialogbox::*;
685}
686
687/// Annex G - Macros (experimental)
688#[cfg(feature = "macros")]
689pub mod all_macros {
690    #![allow(unused_doc_comments)]
691
692    /// `G.1` DECLARE_HANDLE
693    ///
694    /// define a data type that has the name specified in the parameter
695    #[macro_export]
696    macro_rules! DECLARE_HANDLE {
697        ($v:vis $n:ident) => {
698            $v type $n = *mut $crate::deps::core::ffi::c_void;
699        };
700    }
701
702    /// `G.2` DECLARE_HANDLE32
703    ///
704    /// define a data type that has the name specified in the parameter
705    removed_item!(
706        #[macro_export]
707        macro_rules! DECLARE_HANDLE32 {
708            ($v:vis $n:ident) => {
709                $v type $n = *mut $crate::deps::core::ffi::c_void;
710            };
711        }
712    );
713
714    /// `G.3` FIELDOFFSET
715    ///
716    /// retrieves the address offset of an element that is inside of a structure
717    #[macro_export]
718    macro_rules! FIELDOFFSET {
719        ($structure:ty, $element:ident $(,)?) => {
720            $crate::deps::core::mem::offset_of!($structure, $element)
721        };
722    }
723
724    /// `G.4` GetBValue
725    ///
726    /// returns a value that represents the intensity of blue color in a
727    /// red-green-blue (RGB) value
728    #[macro_export]
729    macro_rules! GetBValue {
730        ($e:expr) => {
731            u32::to_be_bytes($e)[1]
732        };
733    }
734
735    /// `G.5` GetGValue
736    ///
737    /// returns a value that represents the intensity of green color in a
738    /// red-green-blue (RGB) value
739    #[macro_export]
740    macro_rules! GetGValue {
741        ($e:expr) => {
742            u32::to_be_bytes($e)[2]
743        };
744    }
745
746    /// `G.6` GetRValue
747    ///
748    /// returns a value that represents the intensity of red color in a
749    /// red-green-blue (RGB) value
750    #[macro_export]
751    macro_rules! GetRValue {
752        ($e:expr) => {
753            u32::to_be_bytes($e)[3]
754        };
755    }
756
757    /// `G.7` HIBYTE
758    ///
759    /// returns the value of the hi-order byte of a WORD value
760    #[macro_export]
761    macro_rules! HIBYTE {
762        ($e:expr) => {
763            u16::to_be_bytes($e)[0]
764        };
765    }
766
767    /// `G.8` HIWORD
768    ///
769    /// returns the value of the high-order WORD of a DWORD value
770    #[macro_export]
771    macro_rules! HIWORD {
772        ($e:expr) => {
773            (u32::from($e) >> 16) as u16
774        };
775    }
776
777    /// `G.9` LOBYTE
778    ///
779    /// returns the value of the low-order byte of a WORD value
780    #[macro_export]
781    macro_rules! LOBYTE {
782        ($e:expr) => {
783            u16::to_be_bytes($e)[1]
784        };
785    }
786
787    /// `G.10` LockData
788    ///
789    /// locks the current data segment in memory and returns a handle to it
790    removed_item!(
791        macro_rules! LockData {}
792    );
793
794    /// `G.11` LOWORD
795    ///
796    /// returns the value of the low-order WORD of a DWORD value
797    #[macro_export]
798    macro_rules! LOWORD {
799        ($e:expr) => {
800            (u32::from($e) >> 0) as u16
801        };
802    }
803
804    /// `G.12` MAKEINTATOM
805    ///
806    /// creates an integer atom from a given WORD value
807    #[macro_export]
808    macro_rules! MAKEINTATOM {
809        ($e:expr) => {
810            (u16::from($e)) as usize as $crate::deps::windows_sys::core::PCWSTR
811        };
812    }
813
814    /// `G.13` MAKEINTRESOURCE
815    ///
816    /// processed a resource’s identifier and returns it in a form that will be
817    /// understood by the API’s resource-management functions
818    #[macro_export]
819    macro_rules! MAKEINTRESOURCE {
820        ($e:expr) => {
821            (u16::from($e)) as usize as $crate::deps::windows_sys::core::PCWSTR
822        };
823    }
824
825    /// `G.14` MAKELONG
826    ///
827    /// returns a DWORD value with the specified high-order and low-order WORD
828    /// values
829    #[macro_export]
830    macro_rules! MAKELONG {
831        ($loword:expr, $hiword:expr $(,)?) => {
832            ((u16::from($loword)) as u32 + (((u16::from($hiword)) as u32) << 16 << 16))
833        };
834    }
835
836    /// `G.15` MAKELP
837    ///
838    /// returns a pointer to the memory address specified by a specified segment
839    /// selector and an address offset
840    removed_item!(
841        macro_rules! MAKELP {}
842    );
843
844    /// `G.16` MAKELPARAM
845    ///
846    /// returns a value of type LPARAM with the specified high-order and
847    /// low-order WORD values
848    #[macro_export]
849    macro_rules! MAKELPARAM {
850        ($loword:expr, $hiword:expr $(,)?) => {
851            ((u16::from($loword)) as u32 + (((u16::from($hiword)) as u32) << 16 << 16))
852                as $crate::deps::windows_sys::Win32::Foundation::LPARAM
853        };
854    }
855
856    /// `G.17` MAKELRESULT
857    ///
858    /// returns a value of type LRESULT with the specified high-order and
859    /// low-order WORD values
860    #[macro_export]
861    macro_rules! MAKELRESULT {
862        ($loword:expr, $hiword:expr $(,)?) => {
863            ((u16::from($loword)) as u32 + (((u16::from($hiword)) as u32) << 16 << 16))
864                as $crate::deps::windows_sys::Win32::Foundation::LRESULT
865        };
866    }
867
868    /// `G.18` MAKEPOINT
869    ///
870    /// converts a specified DWORD value into a point’s coordinates and returns
871    /// the coordinates in a POINT structure
872    removed_item!(
873        macro_rules! MAKEPOINT {}
874    );
875
876    /// `G.19` max
877    ///
878    /// compares two values and returns the larger of the two values
879    removed_item!(
880        macro_rules! max {}
881    );
882
883    /// `G.20` min
884    ///
885    /// compares two values and returns the lesser of the two values
886    removed_item!(
887        macro_rules! min {}
888    );
889
890    /// `G.21` OFFSETOF
891    ///
892    /// retrieves the address offset of the given pointer
893    removed_item!(
894        macro_rules! OFFSETOF {}
895    );
896
897    /// `G.22` PALETTEINDEX
898    ///
899    /// creates a palette-relative RGB specifier from the specified index to a
900    /// logical-color palette entry passed to the macro
901    #[macro_export]
902    macro_rules! PALETTEINDEX {
903        ($e:expr) => {
904            ((0x01000000 as $crate::deps::windows_sys::Win32::Foundation::COLORREF)
905                | (u16::from($e) as $crate::deps::windows_sys::Win32::Foundation::COLORREF))
906        };
907    }
908
909    /// `G.23` PALETTERGB
910    ///
911    /// creates a palette-relative RGB specifier from the specified red, green,
912    /// and blue relative intensity values passed to the macro
913    #[macro_export]
914    macro_rules! PALETTERGB {
915        ($r:expr, $g:expr, $b:expr $(,)?) => {
916            ((0x02000000 as $crate::deps::windows_sys::Win32::Foundation::COLORREF)
917                | ((u8::from($r) as $crate::deps::windows_sys::Win32::Foundation::COLORREF)
918                    | ((u8::from($g) as $crate::deps::windows_sys::Win32::Foundation::COLORREF)
919                        << 8)
920                    | ((u8::from($b) as $crate::deps::windows_sys::Win32::Foundation::COLORREF)
921                        << 16)))
922        };
923    }
924
925    /// `G.24` RGB
926    ///
927    /// returns a value of type COLORREF that contains the specified red, green,
928    /// and blue relative intensity values passed to the macro
929    #[macro_export]
930    macro_rules! RGB {
931        ($r:expr, $g:expr, $b:expr $(,)?) => {
932            (u8::from($r) as $crate::deps::windows_sys::Win32::Foundation::COLORREF)
933                | ((u8::from($g) as $crate::deps::windows_sys::Win32::Foundation::COLORREF) << 8)
934                | ((u8::from($b) as $crate::deps::windows_sys::Win32::Foundation::COLORREF) << 16)
935        };
936    }
937
938    /// `G.25` SELECTOROF
939    ///
940    /// retrieves the segment selector of the given pointer
941    removed_item!(
942        macro_rules! SELECTOROF {}
943    );
944
945    /// `G.26` UnlockData
946    ///
947    /// unlocks the current data segment
948    removed_item!(
949        macro_rules! UnlockData {}
950    );
951
952    /// `G.27` UnlockResource
953    ///
954    /// unlocks the handle of a resource
955    removed_item!(
956        macro_rules! UnlockResource {}
957    );
958}
959
960/// Annex H - Binary Raster Operations
961#[cfg(all(feature = "windows-subsystem", feature = "graphics-subsystem-basic"))]
962pub mod all_binary_raster_ops {
963    #[doc(inline)]
964    pub use crate::windows_subsystem::binary_raster_ops::*;
965}
966
967#[doc(hidden)]
968pub mod deps {
969    pub use core;
970    pub use windows_sys;
971}
972
973#[doc(hidden)]
974mod helper {
975    #[allow(dead_code)]
976    pub trait OptInner {
977        type Inner;
978    }
979
980    impl<T> OptInner for Option<T> {
981        type Inner = T;
982    }
983}