forked from SkyLined/BugId
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPageHeap.cmd
35 lines (34 loc) · 905 Bytes
/
PageHeap.cmd
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
@ECHO OFF
SETLOCAL
NET SESSION >nul 2>&1
IF ERRORLEVEL 1 (
ECHO - Must be run as administrator.
EXIT /B 1
)
IF NOT "%GFlags:~0,0%" == "" (
IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
SET GFlags=C:\Program Files\Windows Kits\8.1\Debuggers\x64\gflags.exe
) ELSE (
SET GFlags=C:\Program Files\Windows Kits\8.1\Debuggers\x86\gflags.exe
)
)
SET GFlags=%GFlags:"=%
IF NOT EXIST "%GFlags%" (
ECHO - Cannot find Global Flags at "%GFlags%", please set the "GFlags" environment variable to the correct path.
EXIT /B 1
)
IF "%~2" == "OFF" (
ECHO * Disabling page heap for %1...
"%GFlags%" -i %1 -FFFFFFFF >nul
IF ERRORLEVEL 1 GOTO :ERROR
) ELSE (
ECHO * Enabling page heap for %1...
"%GFlags%" -i %1 -FFFFFFFF >nul
IF ERRORLEVEL 1 GOTO :ERROR
"%GFlags%" -i %1 +02109870 >nul
IF ERRORLEVEL 1 GOTO :ERROR
)
EXIT /B 0
:ERROR
ECHO - Error code %ERRORLEVEL%.
EXIT /B %ERRORLEVEL%