News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ObjAsm64

Started by Biterider, January 01, 2018, 05:39:01 AM

Previous topic - Next topic

Biterider

Hi HSE
Please try this new set of files (72 objects).

Biterider

HSE

Some minor problems:

CvtRes is called without path (evidently x32 version  is founded first), but that will requiere to change some .bat

I forget the Perl thing (it's in the book but not in the instructions.txt)


Equations in Assembly: SmplMath

qWord

Great!

did work after some manual corrections in the WinInc1 and Objects2 headers. Only Demo06 can't be build because of missing HtmlHelp.lib. The conflict definition of IUnknown and IClassFactory does IMO show that Interfaces and Objects should be distinguished declaratively ;-)

Kind regards

qWord


[1] conflict with IClassFactory; CONNECTDATA::pUnk; some pointer types removed
[2] ANNOTATE-macro missing; some paths in the D3*-files

MREAL macros - when you need floating point arithmetic while assembling!

Biterider

Hi guys
Thank you very much for your feedback. Without it, I'll never improve the code.  :t

@HSE: first post:
- all references to GDI.inc removed.
- IClassFactory redefinition: solved --> needs a general better solution.
- CONNECTDATA symbol problem: solved. Server needs a cookie management function.
- IShellFolder conflict: solved --> needs a general better solution.
- WordHostmissing files: please install the Code\Inc and Code\Lib directories.

@HSE: second post:
- D3Engine.err "% include &ObjPath&D3Math.inc" resolution: no clue atm.
- Missing ANNOTATE macro: included now. Name changed to ANNOTATION.
- Graph2D is not ready by now. Demo07 will come soon.
- PCRE841S.inc missing: added.

@qWord:
- HtmlHelp.lib issue in Demo06: 64 bit version of HtmlHelp is included Code\Inc and Code\Lib directories. I renamed the old Help\ObjAsm32.chm file to ObjAsm64.chm to have something to display when help is called.

I updated following files on the Homepage (http://objasm.x10host.com):

  • ObjAsm64_Beta_2.zip
  • Inc_x64_Beta_2.zip (extract to Code\Inc)
  • Lib_x64_Beta_2.zip (extract to Code\Lib)

Note: the most problematic issue are the api include files. There are different works out there, but none of them is consistent and complete. That is the reason of some incompatibilities that I tried to patch manually until I noticed that a complete different approach is needed. I asked the author of h2incX to release the sources and he generously did it. I'm working now on the translator, which I think is the next needed step.

Regards, Biterider

HSE

 :t :t :t

Almost nothing: in ExceptionDemo.asm msvcrt and kernel32  paths are hardcoded.
Equations in Assembly: SmplMath

Biterider

Thanks HSE  :t
I corrected the paths.


Regards, Biterider

Biterider

Hello
The last few days I've been working on Japheth's h2incX code http://masm32.com/board/index.php?topic=7006.msg75149#msg75149.
I found some memory management issues that I could solve. Looking at the code, it becomes very clear that it was developed for 32-bit applications, so a mayor revamping of the application seems to be necessary.
The goal is to make something like "Windows.inc" or "WinInc.inc" projects but for 64-bit.

The reason I'm writing here is to ask if anyone has used this tool before and is willing to help with this project, especially when it comes to some difficult C language interpretation.  ;)

Regards, Biterider

Biterider

Hello
I'm making some progress in the h2incX project. I hope it is not pointless work, because so far no much interest was signaled.
Nevertheless, I will continue to work on the tool.  :P

I can confirm that reading a code is much more difficult than writing your own. At this rate, I think I'll need another week to release the first beta.

Regards, Biterider

LiaoMi

Hi Biterider,

probably the best development option would be the testing path on complex files, we can compare the results, finalizing the conversion in stages. You can contact ToutEnMasm, he has a very cool converter, but also not perfect, I attached the last version below, its unfortunate that there is no source code, but at least you can compare the results  :icon_rolleyes:

GoneFishing

Hi Biterider,

It is not pointless work.
As for me, I need H2INCX for Linux.  It's a real lot of work to port it to another platform. I'm not sure if I'll be able to accomplish the task  properly. First I'm going to make it  just "Linux - compilable" 







     








Biterider

Hi
Thank you for your feedback!  :t
@ LiaoMi: I'm starting to work with the header files of Windows Kits\10\Include\10.0.16299.0\. I also looked at the Translatorus. Without the sources, it is hard to say how it works, but from the setup file, I think it's strongly based on table lookups. I found another tool on the web "xlatHinc" by J. Radburn. Unfortunately, none of these tools works perfectly.

@ GoneFishing: I never coded for Linux, but I'm really tempted to do. For the time being, I will stay on Windows to finish this project.  :biggrin:

I've the impression that it will be very difficult to program a perfect tool that can handle all cases of the C/C++ syntax.
I wonder how the WinInc project was done. I'm my opinion, some parts have been manually fixed.


Regards, Biterider

habran

Hi Biterider,

I was using my mdi64.exe to fix headers pointers with asterix "*" to INT_PTR before I would use x2incx.exe
to convert file. here is subroutine for that:

FixPointers proc FRAME USES rsi rdi rbx RawText:LPSTR, FixedText:LPSTR,pszFileName :LPCTSTR, fSize:DWORD
local szName [MAX_PATH] :BYTE
local szVar [MAX_PATH] :BYTE
mov rsi,rcx
mov rdi,rdx
mov rbx,rcx
add rbx,r9

.while rsi < rbx
;search for "proto" and transform data
     xor rcx,rcx
     mov r8,rsi
.while BYTE PTR[r8]!= 10
next: mov     al,[r8]
.if   al =='('
            jmp   transfer
            .elseif     al =='*'
            jmp   found
            .endif
            inc     ecx
            inc     r8
            .if r8>rbx
            jmp finish
            .endif
        .endw
found:
.if (BYTE PTR [r8]== '*' && BYTE PTR [r8-1] == '/')
.repeat
.if (BYTE PTR[r8] == 0)
jmp finish
.endif
mov al,[r8]
inc r8
.until (al == '/' && BYTE PTR[r8-2] == '*')
mov rsi,r8
jmp next
.endif
.if ecx < 32
   .if BYTE PTR [r8-1] == ' ' || BYTE PTR [r8-1] == 9
    mov WORD PTR[rdi],909h
    add rdi,2
    mov rax," RTP_TNI"
    mov [rdi],rax
    add rdi,8
    mov rsi,r8
    inc rsi
   .endif
.endif
transfer:
.repeat
mov al,[rsi]
mov [rdi],al
inc rsi
inc rdi
.until al == 10
.endw
finish:
mov byte ptr[rdi],0
xor rax,rax
ret
FixPointers endp

Than after conversion to .inc with h2incx.exe, I was using another routine to convert to x64:

HeadersTo64bits proc FRAME USES rsi rdi rbx r12 RawText:LPSTR, FixedText:LPSTR,pszFileName :LPCTSTR, fSize:DWORD
local szName [MAX_PATH] :BYTE
local szVar [MAX_PATH] :BYTE
mov rsi,rcx
mov rdi,rdx
mov r12,rcx
add r12,r9

invoke lstrcpy,addr szName, pszFileName
invoke PathRemoveExtension,addr szName
invoke PathStripPath, addr szName
invoke CharUpper,addr szName
invoke lstrcat,addr szName, addr szApi
invoke lstrcpy,ADDR szVar,ADDR szWin
invoke lstrcat,ADDR szVar,ADDR szName
.while rsi < r12
;search for "proto" and transform data

.while BYTE PTR[rsi]!= "p"
next: mov     al,[rsi]
            mov     [rdi],al   
        inc     rsi
            inc     rdi
            .if rsi>r12
            jmp finish
            .endif
        .endw
.if dword ptr[rsi+1]=="otor" && byte ptr[rsi-1]==10
add     rsi,5
invoke wsprintf,rdi,addr szDef
add rdi,rax
invoke wsprintf,rdi,addr szVar
add rdi,rax
.if byte ptr[rsi]=="_"
inc rsi
.endif
.while byte ptr[rsi] != " "
mov al,[rsi]
mov [rdi],al
inc rdi
inc rsi
.endw
mov byte ptr[rdi],","
inc rdi
mov al,[rsi]
mov [rdi],al
inc rsi
inc rdi
invoke wsprintf,rdi,addr szStdcall
add rdi,rax
.while byte ptr[rsi]!= 13
mov al,[rsi]
inc rsi
.if al==":"
jmp vars
.endif
.endw
;dec rsi
jmp endline
vars: invoke wsprintf,rdi,addr szComas
add rdi,rax
dec rsi
xor rdx,rdx
.while byte ptr[rsi]!= 13
mov al,[rsi]
.if al==":"
inc rdx
.endif
mov [rdi],al
inc rsi
inc rdi
.endw
mov byte ptr[rdi],">"
inc rdi
mov byte ptr[rdi],","
inc rdi
shl rdx,2
invoke wsprintf,rdi,CSTR("%i"), rdx
add rdi,rax
mov al,13
endline: mov [rdi],al
inc rdi
inc rsi
mov al,[rsi]
mov [rdi],al
inc rsi
inc rdi
mov rax,"ednretxe"
.if qword ptr[rsi]==rax
.while byte ptr [rsi] != 10
inc rsi
.endw
inc rsi
.while byte ptr [rsi] != 10
inc rsi
.endw
inc rsi
.endif
.else
jmp     next
.endif
.endw
finish:
mov byte ptr[rdi],0
xor rax,rax
ret
HeadersTo64bits endp

where .data is:

szDef db '@DefProto ',0
szStdcall db 'stdcall',0
szComas db ', , <',0
szApi db 'API, ',0
szWin db 'WIN',0


I hope it will give you some clue how to do that
I was planing to work on h2incx source to make it work, as well as use some C/C++ compiler to create perfect .inc files, however, at this moment I have taken some brake from UASM and programming for several months.
I would appreciate if you can upgrade h2incx

best regards

Cod-Father

Biterider

Hi Habran
Yesterday I got almost all working again.  :P

The sources we recieved from Japheth don't generate the .inc files from the WinInc project. I assume the author has made some changes or it is a previous version. Nonetheless. I have ported the code from a 16-bit pseudo-object coding style to ObjAsm32. I also implemented code indentation, which makes the translated header file much easier to read.
The translation of COM interfaces is not ready. There I have a problem, because there are many syntax styles for asm. Which one should I take?

I also solved the problem of prototype annotations, at least for the moment.

I need a different approach for known structures, macros, etc. The .ini file is becoming too big!

Prototypes from heapapi.h looks like
HeapCreate proto :DWORD, :SIZE_T, :SIZE_T
HeapDestroy proto :HANDLE
HeapAlloc proto :HANDLE, :DWORD, :SIZE_T
HeapReAlloc proto :HANDLE, :DWORD, :LPVOID, :SIZE_T
HeapFree proto :HANDLE, :DWORD, :LPVOID
HeapSize proto :HANDLE, :DWORD, :LPCVOID
GetProcessHeap proto
HeapCompact proto :HANDLE, :DWORD
HeapSetInformation proto :HANDLE, :HEAP_INFORMATION_CLASS, :PVOID, :SIZE_T


Should they be in this format?

The other problem that is easier to fix is the reserved words from UASM. Do you have a list that you can provide?

Regards, Biterider

PS: If desired, I can post the current sources.

jj2007

Are they supposed to work with both 32-bit and 64-bit code, with SIZE_T being 32 bits wide for the former and 64 bits for the latter? I am asking because Google spit out a hilarious conversation on what SIZE_T means on SOF 8)

Biterider

Hi JJ
don't blame me, I'm just the translator!  ;)

Biterider