E1M1 Posted June 27, 2010 Share Posted June 27, 2010 (edited) What's wrong in my code? OpenProcess returns valist handle, 0x04E53125 is copied from cheat engine. What else can be wrong? buffer is blank but should contain number. #Include <WinAPI.au3> local $pBuffer $iRead = 4 $hwnd = _WinAPI_OpenProcess(0x0010, 1, ProcessExists("game.exe")) _WinAPI_ReadProcessMemory($hwnd, 0x04E53125, $pBuffer, 4,$iRead) MsgBox(0,"",$pBuffer) Edited June 27, 2010 by E1M1 edited Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 28, 2010 Share Posted June 28, 2010 $pBuffer must be a pointer to a buffer to receive the data. You must create this buffer manually, using DLLStructCreate(). You can then use DLLStructGetPtr() to use as the $pBuffer variable, and DLLStructGetSize() to get the size if you don't know it beforehand. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
E1M1 Posted June 28, 2010 Author Share Posted June 28, 2010 (edited) thanks, now it works but not with out following C++ expandcollapse popupopenSecureProcess(LPCSTR wndclass, DWORD rights) { DWORD pid; HWND window; HANDLE process; PACL dacl; PSECURITY_DESCRIPTOR secdesc; // Find a window which uses the window class. window = FindWindow(wndclass, 0); if(window == 0) { return 0; } // Get the process id of the process which created it. GetWindowThreadProcessId(window, &pid); // Try to open the process with the requested rights. process = OpenProcess(rights, 0, pid); if(process != 0) { return process; } // Get the DACL of this process since we know we have // all rights in it. This really can't fail. if(GetSecurityInfo(GetCurrentProcess(), SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, 0, 0, &dacl, 0, &secdesc) != ERROR_SUCCESS) { return 0; } // Open it with WRITE_DAC access so that we can write to the DACL. process = OpenProcess(WRITE_DAC, 0, pid); if(process == 0) { LocalFree(secdesc); return 0; } if(SetSecurityInfo(process, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION, 0, 0, dacl, 0) != ERROR_SUCCESS) { LocalFree(secdesc); return 0; } // The DACL is overwritten with our own DACL. We // should be able to open it with the requested // privileges now. CloseHandle(process); LocalFree(secdesc); process = OpenProcess(rights, 0, pid); if(process == 0) { return 0; } return process; } I have almosst converted it to autoit, just can't convert 2 funcs. http://www.autoitscript.com/forum/index.php?showtopic=116400&st=0&p=812224 Edited June 28, 2010 by E1M1 edited Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 28, 2010 Share Posted June 28, 2010 Just so you know, opening a Process with 'WRITE_DAC' access will require elevated privileges to alter a process running under another session or with higher Privileges in Vista+. Also, Protected processes like 'audiodg.exe' will not allow any such changes. Opening pretty much any Process with 'WRITE_DAC' seems to work in Windows XP (at least in Admin mode), but I've only tested for the current session.. Its unlikely you'll have processes running on other sessions, but still possible in a multiple-logon situation. Still, I find it hard to believe something like 'game.exe' would run with elevated privileges, and I think what you're trying to do is overkill. Get/Set SecurityInfo functions are easy enough to implement, but I suspect 'game.exe' is not what you're after here and I don't think its a good idea to go further with that. Plus - like I said - Vista+ will give you failure unless you alter your own Privileges. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
E1M1 Posted June 28, 2010 Author Share Posted June 28, 2010 try your self Diablo 2 Exp 1.13 patch.but I suspect 'game.exe' is not what you're after here and I don't think its a good idea to go further with that What you meant by that? edited Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now