-
Posts
19 -
Joined
-
Last visited
kalans's Achievements
Seeker (1/7)
0
Reputation
-
kalans reacted to a post in a topic:
Form Builder beta
-
kalans reacted to a post in a topic:
_Au3Optim.au3 + _Patch.au3
-
kalans reacted to a post in a topic:
Injecting A DLL
-
Sorry for the necropost bump, I am looking to fix this. Any direction would be helpful. Thanks!
-
Hey, I have the new function setup and preserve the $iECode. Then I pass it to the injector the same way I do it initially, but with the $iECode that I had preserved. I still do not see it un-injecting it. If you could help out I would appreciate it, I am almost finished with this project . Thanks! ;###################################################### ;~> <~; ;~> AutoIt Version: 3.3.6.1 <~; ;~> Author: Shaggi <~; ;~> <~; ;~> Script Function: <~; ;~> Inject custom DLLs into a selected Process <~; ;~> <~; ;~> Credits: <~; ;~> Rain and asp for openSecureProcess <~; ;~> <~; ;~> Darawk for Inject() function in C++ <~; ;~> <~; ;###################################################### ;################################## ;~> Directories ;################################## #AutoIt3Wrapper_UseX64=n ;################################## ;~> Includes ;################################## #include <Memory.au3> ;################################## ;~> General Variables ;################################## Global $DLL_Array_List[20][2] $DLL_Array_List[0][0] = 0 Global $searchparameters ;################################## ;~> General Windows variables ;################################## Global $Create_Thread_Access = BitOR($PROCESS_CREATE_THREAD, $PROCESS_QUERY_INFORMATION, $PROCESS_VM_OPERATION, $PROCESS_VM_WRITE, $PROCESS_VM_READ) Global $MAX_PATH = 0x00000104 Global $SE_KERNEL_OBJECT = 6 Global $DACL_SECURITY_INFORMATION = 0x00000004 Global $ERROR_SUCCESS = 0 Global $WRITE_DAC = 0x00040000 Global $UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000 Global $READ_CONTROL = 0x00020000 ;~ ;################################## ;~ $Split_string = StringSplit($oldline, @LF) ;~ For $element In $Split_string ;~ $pos = StringInStr($element, ".dll") ;~ If $pos > 0 Then ;~ $startpos = StringInStr($element, " ", 0, -1, $pos) ;~ $trimmed_string = StringStripCR(StringTrimLeft($element, $startpos)) ;~ If $DLL_Array_List[0][0] < 20 Then ;~ $DLL_Array_List[0][0] += 1 ;~ $DLL_Array_List[$DLL_Array_List[0][0]][0] = @ScriptDir & "" & $trimmed_string ;~ $DLL_Array_List[$DLL_Array_List[0][0]][1] = $trimmed_string ;~ EndIf ;~ EndIf ;~ Next ;################################## ;~> Maintenace ;################################## AdlibRegister("_CheckInput") OnAutoItExitRegister("_onExit") ;################################## ;~> _OnExit() ;~> Called on exit, cleans up resources ;################################## Func _OnExit() AdlibUnRegister("_UpdateList") AdlibUnRegister("_CheckInput") Exit $ERROR_SUCCESS EndFunc ;==>_OnExit ;################################## ;~> Inject() ;~> Injects a DLL into a process ;################################## Func Inject($Pid, Const $DLL_NAME) Local $Proc Local $hLib Local $RemoteString Local $LoadLibAddy Local $iWritten Local $DLL_BUFFER Local $thread ;################################## If Not ProcessExists($Pid) Then Return ;################################## $Proc = _WinAPI_OpenProcess($CREATE_THREAD_ACCESS, False, $Pid, True) If Not $Proc Then $Proc = openSecureProcess($Pid, $PROCESS_ALL_ACCESS) If Not $Proc Then Return False EndIf ;################################## $LoadLibAddy = GetProcAddress(_WinAPI_GetModuleHandle("kernel32.dll"), "LoadLibraryA") If Not $LoadLibAddy Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ;Allocate space in the process for our DLL ;################################## $RemoteString = _MemVirtualAllocEx($Proc, 0, StringLen($DLL_NAME), BitOR($MEM_RESERVE, $MEM_COMMIT), $PAGE_READWRITE) If Not $RemoteString Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ;Create a buffer which holds the string name ;################################## $DLL_BUFFER = DllStructCreate("char[" & BinaryLen($DLL_NAME) & "]") DllStructSetData($DLL_BUFFER, 1, $DLL_NAME) $iWritten = BinaryLen($DLL_NAME) ;Write the string name of our DLL in the memory allocated If Not _WinAPI_WriteProcessMemory($Proc, $RemoteString, DllStructGetPtr($DLL_BUFFER), BinaryLen($DLL_NAME), $iWritten) Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ; Create a thread which should inject our dll, ; and pass the pointer which holds the DLL path ; as an argument to the LoadLibraryA function ;################################## $thread = CreateRemoteThread($Proc, 0, 0, $LoadLibAddy, $RemoteString, 0, 0) If Not $thread Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ;Clean up ;################################## _WinAPI_WaitForSingleObject($thread, 0xFFFFFFFF) Global $iECode = _GetExitCodeThread($Thread) ; handle returned by loadlibrary _MemVirtualFreeEx($Proc,$RemoteString, 0, $MEM_RELEASE) _WinAPI_CloseHandle($thread) _WinAPI_CloseHandle($Proc) _WinAPI_FreeLibrary("kernel32.dll") Return $iECode EndFunc ;==>Inject ;################################## ;~> CreateRemoteThread() ;~> Creates a thread in another process' ;~> virtual memory space ;################################## Func CreateRemoteThread($hProcess, $lpThreadAttributes, $dwStackSize, $lpStartAddress, $lpParameter, $dwCreationFlags, $lpThreadId) Local $call = DllCall("Kernel32.dll", "ptr", "CreateRemoteThread", _ "ptr", $hProcess, _ "ptr", $lpThreadAttributes, _ "uint", $dwStackSize, _ "ptr", $lpStartAddress, _ "ptr", $lpParameter, _ "dword", $dwCreationFlags, _ "ptr", $lpThreadId) Return $call[0] EndFunc ;==>CreateRemoteThread ;################################## ;~> GetProcAddress() ;~> Gets a function address in a loaded DLL ;################################## Func GetProcAddress($hModule, $lpProcName) Local $call = DllCall("Kernel32.dll", "ptr", "GetProcAddress", _ "handle", $hModule, _ "str", $lpProcName) Return $call[0] EndFunc ;==>GetProcAddress ;################################## ;/** openSecureProcess() ;* Opens a process. Overwrite the DACL of target process ;* as a fallback if the process has dropped rights. Doesn't ;* require the user to be logged in with system or admin ;* rights. ;* ;* Edited by Shaggi: ;* Tries with debug privilege first, then overwrites dacl, ;* and resets it back to original state. ;* ;* @author asp ;* @param wndclass Name of windowclass. ;* @param rights The process access rights you want. ;* @return 0 on failure. Otherwise handle to process. ;*/ ;~ Credits to Rain for converting it to AutoIt. ;################################## Func openSecureProcess($Pid, $Rights) If NOT ProcessExists($pid) Then Return False ; Try to open the process with the requested rights. $process = _WinAPI_OpenProcess($Rights, False, $Pid, True); If $process Then Return $process EndIf ;Okay, didnt work, even with debug privilege. ;Going to mirror our SID to target process, ;open a handle, and reset SID Local $process Local $dacl = DllStructCreate("ptr") Local $secdesc = DllStructCreate("ptr") Local $dacl_target = DllStructCreate("ptr") Local $secdesc_target = DllStructCreate("ptr") ; Get the DACL of this process since we know we have ; all rights in it. This really can't fail. If(getSecurityInfo(_WinAPI_GetCurrentProcess(), _ $SE_KERNEL_OBJECT, _ $DACL_SECURITY_INFORMATION, _ 0, _ 0, _ DllStructGetPtr($dacl, 1), _ 0, _ DllStructGetPtr($secdesc, 1)) <> $ERROR_SUCCESS) Then Return False EndIf ; Open it with WRITE_DAC || READ_CONTROL access, ; so that we can read and write to the DACL. $process = _WinAPI_OpenProcess(BitOR($WRITE_DAC, $READ_CONTROL), 0, $Pid) If NOT $process Then _WinAPI_LocalFree($secdesc) Return False EndIf ; Get the DACL of target process and store it, ; so we can reset it later If(getSecurityInfo($process, _ $SE_KERNEL_OBJECT, _ $DACL_SECURITY_INFORMATION, _ 0, _ 0, _ DllStructGetPtr($dacl_target, 1), _ 0, _ DllStructGetPtr($secdesc_target, 1)) <> $ERROR_SUCCESS) Then Return False EndIf ;Overwrite the Dacl with our own If(setSecurityInfo($process, _ $SE_KERNEL_OBJECT, _ BitOR($DACL_SECURITY_INFORMATION, $UNPROTECTED_DACL_SECURITY_INFORMATION), _ 0, _ 0, _ DllStructGetData($dacl, 1), _ 0) <> $ERROR_SUCCESS) Then _WinAPI_LocalFree($secdesc) Return False EndIf ; The DACL is overwritten with our own DACL. We ; should be able to open it with the requested ; privileges now. _WinAPI_LocalFree($secdesc) _WinAPI_CloseHandle($process) $hProc = _WinAPI_OpenProcess($Rights, False, $Pid, True) If NOT $hProc Then Return False EndIf ;Assuming we got the process. Proceeding to revert the patch, and return the enabled process handle If(setSecurityInfo($hProc, _ $SE_KERNEL_OBJECT, _ BitOR($DACL_SECURITY_INFORMATION, $UNPROTECTED_DACL_SECURITY_INFORMATION), _ 0, _ 0, _ DllStructGetData($dacl_target, 1), _ 0) <> $ERROR_SUCCESS) Then _WinAPI_LocalFree($secdesc_target) Return False EndIf _WinAPI_LocalFree($secdesc_target) Return $hProc EndFunc ;==>openSecureProcess ;################################## ;~> getSecurityInfo() ;~> Gets security information about a process ;################################## Func getSecurityInfo($handle, $ObjectType, $SecurityInfo, $ppsidOwner, $ppsidGroup, $ppDacl, $ppSacl, $ppSecurityDescriptor) Local $call = DllCall("Advapi32.dll", "long", "GetSecurityInfo", _ "ptr", $handle, _ "int", $ObjectType, _ "dword", $SecurityInfo, _ "ptr", $ppsidOwner, _ "ptr", $ppsidGroup, _ "ptr", $ppDacl, _ "ptr", $ppSacl, _ "ptr", $ppSecurityDescriptor) Return $call[0] EndFunc ;==>getSecurityInfo ;################################## ;~> setSecurityInfo() ;~> Sets security information about a process ;;################################## Func setSecurityInfo($handle, $ObjectType, $SecurityInfo, $psidOwner, $psidGroup, $pDacl, $pSacl) Local $call = DllCall("Advapi32.dll", "long", "SetSecurityInfo", _ "ptr", $handle, _ "int", $ObjectType, _ "dword", $SecurityInfo, _ "ptr", $psidOwner, _ "ptr", $psidGroup, _ "ptr", $pDacl, _ "ptr", $pSacl) Return $call[0] EndFunc ;==>setSecurityInfo ;################################## ;~> GetFullPathName() ;~> Retrieves the full path of a filename ;################################## Func GetFullPathName($lpFileName, $nBufferLength, $lpBuffer, $lpFilePart) Local $call = DllCall("Kernel32.dll", "ptr", "GetFullPathNameA", _ "str", $lpFileName, _ "dword", $nBufferLength, _ "str", $lpBuffer, _ "str", $lpFilePart) Return $call[0] EndFunc ;==>GetFullPathName ;################################## ;RemoveDll ;################################## ; /***************************************** ; * Gets exit code of an thread ; *****************************************/ Func _GetExitCodeThread($thread) Local $Dummy = DllStructCreate("uint") Local $Call = DllCall("Kernel32.dll", "BOOL", "GetExitCodeThread", "handle", $thread, "ptr", DllStructGetPtr($Dummy)) Return Dec(Hex(DllStructGetData($Dummy, 1))) ; hack hack hack EndFunc ;==>_GetExitCodeThread
-
So basic, and very helpful hehe. Thanks!
-
Bah, I have $quickmenu and $QuickMenu..The lower case option was a button and the upper was a GUI, change var names and it is good to go! Thank you so much for the help, I was dumbfounded when it was not working >.<
-
Sorry the title does not explain it much, as I will try to do my best below. What I Need To Happen: -Press a button, GUI buttons come up (works fine) -These buttons will keep displayed until you click outside the GUI area it created (works, not efficiently) -Clicking the button will display the buttons via GUI again (not working) The script is below: Func QuickMenu() $aWin = WinGetPos($GUI) $QuickMenu = GUICreate("", 300, 25, -1, $aWin[1] + 50, $WS_POPUP, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($QuickMenu, 0xABCDEF, 255) $Recipes = GUICtrlCreateButton("Recipes", 0, 0, 75, 25) $Calcs = GUICtrlCreateButton("Calcs", 75, 0, 75, 25) $Notes = GUICtrlCreateButton("Patch Notes", 150, 0, 75, 25) $EditMH = GUICtrlCreateButton("Edit MH", 225, 0, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Recipes Recipes() Case $Calcs Calcs() Case $Notes PatchNotes() Case $EditMH EditMH() EndSwitch If Not WinActive($QuickMenu) Then ExitLoop WEnd GUIDelete($QuickMenu) EndFunc ;==>QuickMenu So it works fine, and I click outside the given GUI area but when I click the button again to create the GUI (again) it will not display at all. It does not even generate, as it is not in the task tray on the second round. More code available on request, and thank you very much for looking Wasn't sure if I should post this here or gen help. PS: $GUI is the default GUI, other GUI names are different and $GUI does not get overwritten.
-
Still needing help on this, I am about to start working on a update for the program
-
Ok, having some issues on what I need to do. I can pass the PID over and the dll over just as when injected, but what exactly do I do in your code? Do I just add the code as a new function or do I change your code? I am so sorry but I just am not there yet Below is the code I put to try to get it working and I can pass it fine, but it does not uninject..Also below that is your code I have edited for my purpose. Thanks! ;################################## ;RemoveDll ;################################## ; /***************************************** ; * Gets exit code of an thread ; *****************************************/ Func _GetExitCodeThread($thread) Local $Dummy = DllStructCreate("uint") Local $Call = DllCall("Kernel32.dll", "BOOL", "GetExitCodeThread", "handle", $thread, "ptr", DllStructGetPtr($Dummy)) Return Dec(Hex(DllStructGetData($Dummy, 1))) ; hack hack hack EndFunc ;==>_GetExitCodeThread Func RemoveDll() Local $Proc Local $MHDirN $thread = $MHDirN $RemoteString = _MemVirtualAllocEx($Proc, 0, StringLen($thread), BitOR($MEM_RESERVE, $MEM_COMMIT), $PAGE_READWRITE) _WinAPI_WaitForSingleObject($thread, 0xFFFFFFFF) Local $iECode = _GetExitCodeThread($Thread) ; handle returned by loadlibrary _MemVirtualFreeEx($Proc,$RemoteString, 0, $MEM_RELEASE) _WinAPI_CloseHandle($thread) _WinAPI_CloseHandle($Proc) _WinAPI_FreeLibrary("kernel32.dll") Return $iECode EndFunc ;==>Inject ;###################################################### ;~> <~; ;~> AutoIt Version: 3.3.6.1 <~; ;~> Author: Shaggi <~; ;~> <~; ;~> Script Function: <~; ;~> Inject custom DLLs into a selected Process <~; ;~> <~; ;~> Credits: <~; ;~> Rain and asp for openSecureProcess <~; ;~> <~; ;~> Darawk for Inject() function in C++ <~; ;~> <~; ;###################################################### ;################################## ;~> Directories ;################################## #AutoIt3Wrapper_UseX64=n ;################################## ;~> Includes ;################################## #include <Memory.au3> ;################################## ;~> General Variables ;################################## Global $DLL_Array_List[20][2] $DLL_Array_List[0][0] = 0 Global $searchparameters ;################################## ;~> General Windows variables ;################################## Global $Create_Thread_Access = BitOR($PROCESS_CREATE_THREAD, $PROCESS_QUERY_INFORMATION, $PROCESS_VM_OPERATION, $PROCESS_VM_WRITE, $PROCESS_VM_READ) Global $MAX_PATH = 0x00000104 Global $SE_KERNEL_OBJECT = 6 Global $DACL_SECURITY_INFORMATION = 0x00000004 Global $ERROR_SUCCESS = 0 Global $WRITE_DAC = 0x00040000 Global $UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000 Global $READ_CONTROL = 0x00020000 ;~ ;################################## ;~ $Split_string = StringSplit($oldline, @LF) ;~ For $element In $Split_string ;~ $pos = StringInStr($element, ".dll") ;~ If $pos > 0 Then ;~ $startpos = StringInStr($element, " ", 0, -1, $pos) ;~ $trimmed_string = StringStripCR(StringTrimLeft($element, $startpos)) ;~ If $DLL_Array_List[0][0] < 20 Then ;~ $DLL_Array_List[0][0] += 1 ;~ $DLL_Array_List[$DLL_Array_List[0][0]][0] = @ScriptDir & "" & $trimmed_string ;~ $DLL_Array_List[$DLL_Array_List[0][0]][1] = $trimmed_string ;~ EndIf ;~ EndIf ;~ Next ;################################## ;~> Maintenace ;################################## AdlibRegister("_CheckInput") OnAutoItExitRegister("_onExit") ;################################## ;~> _OnExit() ;~> Called on exit, cleans up resources ;################################## Func _OnExit() AdlibUnRegister("_UpdateList") AdlibUnRegister("_CheckInput") Exit $ERROR_SUCCESS EndFunc ;==>_OnExit ;################################## ;~> Inject() ;~> Injects a DLL into a process ;################################## Func Inject($Pid, Const $DLL_NAME) Local $Proc Local $hLib Local $RemoteString Local $LoadLibAddy Local $iWritten Local $DLL_BUFFER Local $thread ;################################## If Not ProcessExists($Pid) Then Return ;################################## $Proc = _WinAPI_OpenProcess($CREATE_THREAD_ACCESS, False, $Pid, True) If Not $Proc Then $Proc = openSecureProcess($Pid, $PROCESS_ALL_ACCESS) If Not $Proc Then Return False EndIf ;################################## $LoadLibAddy = GetProcAddress(_WinAPI_GetModuleHandle("kernel32.dll"), "LoadLibraryA") If Not $LoadLibAddy Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ;Allocate space in the process for our DLL ;################################## $RemoteString = _MemVirtualAllocEx($Proc, 0, StringLen($DLL_NAME), BitOR($MEM_RESERVE, $MEM_COMMIT), $PAGE_READWRITE) If Not $RemoteString Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ;Create a buffer which holds the string name ;################################## $DLL_BUFFER = DllStructCreate("char[" & BinaryLen($DLL_NAME) & "]") DllStructSetData($DLL_BUFFER, 1, $DLL_NAME) $iWritten = BinaryLen($DLL_NAME) ;Write the string name of our DLL in the memory allocated If Not _WinAPI_WriteProcessMemory($Proc, $RemoteString, DllStructGetPtr($DLL_BUFFER), BinaryLen($DLL_NAME), $iWritten) Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ; Create a thread which should inject our dll, ; and pass the pointer which holds the DLL path ; as an argument to the LoadLibraryA function ;################################## $thread = CreateRemoteThread($Proc, 0, 0, $LoadLibAddy, $RemoteString, 0, 0) If Not $thread Then _WinAPI_CloseHandle($Proc) Return False EndIf ;################################## ;Clean up ;################################## _WinAPI_WaitForSingleObject($thread, 0xFFFFFFFF) _MemVirtualFreeEx($Proc,$RemoteString, 0, $MEM_RELEASE) _WinAPI_CloseHandle($thread) _WinAPI_CloseHandle($Proc) _WinAPI_FreeLibrary("kernel32.dll") Return True EndFunc ;==>Inject ;################################## ;~> CreateRemoteThread() ;~> Creates a thread in another process' ;~> virtual memory space ;################################## Func CreateRemoteThread($hProcess, $lpThreadAttributes, $dwStackSize, $lpStartAddress, $lpParameter, $dwCreationFlags, $lpThreadId) Local $call = DllCall("Kernel32.dll", "ptr", "CreateRemoteThread", _ "ptr", $hProcess, _ "ptr", $lpThreadAttributes, _ "uint", $dwStackSize, _ "ptr", $lpStartAddress, _ "ptr", $lpParameter, _ "dword", $dwCreationFlags, _ "ptr", $lpThreadId) Return $call[0] EndFunc ;==>CreateRemoteThread ;################################## ;~> GetProcAddress() ;~> Gets a function address in a loaded DLL ;################################## Func GetProcAddress($hModule, $lpProcName) Local $call = DllCall("Kernel32.dll", "ptr", "GetProcAddress", _ "handle", $hModule, _ "str", $lpProcName) Return $call[0] EndFunc ;==>GetProcAddress ;################################## ;/** openSecureProcess() ;* Opens a process. Overwrite the DACL of target process ;* as a fallback if the process has dropped rights. Doesn't ;* require the user to be logged in with system or admin ;* rights. ;* ;* Edited by Shaggi: ;* Tries with debug privilege first, then overwrites dacl, ;* and resets it back to original state. ;* ;* @author asp ;* @param wndclass Name of windowclass. ;* @param rights The process access rights you want. ;* @return 0 on failure. Otherwise handle to process. ;*/ ;~ Credits to Rain for converting it to AutoIt. ;################################## Func openSecureProcess($Pid, $Rights) If NOT ProcessExists($pid) Then Return False ; Try to open the process with the requested rights. $process = _WinAPI_OpenProcess($Rights, False, $Pid, True); If $process Then Return $process EndIf ;Okay, didnt work, even with debug privilege. ;Going to mirror our SID to target process, ;open a handle, and reset SID Local $process Local $dacl = DllStructCreate("ptr") Local $secdesc = DllStructCreate("ptr") Local $dacl_target = DllStructCreate("ptr") Local $secdesc_target = DllStructCreate("ptr") ; Get the DACL of this process since we know we have ; all rights in it. This really can't fail. If(getSecurityInfo(_WinAPI_GetCurrentProcess(), _ $SE_KERNEL_OBJECT, _ $DACL_SECURITY_INFORMATION, _ 0, _ 0, _ DllStructGetPtr($dacl, 1), _ 0, _ DllStructGetPtr($secdesc, 1)) <> $ERROR_SUCCESS) Then Return False EndIf ; Open it with WRITE_DAC || READ_CONTROL access, ; so that we can read and write to the DACL. $process = _WinAPI_OpenProcess(BitOR($WRITE_DAC, $READ_CONTROL), 0, $Pid) If NOT $process Then _WinAPI_LocalFree($secdesc) Return False EndIf ; Get the DACL of target process and store it, ; so we can reset it later If(getSecurityInfo($process, _ $SE_KERNEL_OBJECT, _ $DACL_SECURITY_INFORMATION, _ 0, _ 0, _ DllStructGetPtr($dacl_target, 1), _ 0, _ DllStructGetPtr($secdesc_target, 1)) <> $ERROR_SUCCESS) Then Return False EndIf ;Overwrite the Dacl with our own If(setSecurityInfo($process, _ $SE_KERNEL_OBJECT, _ BitOR($DACL_SECURITY_INFORMATION, $UNPROTECTED_DACL_SECURITY_INFORMATION), _ 0, _ 0, _ DllStructGetData($dacl, 1), _ 0) <> $ERROR_SUCCESS) Then _WinAPI_LocalFree($secdesc) Return False EndIf ; The DACL is overwritten with our own DACL. We ; should be able to open it with the requested ; privileges now. _WinAPI_LocalFree($secdesc) _WinAPI_CloseHandle($process) $hProc = _WinAPI_OpenProcess($Rights, False, $Pid, True) If NOT $hProc Then Return False EndIf ;Assuming we got the process. Proceeding to revert the patch, and return the enabled process handle If(setSecurityInfo($hProc, _ $SE_KERNEL_OBJECT, _ BitOR($DACL_SECURITY_INFORMATION, $UNPROTECTED_DACL_SECURITY_INFORMATION), _ 0, _ 0, _ DllStructGetData($dacl_target, 1), _ 0) <> $ERROR_SUCCESS) Then _WinAPI_LocalFree($secdesc_target) Return False EndIf _WinAPI_LocalFree($secdesc_target) Return $hProc EndFunc ;==>openSecureProcess ;################################## ;~> getSecurityInfo() ;~> Gets security information about a process ;################################## Func getSecurityInfo($handle, $ObjectType, $SecurityInfo, $ppsidOwner, $ppsidGroup, $ppDacl, $ppSacl, $ppSecurityDescriptor) Local $call = DllCall("Advapi32.dll", "long", "GetSecurityInfo", _ "ptr", $handle, _ "int", $ObjectType, _ "dword", $SecurityInfo, _ "ptr", $ppsidOwner, _ "ptr", $ppsidGroup, _ "ptr", $ppDacl, _ "ptr", $ppSacl, _ "ptr", $ppSecurityDescriptor) Return $call[0] EndFunc ;==>getSecurityInfo ;################################## ;~> setSecurityInfo() ;~> Sets security information about a process ;;################################## Func setSecurityInfo($handle, $ObjectType, $SecurityInfo, $psidOwner, $psidGroup, $pDacl, $pSacl) Local $call = DllCall("Advapi32.dll", "long", "SetSecurityInfo", _ "ptr", $handle, _ "int", $ObjectType, _ "dword", $SecurityInfo, _ "ptr", $psidOwner, _ "ptr", $psidGroup, _ "ptr", $pDacl, _ "ptr", $pSacl) Return $call[0] EndFunc ;==>setSecurityInfo ;################################## ;~> GetFullPathName() ;~> Retrieves the full path of a filename ;################################## Func GetFullPathName($lpFileName, $nBufferLength, $lpBuffer, $lpFilePart) Local $call = DllCall("Kernel32.dll", "ptr", "GetFullPathNameA", _ "str", $lpFileName, _ "dword", $nBufferLength, _ "str", $lpBuffer, _ "str", $lpFilePart) Return $call[0] EndFunc ;==>GetFullPathName
-
I understand, but what is freelibrary O.o..Could you give me an example if you have time, I appreciate it so much shaggi
-
So I am trying to figure out how to unInject the same dll if called upon, it seems like it would be simple but I am not able to figure out if there is a command for it..Any help? Thanks!
-
For whatever reason, I had @ScriptDir for when I called the images instead of @TempDir which is where it was stored for program use...Fixed now Thanks!
-
The script was compile and then passed over, I also tried using @ScriptDir when installing and it was the same results. Thanks!
-
Hello, I have an image added to my script and it works fine compiled or not. But when I use it on a different computer, the image does not display. I have the image as below: FileInstall("C:\Users\User\Desktop\src\normal.bmp", @TempDir & "\normal.bmp", 1) FileInstall("C:\Users\User\Desktop\src\active.bmp", @TempDir & "\active.bmp", 1) And it is refrenced below in the code as: GUICtrlSetImage($varhere, @TempDir& "\normal.bmp") GUICtrlCreatePic(@TempDir & "\active.bmp", 0, 0, 40, 25) Images and more code will be provided if requested, thanks!
-
Wonderful help guys , and yes I am sorry for that..I have corrected the word used.
-
Hello, I have look around for a function and used search to find my exact answer but no luck. I have a location of a file (string), but need to know the directory the file is in. Example: "C:Program Files (x86)The DirThe File.exe" and I need it to be "C:Program Files (x86)The Dir" But I can't do any trimming, due to if they have a different name on the exe "TheFile.exe". Now I can get rid of the .exe part by using StringReplace but I do not know where to go from here XD. Help would be most appreciated! Thanks!