3

Can anyone explain, why fopen takes as argument- not a file name- according to code takes some off_6A5D8C:

.text:00537F9F                 push    offset stru_6C4E40 ; FILE *
.text:00537FA4                 call    _fclose
.text:00537FA9                 push    offset aWt      ; "wt"
.text:00537FAE                 push    offset off_6A5D8C ; char *
.text:00537FB3                 call    _fopen
.text:00537FB8                 mov     dword_83AE9C, eax

and I tracked this off_6A5D8C it's pointed to label loc_4C554E:

.data:006A5D8C ; char off_6A5D8C
.data:006A5D8C off_6A5D8C      dd offset loc_4C554E    
.data:006A5D90 ; char aWt[]
.data:006A5D90 aWt             db 'wt',0
.text:004C554E loc_4C554E:
.text:004C554E                 mov     esp, ebp
.text:004C5550                 pop     ebp
.text:004C5551                 retn    0Ch

I am not expert in disassembling, may be it requires perform Undefine operation for loc_4C554E - and in this case it's looks like:

.text:004C554E unk_4C554E      db  8Bh ; Ë             ; DATA XREF: .data:off_6A5D8Co
.text:004C554F                 db 0E5h ; õ
.text:004C5550                 db  5Dh ; ]
.text:004C5551                 db 0C2h ; T
.text:004C5552                 db  0Ch
.text:004C5553                 db    0

Seems it is string terminated with 0. How to turn this string (file name) to readable look? Thanks in advance.

  • 1
    Is this the difference between "NUL" vs 0x004C554E? It's probably helpful for future questions to include the raw bytes in your view. – mumbel Jul 5 at 18:54
6

It takes the file name, but IDA doesn't recognise it.

In this example, IDA interpreted 4-byte string NUL\x00 (4E 55 4C 00) as an offset (address 0x004C554E) in the code. You may force it to interpret it as an ascii string simple by pressing a when the cursor is on the line 006A5D8C.

The reason that the byte order is reversed is that x86 architecture uses little endian byte ordering, so in case you interpret 4E 55 4C 00 as a number, the byte order will be reversed (hence 0x004C554E).

| improve this answer | |
  • Thank you very much, bart1e! – black4 Jul 6 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.