News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Build_Po Tool

Started by zooba, January 02, 2006, 04:11:01 AM

Previous topic - Next topic

zooba

I've ported my build tool (see this thread) to POASM and made it use POASM, PORC and POLINK rather than the Microsoft equivalents. I've included the source code this time (I didn't last time) and only minimal modification were necessary.

The biggest gripe I came across is that macro parameters are evaluated when they are passed, so if you want to use a parameter as a string and a value you need to pass it twice - once in angle brackets and once not (see lines 308-316).

Other than that, a very nice smooth transition  :toothy Good work Pelle  :U :clap:

Edit: New version of download including resource definition file and batch file to build :U

[attachment deleted by admin]

PellesC

Quote from: zooba on January 02, 2006, 04:11:01 AM
The biggest gripe I came across is that macro parameters are evaluated when they are passed, so if you want to use a parameter as a string and a value you need to pass it twice - once in angle brackets and once not (see lines 308-316).
Yes, this simplifies *many* things for me. To early to tell how much *problems* it will cause me...

Quote from: zooba on January 02, 2006, 04:11:01 AM
Other than that, a very nice smooth transition  :toothy Good work Pelle  :U :clap:
Thanks!  :bg

Pelle

ipadilla

#2
Hi zooba,
I am trying ro build you "Build_po.asm" utility but  run_synch_process() and wait_key() are missing. Can you help me?. Thank you
ipadilla

zooba

Sorry. Those two are parts of my custom MASM32.LIB build.

Copy & paste this code into the .ASM file and it should work okay (the prototypes will need to go at the top, the rest at the bottom before the 'END' line :U)

wait_key     PROTO
run_synch_process    PROTO :DWORD

wait_key PROC
    LOCAL   hConsole:DWORD
    LOCAL   dwConsoleMode:DWORD
   
    invoke  GetStdHandle, STD_INPUT_HANDLE
    mov     hConsole, eax
   
    invoke  GetConsoleMode, hConsole, ADDR dwConsoleMode
    invoke  SetConsoleMode, hConsole, 0
    invoke  ReadFile, hConsole, NULL, 1, NULL, NULL
    invoke  SetConsoleMode, hConsole, dwConsoleMode

    invoke  FlushConsoleInputBuffer, hConsole
    ret
wait_key ENDP




run_synch_process PROC lpCommand:DWORD

    LOCAL st_info:STARTUPINFO
    LOCAL pr_info:PROCESS_INFORMATION

  ; ---------------------
  ; zero fill STARTUPINFO
  ; ---------------------
    mov ecx, 17                 ; 68 bytes SIZEOF STARTUPINFO
    lea edx, st_info
    xor eax, eax
  @@:
    mov [edx], eax
    add edx, 4
    sub ecx, 1
    jnz @B
    mov st_info.dwFlags, STARTF_USESHOWWINDOW

    mov st_info.cb, 68          ; set the structure size member

    invoke CreateProcess,NULL,lpCommand,NULL,NULL,
                         NULL,NULL,NULL,NULL,
                         ADDR st_info,
                         ADDR pr_info

    test eax, eax               ; if CreateProcess fails
    jnz @F
    ;mov eax, -2                 ; set return value for CreateProcess fail
    ret

  @@:
    invoke SetPriorityClass,pr_info.hProcess,0

    invoke WaitForSingleObjectEx,pr_info.hProcess,INFINITE,0
    push   eax
    invoke GetExitCodeProcess, pr_info.hProcess, esp    ; pushes mem space for return value

    invoke CloseHandle, pr_info.hThread
    invoke CloseHandle, pr_info.hProcess

    pop eax                     ; return value from GetExitCodeProcess

    ret

comment * ---------------------------------
    WaitForSingleObjectEx return values

    WAIT_FAILED               equ -1
    WAIT_OBJECT_0             equ 0
    WAIT_ABANDONED            equ 00000080h
    WAIT_ABANDONED_0          equ 00000080h
    WAIT_TIMEOUT              equ 00000102h
    WAIT_IO_COMPLETION        equ 000000C0h
        --------------------------------- *

run_synch_process ENDP


ipadilla

Hi Zooba,

Thank you very much indeed, you are very kind.
After building, the size is different: NewBuild_po.exe (5120 bytes) from your Build_po.exe(9216 bites). and dose not work, why?
Please see the Build.bat and Build_po.asm files after modification as you tool me.
Thank you
ipadilla

[attachment deleted by admin]

zooba

Yes, my fault again  :red I forgot to include the resource definition file. I've updated the download at the top of the page

Guess that's the problem with releasing too quickly... i can't even use the 'late at night' excuse (3pm)  :lol

ipadilla

Thank you zooba, nice work.
ipadilla

PBrennick

zooba,
This is a very nice concept, very well done.
Paul
The GeneSys Project is available from:
The Repository or My crappy website