Skip to content

Instantly share code, notes, and snippets.

@GregLando113
Created March 25, 2018 22:03
Show Gist options
  • Save GregLando113/4aa6a95698aeb8b00cdb007b93e1179b to your computer and use it in GitHub Desktop.
Save GregLando113/4aa6a95698aeb8b00cdb007b93e1179b to your computer and use it in GitHub Desktop.
GW Windows Borderless Standalone - 3/25/2018 Updated
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WinAPIConstants.au3>
Global $hWnd = WinGetHandle('[CLASS:ArenaNet_Dx_Window_Class;REGEXPTITLE:^\D+$]')
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hWnd = ' & $hWnd & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
Global $iProc = WinGetProcess($hWnd)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iProc = ' & $iProc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
Global $hProc = _GWMA_OpenProcess($iProc)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hProc = ' & $hProc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
;33 C0 BA 06 00 00 00 89 45 F8 89 45 FC 89 45 F4 89 45 F0 8D 45 F8 8B CB (Second match, some duplicate function comes first for some reason :D)+0x11B
Global $tReplace = DllStructCreate('align 1;byte[16]')
DllStructSetData($tReplace,1,'0x90909090909090909090909090909090')
_GWMA_WriteStructure($hProc,0x0067D9D8,$tReplace)
; 2B C2 8B 55 EC 2B C2 8B 55 F8 3B D0 72 08 (Second match, some duplicate function comes first for some reason :D)
DllCall("kernel32.dll", _
'int', 'WriteProcessMemory', _
'int', $hProc, _
'int', 0x0067D530, _ ; ^above (-0x11)
'byte*', 0xEB, _
'int', 1, _
'int', '')
DllCall("kernel32.dll", _
'int', 'WriteProcessMemory', _
'int', $hProc, _
'int', 0x0067D54D, _ ; ^above (+0xC)
'byte*', 0xEB, _
'int', 1, _
'int', '')
Global $tReplace3 = DllStructCreate('align 1;byte[10]')
DllStructSetData($tReplace3, 1, '0x90909090909090909090')
; 56 57 8B F9 8B 87 00 02 00 00 85 C0 75 14
_GWMA_WriteStructure($hProc, 0x00669A56, $tReplace3) ; +0x86
_GWMA_WriteStructure($hProc, 0x00669AA2, $tReplace3) ; +0xD2
_GWMA_WriteStructure($hProc, 0x00669ADE, $tReplace3) ; +0x10E
;56 57 8B F9 8B 87 F4 0C 00 00 85 C0 75 14
_GWMA_WriteStructure($hProc, 0x0067D7E6, $tReplace3) ; +0x86
_GWMA_WriteStructure($hProc, 0x0067D832, $tReplace3) ; +0xD2
_GWMA_WriteStructure($hProc, 0x0067D86E, $tReplace3) ; +0x10E
$pos = WinGetPos($hWnd)
; set the style either borderless or normal
$style = BitOR($WS_POPUP, $WS_VISIBLE, $WS_MINIMIZEBOX)
;$style = BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_VISIBLE, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)
_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $style)
WinMove($hWnd, "", 0, 0, @DesktopWidth, @DesktopHeight)
;~ WinMove($hWnd, "", 0, 0, @DesktopWidth, @DesktopHeight - 30)
;WinMove($hWnd, "", 100, 100, @DesktopWidth * 2 / 3, @DesktopHeight * 2 / 3)
;~ WinMove($hWnd, "", @DesktopWidth, 0, 1440, 870)
OnAutoItExitRegister(_OnExit)
ProcessWaitClose(@AutoItPID)
Func _OnExit()
WinMove($hWnd, "", $pos[0], $pos[1], $pos[2], $pos[3])
$style = BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_VISIBLE, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)
_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $style)
EndFunc
Func _GWMA_OpenProcess($iPID)
Local $aProcess = DllCall("kernel32.dll", _
"int", "OpenProcess", _
"int", 0x1F0FFF, _
"int", 1, _
"int", $iPID)
Return $aProcess[0]
EndFunc ;==>OpenProcess
Func _GWMA_ReadStructure($hProcess, $iAddress, ByRef $aStructure)
Local $lRet = DllCall("kernel32.dll", _
"int", "ReadProcessMemory", _
"int", $hProcess, _
"int", $iAddress, _
"ptr", DllStructGetPtr($aStructure), _
"int", DllStructGetSize($aStructure), _
"int", "")
Return $lRet[0]
EndFunc ;==>ReadStructure
Func _GWMA_WriteStructure($aProcess, $aAddress, ByRef $aStructure)
Local $lRet = DllCall("kernel32.dll", _
'int', 'WriteProcessMemory', _
'int', $aProcess, _
'int', $aAddress, _
'ptr', DllStructGetPtr($aStructure), _
'int', DllStructGetSize($aStructure), _
'int', '')
Return $lRet[0]
EndFunc ;==>WriteStructure
@GregLando113
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment