0Day Forums
Access WinAPI through the powershell from a WSH JScript? - Printable Version

+- 0Day Forums (https://0day.red)
+-- Forum: Coding (https://0day.red/Forum-Coding)
+--- Forum: JScript (https://0day.red/Forum-JScript)
+--- Thread: Access WinAPI through the powershell from a WSH JScript? (/Thread-Access-WinAPI-through-the-powershell-from-a-WSH-JScript)



Access WinAPI through the powershell from a WSH JScript? - radomirqnkosfoz - 07-24-2023

I'd like to acces some WinAPI functions from a JScript that runs on the Windows Script Host.
Since that is not possible directly, I'd like to do it using the powershell.
I don't want to spawn a new powershell process everytime I access a WinAPI function, so I'm looking for a way to spawn one hidden powershell instance from JScript and keep using that for all my API calls.

Has anyone tried something like that before?
I'd really like to see a simple example on something simple like [MessageBox][1].
Is there a COM interface to efficiently communicate with the powershell?

I also have some more advaced questions...
How could I pass a callback function to a WinAPI function, so that my JScript function gets called whenever the WinAPI calls that callback?
What about other complicated, but commonly seem datatypes in the WinAPI like structs?
And what about passing/receiving binary data?

I'd really like to see any proofs of concept and ideas you have for that...

[1]:

[To see links please register here]