Jump to content

malcev

Active Members
  • Posts

    32
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

malcev's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. tubaba, you check that winlogon.exe is running from system with LookupAccountSid, but I think it will not work with non-english OS. You can use IsWellKnownSid instead of LookupAccountSid. On autohotkey it will be like that: if DllCall("advapi32\IsWellKnownSid", "ptr", pSid, "uint", WinLocalSystemSid := 22) msgbox SystemSid
  2. Your dll uses SetThreadToken function to set token. The same done via my link. Also you can use not-documented NtImpersonateThread instead of SetThreadToken.
  3. For such a task you dont need dll.
  4. Thanks for information! I will try.
  5. 1) Yes, It is good that You check that process runs from system account, but if there are several users on PC, then there are will be several winlogon.exe from system account with different TokenSessionIds. Will it be ok, that We will use token from different SessionId? 2) I tested on autohotkey. When You install it has an option run with ui access. If I run next script with ahk ui access and uac disabled then I will get TokenUIAccess = 0, but band = 2. Therefore I said that this function does not work. Code on ahk: DllCall("advapi32.dll\OpenProcessToken", "ptr", DllCall("GetCurrentProcess", "ptr"), "uint", 0x0008, "ptr*", hTokenSelf) ; TOKEN_QUERY DllCall("advapi32\GetTokenInformation", "ptr", hTokenSelf, "uint", 26, "uint*", TokenUIAccess, "uint", 4, "uint*", ReturnLength) msgbox % TokenUIAccess Gui, +HWNDhGui +AlwaysOnTop DllCall("GetWindowBand", "ptr", hGui, "uint*", band) msgbox % band Could You please give example how to create process with system and trustedinstaller permissions? Also I do not understand why do We need to call LookupPrivilegeValue, PrivilegeCheck and RevertToSelf functions.
  6. Hi! I have some questions. 1) The author from github compares TokenSessionId of our process with TokenSessionId of winlogon.exe, but You dont. Is it not necessary? 2) The author from github creates process like this: GetStartupInfo(&si); if (CreateProcessAsUser(hTokenUIAccess, NULL, GetCommandLine(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) You add "-s" to command line, add flags BitOR($NORMAL_PRIORITY_CLASS, $CREATE_NEW_CONSOLE) and add @SW_SHOW to $tStartupInfo structure. Why? 3) If You disabled uac then Func __CheckForUIAccess() will not work. But You can check TokenUIAccess with creating gui and calling GetWindowBand. On autohotkey like this: Gui, +HWNDhGui +AlwaysOnTop DllCall("GetWindowBand", "uptr", hGui, "uint*", band) Gui, Destroy hGui := "" if (band = 1) ; ZBID_DESKTOP
  7. Just found a bug. Before calling JsDisposeRuntime We need to set set current context to not existent one with JsSetCurrentContext function.
  8. Hi, smbape! Very interesting to test it. Thank You very much! Will You plan to add audio classifier example in future?
  9. Hi, smbape! Will You plan to add object detection? https://developers.google.com/mediapipe/solutions/vision/object_detector/python Also here is new features like audio classifier, gesture recognizer, text classification... https://github.com/googlesamples/mediapipe/tree/main/examples
  10. Great. Very good library for face recognitio!! Thank You! What the next? May be DeepFace? https://github.com/serengil/deepface
  11. Thank You for explanation. Can We activate manifest only 1 time at start with DllActivateManifest, and deactivate it only before exit script with DllDeactivateActCtx? Can be some memory leaks? Also if We exit script without calling DllDeactivateActCtx, will be some memory leaks?
  12. smbape, I think You have bug here: $sManifest = EnvGet("OPENCV_ACTCTX_MANIFEST") https://github.com/smbape/node-autoit-opencv-com/blob/main/autoit-opencv-com/udf/opencv_udf.au3#L123 Why user will have this environment variable? May be it is easier just use direct path to manifest?
  13. Hi smbape! Sorry, but I dont know any other resources. Only some video tutorials like this: Thank You very much for such great work!
  14. If You are interested here is dll https://github.com/HW140701/GoogleMediapipePackageDll
  15. 300ms - it is just an example. You can test like this. Exit all uia inspectors, exit skype, run skype, run AccExplorer32. https://github.com/blackrosezy/gui-inspect-tool/blob/master/AccExplorer32.exe Choose skype window, build tree with this utility -> as result You will see that Your tree will not have all child elements. Then run ahk code, activate skype, press f11. f11:: SendMessage, WM_GETOBJECT := 0x003D, 0, 1, Chrome_RenderWidgetHostHWND1, A Acc := Acc_ObjectFromWindow(WinExist("A")) Acc.accName(0) Return ; http://www.autohotkey.com/board/topic/77303-acc-library-ahk-l-updated-09272012/ ; https://dl.dropbox.com/u/47573473/Web%20Server/AHK_L/Acc.ahk ;------------------------------------------------------------------------------ ; Acc.ahk Standard Library ; by Sean ; Updated by jethrow: ; Modified ComObjEnwrap params from (9,pacc) --> (9,pacc,1) ; Changed ComObjUnwrap to ComObjValue in order to avoid AddRef (thanks fincs) ; Added Acc_GetRoleText & Acc_GetStateText ; Added additional functions - commented below ; Removed original Acc_Children function ; last updated 2/25/2010 ;------------------------------------------------------------------------------ Acc_Init() { Static h If Not h h:=DllCall("LoadLibrary","Str","oleacc","Ptr") } Acc_ObjectFromEvent(ByRef _idChild_, hWnd, idObject, idChild) { Acc_Init() If DllCall("oleacc\AccessibleObjectFromEvent", "Ptr", hWnd, "UInt", idObject, "UInt", idChild, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0 Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt") } Acc_ObjectFromPoint(ByRef _idChild_ = "", x = "", y = "") { Acc_Init() If DllCall("oleacc\AccessibleObjectFromPoint", "Int64", x==""||y==""?0*DllCall("GetCursorPos","Int64*",pt)+pt:x&0xFFFFFFFF|y<<32, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0 Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt") } Acc_ObjectFromWindow(hWnd, idObject = -4) { Acc_Init() If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0 Return ComObjEnwrap(9,pacc,1) } Acc_WindowFromObject(pacc) { If DllCall("oleacc\WindowFromAccessibleObject", "Ptr", IsObject(pacc)?ComObjValue(pacc):pacc, "Ptr*", hWnd)=0 Return hWnd } Acc_GetRoleText(nRole) { nSize := DllCall("oleacc\GetRoleText", "Uint", nRole, "Ptr", 0, "Uint", 0) VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize) DllCall("oleacc\GetRoleText", "Uint", nRole, "str", sRole, "Uint", nSize+1) Return sRole } Acc_GetStateText(nState) { nSize := DllCall("oleacc\GetStateText", "Uint", nState, "Ptr", 0, "Uint", 0) VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize) DllCall("oleacc\GetStateText", "Uint", nState, "str", sState, "Uint", nSize+1) Return sState } Acc_SetWinEventHook(eventMin, eventMax, pCallback) { Return DllCall("SetWinEventHook", "Uint", eventMin, "Uint", eventMax, "Uint", 0, "Ptr", pCallback, "Uint", 0, "Uint", 0, "Uint", 0) } Acc_UnhookWinEvent(hHook) { Return DllCall("UnhookWinEvent", "Ptr", hHook) } /* Win Events: pCallback := RegisterCallback("WinEventProc") WinEventProc(hHook, event, hWnd, idObject, idChild, eventThread, eventTime) { Critical Acc := Acc_ObjectFromEvent(_idChild_, hWnd, idObject, idChild) ; Code Here: } */ ; Written by jethrow Acc_Role(Acc, ChildId=0) { try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetRoleText(Acc.accRole(ChildId)):"invalid object" } Acc_State(Acc, ChildId=0) { try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetStateText(Acc.accState(ChildId)):"invalid object" } Acc_Location(Acc, ChildId=0, byref Position="") { ; adapted from Sean's code try Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId) catch return Position := "x" NumGet(x,0,"int") " y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int") return {x:NumGet(x,0,"int"), y:NumGet(y,0,"int"), w:NumGet(w,0,"int"), h:NumGet(h,0,"int")} } Acc_Parent(Acc) { try parent:=Acc.accParent return parent?Acc_Query(parent): } Acc_Child(Acc, ChildId=0) { try child:=Acc.accChild(ChildId) return child?Acc_Query(child): } Acc_Query(Acc) { ; thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&p=509530#509530 try return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1) } Acc_Error(p="") { static setting:=0 return p=""?setting:setting:=p } Acc_Children(Acc) { if ComObjType(Acc,"Name") != "IAccessible" ErrorLevel := "Invalid IAccessible Object" else { Acc_Init(), cChildren:=Acc.accChildCount, Children:=[] if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 { Loop %cChildren% i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child): return Children.MaxIndex()?Children: } else ErrorLevel := "AccessibleChildren DllCall Failed" } if Acc_Error() throw Exception(ErrorLevel,-1) } Acc_ChildrenByRole(Acc, Role) { if ComObjType(Acc,"Name")!="IAccessible" ErrorLevel := "Invalid IAccessible Object" else { Acc_Init(), cChildren:=Acc.accChildCount, Children:=[] if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 { Loop %cChildren% { i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i) if NumGet(varChildren,i-8)=9 AccChild:=Acc_Query(child), ObjRelease(child), Acc_Role(AccChild)=Role?Children.Insert(AccChild): else Acc_Role(Acc, child)=Role?Children.Insert(child): } return Children.MaxIndex()?Children:, ErrorLevel:=0 } else ErrorLevel := "AccessibleChildren DllCall Failed" } if Acc_Error() throw Exception(ErrorLevel,-1) } Acc_Get(Cmd, ChildPath="", ChildID=0, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="") { static properties := {Action:"DefaultAction", DoAction:"DoDefaultAction", Keyboard:"KeyboardShortcut"} AccObj := IsObject(WinTitle)? WinTitle : Acc_ObjectFromWindow( WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText), 0 ) if ComObjType(AccObj, "Name") != "IAccessible" ErrorLevel := "Could not access an IAccessible Object" else { StringReplace, ChildPath, ChildPath, _, %A_Space%, All AccError:=Acc_Error(), Acc_Error(true) Loop Parse, ChildPath, ., %A_Space% try { if A_LoopField is digit Children:=Acc_Children(AccObj), m2:=A_LoopField ; mimic "m2" output in else-statement else RegExMatch(A_LoopField, "(\D*)(\d*)", m), Children:=Acc_ChildrenByRole(AccObj, m1), m2:=(m2?m2:1) if Not Children.HasKey(m2) throw AccObj := Children[m2] } catch { ErrorLevel:="Cannot access ChildPath Item #" A_Index " -> " A_LoopField, Acc_Error(AccError) if Acc_Error() throw Exception("Cannot access ChildPath Item", -1, "Item #" A_Index " -> " A_LoopField) return } Acc_Error(AccError) StringReplace, Cmd, Cmd, %A_Space%, , All properties.HasKey(Cmd)? Cmd:=properties[Cmd]: try { if (Cmd = "Location") AccObj.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId) , ret_val := "x" NumGet(x,0,"int") " y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int") else if (Cmd = "Object") ret_val := AccObj else if Cmd in Role,State ret_val := Acc_%Cmd%(AccObj, ChildID+0) else if Cmd in ChildCount,Selection,Focus ret_val := AccObj["acc" Cmd] else ret_val := AccObj["acc" Cmd](ChildID+0) } catch { ErrorLevel := """" Cmd """ Cmd Not Implemented" if Acc_Error() throw Exception("Cmd Not Implemented", -1, Cmd) return } return ret_val, ErrorLevel:=0 } if Acc_Error() throw Exception(ErrorLevel,-1) } Activate AccExplorer32, rebuild tree. As result You will see that tree has all child elements.
×
×
  • Create New...