Blender V5.0
BLI_winstuff.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11
12#ifndef _WIN32
13# error "This include is for Windows only!"
14#endif
15
16#include "BLI_sys_types.h"
17
18#define WIN32_LEAN_AND_MEAN
19
20#ifndef NOMINMAX
21# define NOMINMAX
22# include <windows.h>
23# undef NOMINMAX
24#else
25# include <windows.h>
26#endif
27
28#undef rad
29#undef rad1
30#undef rad2
31#undef rad3
32#undef vec
33#undef rect
34#undef rct1
35#undef rct2
36
37#undef small
38
39/* These definitions are also in BLI_math for simplicity. */
40
41#if !defined(_USE_MATH_DEFINES)
42# define _USE_MATH_DEFINES
43#endif
44
45#ifndef S_ISREG
46# define S_ISREG(x) (((x) & _S_IFREG) == _S_IFREG)
47#endif
48#ifndef S_ISDIR
49# define S_ISDIR(x) (((x) & _S_IFDIR) == _S_IFDIR)
50#endif
51
52#if defined(_MSC_VER)
53# define R_OK 4
54# define W_OK 2
55/* Not accepted by `access()` on windows. */
56// # define X_OK 1
57# define F_OK 0
58#endif
59
60typedef unsigned int mode_t;
61
63struct dirent {
64 int d_ino;
65 int d_off;
66 unsigned short d_reclen;
67 char *d_name;
68};
69
71typedef struct __dirstream DIR;
72
73DIR *opendir(const char *path);
74struct dirent *readdir(DIR *dp);
75int closedir(DIR *dp);
76const char *dirname(char *path);
77
78/* Windows utility functions. */
79
83bool BLI_windows_update_pinned_launcher(const char *launcher_path);
84
85/* Gets the version of the currently loaded DirectX driver for the first device that matches
86 * deviceString. This is required for Qualcomm devices which use Mesa's Gallium D2D12 layer for
87 * OpenGL functionality */
88bool BLI_windows_get_directx_driver_version(const wchar_t *deviceSubString,
89 long long *r_driverVersion);
90
91/* Checks the version of the Windows build in the format "major.minor.build".
92 * Example: 10.0.22000 corresponds to Windows 11 21H2. */
94 DWORD minorVersion,
95 DWORD buildNumber);
96
102void BLI_windows_get_default_root_dir(char root_dir[4]);
103int BLI_windows_get_executable_dir(char r_dirpath[/*FILE_MAXDIR*/]);
104
105/* ShellExecute Helpers. */
106
107bool BLI_windows_external_operation_supported(const char *filepath, const char *operation);
108bool BLI_windows_external_operation_execute(const char *filepath, const char *operation);
109
118bool BLI_windows_execute_self(const char *parameters,
119 const bool wait,
120 const bool elevated,
121 const bool silent);
122
125enum class QoSMode {
129 HIGH = 1,
131 ECO = 2
132};
133
136enum class QoSPrecedence {
138 JOB = 0,
141};
142
149void BLI_windows_process_set_qos(QoSMode qos_mode, QoSPrecedence qos_precedence);
bool BLI_windows_external_operation_supported(const char *filepath, const char *operation)
bool BLI_windows_unregister_blend_extension(bool all_users)
struct __dirstream DIR
bool BLI_windows_execute_self(const char *parameters, const bool wait, const bool elevated, const bool silent)
struct dirent * readdir(DIR *dp)
bool BLI_windows_get_directx_driver_version(const wchar_t *deviceSubString, long long *r_driverVersion)
void BLI_windows_get_default_root_dir(char root_dir[4])
bool BLI_windows_update_pinned_launcher(const char *launcher_path)
int closedir(DIR *dp)
const char * dirname(char *path)
bool BLI_windows_is_build_version_greater_or_equal(DWORD majorVersion, DWORD minorVersion, DWORD buildNumber)
bool BLI_windows_external_operation_execute(const char *filepath, const char *operation)
int BLI_windows_get_executable_dir(char r_dirpath[])
DIR * opendir(const char *path)
unsigned int mode_t
QoSMode
void BLI_windows_process_set_qos(QoSMode qos_mode, QoSPrecedence qos_precedence)
QoSPrecedence
bool BLI_windows_is_store_install(void)
bool BLI_windows_register_blend_extension(bool all_users)
#define HIGH(x)
Definition RandGen.cpp:35
unsigned short d_reclen
int d_off
char * d_name
int d_ino