forked from airidosas252/Wine-Builds
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirtualmemory.patch
More file actions
18 lines (15 loc) · 796 Bytes
/
Copy pathvirtualmemory.patch
File metadata and controls
18 lines (15 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index dce03c2..45a3b78 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -4473,7 +4473,12 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
/* Round parameters to a page boundary */
- if (is_beyond_limit( 0, size, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE;
+ // Get the environment variable value, default to 4096L << 20 if not set
+ const char *env_var = getenv("WINE_VIRTUAL_MEMORY_SIZE");
+ ULONG_PTR env_size_limit = env_var ? strtol(env_var, NULL, 10) << 20 : 4096L << 20;
+
+ if (is_beyond_limit( 0, size, working_set_limit ) || size > env_size_limit)
+ return STATUS_WORKING_SET_LIMIT_RANGE;
if (*ret)
{