View previous topic :: View next topic |
Author |
Message |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Tue Aug 12, 2014 6:33 am Post subject: ActiveX Object in Win32? |
|
|
Is there a way to create ActiveX object using win32 API?
the native for
Code: |
<script>
var activex = new ActiveXObject("WScript.Shell");
</script>
|
_________________
Stylo |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Tue Aug 12, 2014 4:08 pm Post subject: |
|
|
Awhhh..
It's giving me hard time with
cannot convert from CLSID to const IID*const when trying to use CoCreateInstance
WTH is going on here
I'm not familiar with those types and libraries :S
that's my code
Code: |
int main()
{
CLSID clsidWshShell;
IDispatch *pdispWshShell = NULL;
HRESULT hr;
setlocale(LC_CTYPE, "");
CoInitialize(NULL);
CLSIDFromProgID(L"WScript.Shell", &clsidWshShell);
hr = CoCreateInstance(clsidWshShell,
NULL,
CLSCTX_ALL,
IID_IDispatch,
(void**)pdispWshShell);
if(hr)
{
printf("Hey");
}
return 0;
}
|
Guess I'll just dive into that sh*t
Thanks for your help
If you have any solution, it'd be great!
_________________
Stylo |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Aug 12, 2014 5:20 pm Post subject: |
|
|
Setting it like this works fine for me:
Code: |
#include <Windows.h>
#include <stdio.h>
#include <locale.h>
int __cdecl main(int argc, char* argv[])
{
// Set the system locale..
::setlocale(LC_CTYPE, "");
// Initialize COM..
::CoInitialize(NULL);
// Obtain the CLSID of WScript.Shell..
CLSID clsidWSS;
::CLSIDFromProgID(L"WScript.Shell", &clsidWSS);
// Initialize a COM object of the shell scripting..
IDispatch* lpDispatch = NULL;
HRESULT hResult = S_OK;
if (SUCCEEDED(hResult = ::CoCreateInstance(clsidWSS, NULL, CLSCTX_ALL, IID_IDispatch, (void**)&lpDispatch)))
{
// do stuff here with the object..
}
// Shutdown COM..
::CoUninitialize();
return 0;
} |
_________________
- Retired. |
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Wed Aug 13, 2014 1:15 pm Post subject: |
|
|
Guess I had to set Options > Advanced > Compile as C++ code to make it work..
Nice..
BTW, I'm trying to inject that code as a dll to IE hopefully It'd be the same object as the original ActiveX object created with
Code: |
<script>
var activex = new ActiveXObject("WScript.Shell");
</script>
|
but it has nothing to do with it
any ideas on that?
_________________
Stylo |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Aug 13, 2014 6:20 pm Post subject: |
|
|
Not quite sure I follow what you mean in that post.
_________________
- Retired. |
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Aug 17, 2014 10:52 am Post subject: |
|
|
Sorry.. XD
What I meant was,
When I create an ActiveX object using JavaScript, Its memory structure looks different than what I create using the native code
I thought using the native code injected into Internet Explorer will cause the ActiveX to get the same structure as the JavaScript version, But it's a different kind of ActiveX
Attached a photo of the ActiveX object created from the native code above
as you can see, it's not a normal ActiveX that is created through internet explorer
I'll upload the ActiveX memory structure created by IE in a few minutes...
Description: |
|
Filesize: |
16.97 KB |
Viewed: |
8793 Time(s) |

|
_________________
Stylo |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Aug 17, 2014 1:25 pm Post subject: |
|
|
Given that it has a two step process from being ran within Javascript, it wont have the same type at face value. Since the object is first defined and created within the Javascript host, then the host creates and allocates the object in whatever manager / GC method it has (if it has one).
You may need to follow some pointers to locate the actual base object for the WScript.Shell object. Not too sure though since I don't touch ActiveX or Internet Explorer.
Another idea would be to debug Internet Explorer. Set a breakpoint on CoCreateInstance and see if you can trace where it may be creating the object.
_________________
- Retired. |
|
Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
|
Back to top |
|
 |
|