Author Topic: c-- name conflict  (Read 579 times)

Emil_halim

  • Member
  • **
  • Posts: 111
c-- name conflict
« on: April 10, 2018, 06:05:43 AM »
Hi All

There are some c-- structure's names or member's names conflict with uasm keyword , such as 'Name'

so in my cmm2masm project , there are two solutions

1- i have to changing all conflicted keywords in all header's files , so hard mission!! also for users they must changing their structure's member or name

2- i can let cmm2masm to check that and prefix the conflict name with '_' char. , how can i get those keyword?

any help please?

habran

  • Member
  • *****
  • Posts: 1170
    • uasm
Re: c-- name conflict
« Reply #1 on: April 10, 2018, 04:51:36 PM »
It is defined in coffspec.h

struct IMAGE_SECTION_HEADER {
    char Name[IMAGE_SIZEOF_SHORT_NAME];
    union {
        uint_32 PhysicalAddress;
        uint_32 VirtualSize;
    } Misc;
    uint_32 VirtualAddress;
    uint_32 SizeOfRawData;
    uint_32 PointerToRawData;
    uint_32 PointerToRelocations;
    uint_32 PointerToLinenumbers;
    uint_16 NumberOfRelocations;
    uint_16 NumberOfLinenumbers;
    uint_32 Characteristics;
};
Cod-Father

Emil_halim

  • Member
  • **
  • Posts: 111
Re: c-- name conflict
« Reply #2 on: April 10, 2018, 11:35:14 PM »
thanks habran.

where can i find all the conflict keywords?

habran

  • Member
  • *****
  • Posts: 1170
    • uasm
Re: c-- name conflict
« Reply #3 on: April 10, 2018, 11:51:18 PM »
bin.c, coff.c, coffspec.h, pespec.h, preproc.c, sal.h
Cod-Father

jj2007

  • Member
  • *****
  • Posts: 8608
  • Assembler is fun ;-)
    • MasmBasic
Re: c-- name conflict
« Reply #4 on: April 10, 2018, 11:54:10 PM »
\Masm32\include\Windows.inc:
IMAGE_SECTION_HEADER STRUCT
    Name1 db IMAGE_SIZEOF_SHORT_NAME dup(?)

nidud

  • Member
  • *****
  • Posts: 1565
    • https://github.com/nidud/asmc
Re: c-- name conflict
« Reply #5 on: April 11, 2018, 12:00:46 AM »
You have to look at all the keywords in the header files. Some of the most used is THIS, NAME, TYPE, MASK, and WIDTH.

Emil_halim

  • Member
  • **
  • Posts: 111
Re: c-- name conflict
« Reply #6 on: April 11, 2018, 01:18:46 AM »
thanks all,

Here is my function that return a non conflict name , also it fire a warning message.

char* keywrd[] = { "name","short","TYPE" };
int   keywrdnum = 3;
char keyCnflctName[255];

char* doConflictCheck(char* name)
{
   int k = 0;
   while (k < keywrdnum)
   {
      if (!stricmp(name, keywrd[k++]))
      {
         keyCnflctName[0] = '_';
         printf("warnning : found conflict object \'%s\' changed to \'_%s\'\n", name,name);
         return strcpy(keyCnflctName+1, name)-1;
      }
   }
   return  name;
}

i will increase it sooner , but if any one has faster one , please let me know.