Python Forum
Windows - Get Handle to Pass as Parameter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows - Get Handle to Pass as Parameter
#2
Well, I slept on it, woke up and started Googling. Here's what I have:
handle = ctypes.windll.Kernel32.GetCurrentProcess()
print(ctypes.windll.Advapi32.OpenProcessToken(handle, 'TOKEN_QUERY', token))
print(ctypes.windll.Kernel32.GetLastError())
I needed the GetCurrentProcess() function to get the handle. But now I get an ErrorCode 5 - Acess Denied return. I'm an administrator account. The only account on this computer. I would really appreciate a Windows guru or two here. How can I access the token? I've read I can impersonate the LOCAL_SYSTEM account...

By the way: sorry. I know this isn't specifically a Python issue; I just figured there are some experienced programmers here. Where else could I go for help?
Reply


Messages In This Thread
RE: Windows - Get Handle to Pass as Parameter - by malonn - Jul-27-2018, 01:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I handle escape character in parameter arguments in Python? JKR 6 1,586 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
  How to pass encrypted pass to pyodbc script tester_V 0 1,005 Jul-27-2023, 12:40 AM
Last Post: tester_V
  [ERROR] ParamValidationError: Parameter validation failed: Invalid type for parameter gdbengo 3 12,010 Dec-26-2022, 08:48 AM
Last Post: ibreeden
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,693 Sep-07-2020, 08:02 AM
Last Post: perfringo
  script that handle windows notifications. darktitan 1 2,460 Apr-10-2020, 12:47 PM
Last Post: Mateusz
  Pass by reference vs Pass by value leodavinci1990 1 2,337 Nov-20-2019, 02:05 AM
Last Post: jefsummers
  The derivate class dosn't behave like the base when i pass parameter to them drudox 4 3,333 Aug-05-2018, 06:42 PM
Last Post: drudox

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020