flat assembler
Message board for the users of flat assembler.
Index
> Windows > Calling Javascript From Assembly |
Author |
|
Pinecone_ 22 Mar 2009, 12:52
I've been trying to look into calling javascript from assembly, for example, say a .js file had a function "Hello()" i would like to call the Hello function from assembly, but I'm at a loss of where to start as I'm not sure what to search for, I've been looking on and off for a few days and found nothing.
I remember a long time ago (Not sure how long) i saw an example of calling vbscript from assembly on this forum, I've searched for it but could not find it. I figure it can't be much different to call javascript than vbscript, right? Could someone point me in the right direction on what to search for please? A link to the MSDN or to the post i mentioned would be great, but even a keyword to search for would be good. Thanks in advance for any help. Edit: I found the post after another search: http://board.flatassembler.net/topic.php?t=8320 Ill edit again in a while updating anything i find. |
|||
22 Mar 2009, 12:52 |
|
LocoDelAssembly 22 Mar 2009, 22:53
I'm curious, what your JavaScript code is for? Is JavaScript available outside of a browser scope?
|
|||
22 Mar 2009, 22:53 |
|
LocoDelAssembly 22 Mar 2009, 23:04
Here I found something: http://www.codeproject.com/KB/COM/jscalls.aspx
But looks like you need to run it in the context of a web page, is that what are you looking for? |
|||
22 Mar 2009, 23:04 |
|
Pinecone_ 23 Mar 2009, 09:03
My interest is making scriptable events for my programs. My goal is to have a program which will act as a loader for any program and enable me to have a javascript file and functions in it such as "CreateWindowExA(...)" for example, so when the program calls CreateWindowExA, the function in the script will be called, and ill be able to modify parameters before returning back to the program. I'm familiar enough with hooking to do it, i just need to find a way to interact with a scripting language. If anyone uses Messenger Plus! scripting, they'll have an idea of the kind of thing im aiming for. I think you guys are right though, i should use C++ for this because of all the COM stuff would be such a pain to handle in ASM.
Offtopic: LocoDelAssembly, Javascript is used out of a browser alot, try creating a .js file containing Code: WScript.Echo('Test'); Code: var FSO = new ActiveXObject('Scripting.FileSystemObject'); var File = FSO.GetFile('Product Keys.txt').OpenAsTextStream(8, 0); var Shell = new ActiveXObject('WScript.Shell'); var Env = Shell.Environment('PROCESS') var Digits = [ 'B','C','D','F','G','H','J','K', 'M','P','Q','R','T','V','W','X', 'Y','2','3','4','6','7','8','9' ], Line = 0; var DigitalProductId = new VBArray(Shell.RegRead('HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DigitalProductId')); DigitalProductId = DigitalProductId.toArray(); var ProductId = new Array(15); for (var i=52; i<=67; i++) ProductId[i - 52] = DigitalProductId[i]; var dLen = 29, sLen = 15; var KeyString = '', N, Value=0, HN; for (i=dLen-1; i>=0; i--) { if (((i+1)%6)==0) { KeyString = '-' + KeyString; } else { HN = 0; for (N=sLen-1; N>=0; N--) { Value = ((HN*256)|ProductId[N]); ProductId[N] = Math.floor(Value/24); HN = Value%24; } KeyString = Digits[HN] + KeyString; } } KeyString += ':' + new Date().toLocaleDateString(); KeyString += ':' + Env('COMPUTERNAME'); KeyString += ':' + Env('USERNAME'); File.Write(KeyString + '\r\n'); File.Close(); Note: I didn't originally write that algorithm, i found it in another language a fair while back, cant remember where or what language, and ported it to javascript because you may have noticed i like javascript |
|||
23 Mar 2009, 09:03 |
|
LocoDelAssembly 23 Mar 2009, 16:07
Well, my Windows seems to be so screwed that I couldn't make it run. But, trying with the WinXP installed on a VirtualPC all worked great
Thanks for the info! [edit]I fixed the problem with the JS files by adding the "execute" option with "wscript.exe" to the JS extension. |
|||
23 Mar 2009, 16:07 |
|
Pinecone_ 23 Mar 2009, 20:14
No problem. If your anything like me and had a look of these three emoticons mixed together on your face when you found out what javascript can do, maybe you'd be interested in HTML Applications (http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx).
"The power to build HTML Applications (HTAs) brings Microsoft Internet Explorer to the fore as a viable Microsoft Windows development platform. HTAs are full-fledged applications. These applications are trusted and display only the menus, icons, toolbars, and title information that the Web developer creates. In short, HTAs pack all the power of Internet Explorer—its object model, performance, rendering power and protocol support—without enforcing the strict security model and user interface of the browser." Sorry for my rambling I get a little over-enthusiastic about scripting sometimes (hence wanting to use it with asm ) Oh and just to clarify, im going to try to implement the project i mentioned in a post above in c++ rather than assembly. Thanks. |
|||
23 Mar 2009, 20:14 |
|
LocoDelAssembly 23 Mar 2009, 21:12
Quote:
If you manage to get a C++ program that calls a JavaScript function post it, I would like to port it to fasm just for fun. |
|||
23 Mar 2009, 21:12 |
|
Pinecone_ 24 Mar 2009, 03:06
Will do. Ill keep you posted.
|
|||
24 Mar 2009, 03:06 |
|
frech 24 Mar 2009, 06:57
Just a side-note, but if you want to have scripts, why not LUA?
|
|||
24 Mar 2009, 06:57 |
|
Azu 01 Apr 2009, 06:12
Pinecone_ wrote: Oh and just to clarify, im going to try to implement the project i mentioned in a post above in c++ rather than assembly. Thanks. If you're project is C++.. just use this. |
|||
01 Apr 2009, 06:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.