Author Topic: typedef ptr  (Read 125 times)

Biterider

  • Member
  • **
  • Posts: 123
  • ObjAsm32
    • ObjAsm32
typedef ptr
« on: October 14, 2017, 11:56:01 PM »
Hello
I've the following code (see attachment) using UASM 2.42:
Code: [Select]
LPSTR1 typedef ptr
LPSTR2 typedef ptr WORD


.code


align 16
TestProc proc FRAME
    local pMyStr1:LPSTR1
    local pMyStr2:LPSTR2
    local MyBYTE:BYTE
    local MyWORD:WORD
    local MyDWORD:DWORD
    local MyQWORD:QWORD


The sizeof operator returns 8 for [/size]pMyStr1 & pMyStr2 but VS shows these locals as sized like QWORD and DWORD. I guess that this is caused due to an issue with the debug info.Regards, Biterider

johnsa

  • Member
  • ****
  • Posts: 549
    • Uasm
Re: typedef ptr
« Reply #1 on: October 16, 2017, 07:22:03 PM »
Hi,

The attachment says it's corrupt. Could you add it again or mail me the source?
thanks.

LiaoMi

  • Member
  • **
  • Posts: 154
Re: typedef ptr
« Reply #2 on: October 16, 2017, 08:35:09 PM »
Hi,

my downloading of attachments works well, Code.zip and VS.zip its pictures  :biggrin:

Code: [Select]
option casemap:none
option dotname     
option frame:auto 
option win64:11   

LPSTR1 typedef ptr
LPSTR2 typedef ptr WORD

.code

align 16
TestProc proc FRAME
    local pMyStr1:LPSTR1
    local pMyStr2:LPSTR2
    local MyBYTE:BYTE
    local MyWORD:WORD
    local MyDWORD:DWORD
    local MyQWORD:QWORD

    mov rax, sizeof(pMyStr1)
    mov rbx, sizeof(pMyStr2)

    mov rax, sizeof(MyBYTE)
    mov rbx, sizeof(MyWORD)
    mov rcx, sizeof(MyDWORD)
    mov rdx, sizeof(MyQWORD)

    ret
TestProc endp


align 16
Start:             
    and rsp, 0FFFFFFFFFFFFFFF0h
    invoke TestProc
    ret
end Start

johnsa

  • Member
  • ****
  • Posts: 549
    • Uasm
Re: typedef ptr
« Reply #3 on: October 16, 2017, 08:47:10 PM »
I believe 8 is correct as the size of the pointer is 8bytes / qword.


Biterider

  • Member
  • **
  • Posts: 123
  • ObjAsm32
    • ObjAsm32
Re: typedef ptr
« Reply #4 on: October 16, 2017, 08:58:51 PM »
Hi
"LPSTR2 typedef ptr WORD" should also be a pointer (8 bytes) but ist is shown as 4 bytes.
[/size]
[/size]Biterider

johnsa

  • Member
  • ****
  • Posts: 549
    • Uasm
Re: typedef ptr
« Reply #5 on: October 16, 2017, 09:04:23 PM »
Your screenshot shows it as 8 bytes ?