Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

BinRun() - Run binary executable from Memory (e.g. Resource)


  • Please log in to reply
39 replies to this topic
tmplinshi
  • Members
  • 245 posts
  • Last active: Mar 12 2015 02:29 PM
  • Joined: 06 Apr 2012

Works now. Thank you very much, HotkeyIt!

 

BTW, You forgot to change BinRun() to this:

BinRun(pData,cmdLine="",cmdLineScript="",Hide=0,ExeToUse=""){

    return new _BinRun(pData,cmdLine,cmdLineScript,Hide,ExeToUse)
}


HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Thanks, I have updated above.



Taurus
  • Members
  • 5 posts
  • Last active: Aug 13 2015 09:10 AM
  • Joined: 27 Jul 2015

Hi, i am new here. I started using autohotkey one year ago and it was love at first sight.  :)

 

 

First of all: Your code is really great. Thank you for spending your time. That helped me a lot!  ;) 

 

It's working perfect on Win 7 to Win 8.1, but i run into trouble on Win Servers, especially on Win Terminal Server. I am getting the following problems:

 

 

Test has stopped working

 

Window can check online for a solution to the problem

 

Name der fehlerhaften Anwendung: test.exe, Version: 0.0.0.0, Zeitstempel: 0x556ef838
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 6.1.7601.18409, Zeitstempel: 0x53159a86
Ausnahmecode: 0x0eedfade
Fehleroffset: 0x0000c42d
ID des fehlerhaften Prozesses: 0x1cbc
Startzeit der fehlerhaften Anwendung: 0x01d0b235a57bf574
Pfad der fehlerhaften Anwendung: C:\Public\Apps\Test\test.exe
Pfad des fehlerhaften Moduls: C:\Windows\syswow64\KERNELBASE.dll

 

 

Any idea?

Maybe Win 7 and Terminal Server have different dll-calls or some are not supported. But i can't find out, which of them are not working. (i am Newbie to DllCalls :(  )

 

Thank you for your help!

 

PS: I am using AHK_L



HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Can you show the script you tried to execute and also what version your server is?



Taurus
  • Members
  • 5 posts
  • Last active: Aug 13 2015 09:10 AM
  • Joined: 27 Jul 2015
Sure:

This is my ready to use script:

My Script

The server is Win Server 2012.

The extracting of an 7zip-file via this script is working on the server, but i am not able to open a delphi program.

I created a VM Server 2012 via Virtualbox and now i am able to test/debug the script. Maybe i will find the problem.

Is it possible to ship the used win 7 / 8 -Dll with my exe?

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Your link does not work.

For Delphi you will probably need a different exe in ExeToUse parameter:

 

ExeToUse - by default the executable of current process is taken and A_WinDir "\Microsoft.NET\Framework\v2.0.50727\vbc.exe" to launch 32-bit exe from 64-bit process



Taurus
  • Members
  • 5 posts
  • Last active: Aug 13 2015 09:10 AM
  • Joined: 27 Jul 2015
Sorry, i posted the wrong link. I have edited it above. I am using Unicode 32-bit and my delphi.exe is also 32-bit. I tried to copy the framework to the server, but it doesn't make a difference. I am still wondering, why it's working perfect on Win 7 / 8 and not working on Server 2008+. I thought, MS uses the same code base. Any idea, how i can debug the script on the server. I can only test it, when compiled, so i am not able to use the debugger of Scite.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

So did you try to run Process_ID := BinRun("MyDelphiExe.exe", "", "", 1, A_ScriptDir "\delphi.exe")?



Taurus
  • Members
  • 5 posts
  • Last active: Aug 13 2015 09:10 AM
  • Joined: 27 Jul 2015
Yes, i treid that too. It's working fine on Win 7/8, but breaks on the server.

Looks like the system dlls are different.

Win 7:

C:\Windows\SysWOW64 - kernel32.dll = 1.088 KB

Win Server 2012:

C:\Windows\SysWOW64 - kernel32.dll = 952 KB

Maybe MS removed some call-functions.

Do you need only one dll? Maybe i can ship it with the exe and modify DllCall(" with DllCall("A_Script \ kernel32.dll). I tried that out, but it's not working right.

Taurus
  • Members
  • 5 posts
  • Last active: Aug 13 2015 09:10 AM
  • Joined: 27 Jul 2015
Another question/idea: can i run it with "UseErrorlevel"?