Kitsune Posted July 8, 2008 Share Posted July 8, 2008 Has anyone else had trouble running EXEs compiled from assembler language with Run() in AutoIt? Link to comment Share on other sites More sharing options...
Airwolf Posted July 8, 2008 Share Posted July 8, 2008 Has anyone else had trouble running EXEs compiled from assembler language with Run() in AutoIt?No, but you could try _RunDos(), which is basically just Run(@ComSpec & " /c program.exe"). This is identical to running the exe from the command prompt. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
Kitsune Posted July 8, 2008 Author Share Posted July 8, 2008 No, but you could try _RunDos(), which is basically just Run(@ComSpec & " /c program.exe"). This is identical to running the exe from the command prompt.Tried that already and I still get errors. It works when I use ShellExecute() but there is no way to get a connection to the IO stream with that function.Perhaps there is a PROTO structure that would work more appropriately in my ASM code? Link to comment Share on other sites More sharing options...
cppman Posted July 8, 2008 Share Posted July 8, 2008 (edited) What errors do you get? AutoIt errors? Does the program crash? You need to be more specific with that. muttley I don't see why a program written in ASM would be any different then a program written in, say C++. They both "convert" to the same code in the end. Edited July 8, 2008 by cppman Miva OS Project Link to comment Share on other sites More sharing options...
Kitsune Posted July 8, 2008 Author Share Posted July 8, 2008 (edited) The EXE crashes when it is run by AutoIt, it works without any problems when I run it from the console manually. And I also tested an old c++ project of mine with the function and that worked perfectly, which is why I'm at a loss. Edited July 8, 2008 by Kitsune Link to comment Share on other sites More sharing options...
cppman Posted July 8, 2008 Share Posted July 8, 2008 Weird. It works for me just fine. I assembled this with NASM (to "boot.exe")... ORG 100h section .data message db 'Please type in your name: $', 0 response db 'Your name is: $', 0 buffer db 255 resb 256 section .text %include "common.asm";just some macros I wrote... printstr message getstr buffer exit And then ran it with AutoIt: Run("boot.exe") Miva OS Project Link to comment Share on other sites More sharing options...
Kitsune Posted July 8, 2008 Author Share Posted July 8, 2008 I used MASM 6.15 for compiling the code, here's one of the codes that I tried testing with. CODETITLE L6 include Irvine32.inc .data prompinput db "Enter a test score between 0 and 100, enter -1 if you don't have a score to enter",0 promperror db "That is an invalid input",0 prompletter db "Your letter grade for this test score is ",0 promptotala db "You have entered a total of ",0 promptotalb db " valid test scores",0 prompavg db "The average test score is ",0 total sdword (0) .code main proc sub eax,eax sub ebx,ebx sub ecx,ecx sub edx,edx call crlf ;================= ;beginning of loop ;================= L1: mov edx,offset prompinput call writestring call crlf call readint ;=============== ;tests the input ;=============== cmp eax,-1 je done cmp eax,0 jb error cmp eax,100 ja error ;========================== ;processes valid test score ;========================== add total,eax cmp eax,90 jae Agrade cmp eax,80 jae Bgrade cmp eax,70 jae Cgrade cmp eax,60 jae Dgrade mov al,'F' jmp givegrade Agrade: mov eax,0 mov al,'A' jmp givegrade Bgrade: mov eax,0 mov al,'B' jmp givegrade Cgrade: mov eax,0 mov al,'C' jmp givegrade Dgrade: mov eax,0 mov al,'D' jmp givegrade ;===================================== ;displays the letter grade to the user ;===================================== call crlf givegrade: mov edx,offset prompletter call writestring call writechar inc ecx call crlf jmp L1 ;================================================================= ;display error message if value entered fails the valid input test ;================================================================= error: call crlf mov edx,offset promperror call writestring call crlf jmp L1 ;=========================================== ;displays the total number of scores entered ;=========================================== done: call crlf mov edx,offset promptotala call writestring mov eax,ecx call writedec mov edx,offset promptotalb call writestring call crlf call crlf mov edx,offset prompavg call writestring mov eax,total mov edx,0 div ecx ;========================== ;processes average score ;========================== add total,eax cmp eax,90 jae AgradeAvg cmp eax,80 jae BgradeAvg cmp eax,70 jae CgradeAvg cmp eax,60 jae DgradeAvg mov al,'F' jmp givegradeAvg AgradeAvg: mov eax,0 mov al,'A' jmp givegradeAvg BgradeAvg: mov eax,0 mov al,'B' jmp givegradeAvg CgradeAvg: mov eax,0 mov al,'C' jmp givegradeAvg DgradeAvg: mov eax,0 mov al,'D' jmp givegradeAvg ;===================================== ;displays the average letter grade to the user ;===================================== call crlf givegradeAvg: call writechar exit main endp end main And here is the .inc shown in the code. CODE; Include file for Irvine32.lib (Irvine32.inc) INCLUDE SmallWin.inc ; MS-Windows prototypes, structures, and constants .NOLIST ; Last update: 1/27/02 ;---------------------------------------- ; Procedure Prototypes ;---------------------------------------- ClrScr PROTO ; clear the screen Crlf PROTO ; output carriage-return / linefeed Delay PROTO ; delay for n milliseconds DumpMem PROTO ; display memory dump DumpRegs PROTO ; display register dump GetCommandTail PROTO ; get command-line string GetDateTime PROTO, ; get system date and time startTime:PTR QWORD GetMseconds PROTO ; get milliseconds past midnight Gotoxy PROTO IsDigit PROTO ; return ZF=1 if AL is a decimal digit Randomize PROTO ; reseed random number generator RandomRange PROTO ; generate random integer in specified range Random32 PROTO ; generate 32-bit random integer ReadInt PROTO ; read signed integer from console ReadChar PROTO ; reach single character from console ReadHex PROTO ; read hexadecimal integer from console ReadString PROTO ; read string from console SetTextColor PROTO ; set console text color WaitMsg PROTO ; display wait message, wait for Enter key WriteBin PROTO ; write integer to output in binary format WriteChar PROTO ; write single character to output WriteDec PROTO ; write unsigned decimal integer to output WriteHex PROTO ; write hexadecimal integer to output WriteInt PROTO ; write signed integer to output WriteString PROTO ; write null-terminated string to output ; Copy a source string to a target string. Str_copy PROTO, source:PTR BYTE, target:PTR BYTE ; Return the length of a null-terminated string.. Str_length PROTO, pString:PTR BYTE ; Compare string1 to string2. Set the Zero and ; Carry flags in the same way as the CMP instruction. Str_compare PROTO, string1:PTR BYTE, string2:PTR BYTE ; Trim a given trailing character from a string. ; The second argument is the character to trim. Str_trim PROTO, pString:PTR BYTE, char:BYTE ; Convert a null-terminated string to upper case. Str_ucase PROTO, pString:PTR BYTE ;----------------------------------- ; Standard 4-bit color definitions ;----------------------------------- black = 0000b blue = 0001b green = 0010b cyan = 0011b red = 0100b magenta = 0101b brown = 0110b lightGray = 0111b gray = 1000b lightBlue = 1001b lightGreen = 1010b lightCyan = 1011b lightRed = 1100b lightMagenta = 1101b yellow = 1110b white = 1111b .LIST Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now