News:

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

Main Menu

how to add new data section in .asm file.

Started by sukratu, June 29, 2016, 06:04:04 PM

Previous topic - Next topic

sukratu

Hi,

In my current project I have VS solution which includes some .c file and some .asm file.
I moved some global variables from .c file in a secure section by defining

#pragma section("SECURE",read,write)
#pragma data_seg("SECURE")

__declspec(allocate("SECURE"))
char buffer[MAX_SIZE]

In .asm file there are some variables which I want to move to this SECURE section.

I want to know how to create a new data section named "SECURE" in .asm file and how to move a variable in that section.

Thanks & Regards,
Sukrut



sinsi

Not sure about VS but with MASM you would do this

SECURE segment public ;might not need public
myvar dd 4
SECURE ends


sukratu

Thanks for the reply sinsi,

It is not working with VS.

jj2007

sgSeg segment public read write 'BSS'
gvStart dd ?
sgSeg ends


Works but only for 4096 bytes. Beyond that, I can see the memory in Olly but get an access violation.

Any trick to force a bigger segment?

mabdelouahab

   Dim macro   name__,n
      SECURE      SEGMENT PUBLIC BYTE 'BSS'   
         IFB <n>
            name__   DB   ?
         ELSE
            name__   DB   n    dup(?)
         ENDIF
      SECURE      ENDS
   endm
   DimD macro   name__
      SECURE      SEGMENT PUBLIC BYTE 'BSS'   
         name__   DD   ?
      SECURE      ENDS
   endm
   DimW macro   name__
      SECURE      SEGMENT PUBLIC BYTE 'BSS'   
         name__   DW   ?
      SECURE      ENDS
   endm
   
   Dim s,8192
   Dim s2,4096
   DimW ww
   DimD bb

Quote from: jj2007 on November 04, 2016, 11:37:29 PM
Works but only for 4096 bytes. Beyond that, I can see the memory in Olly but get an access violation.
Any trick to force a bigger segment?
it works fine

jj2007