flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved] undefined symbol GetSystemWow64Directory

Author
Thread Post new topic Reply to topic
doutor



Joined: 29 Jan 2021
Posts: 2
doutor 29 Jan 2021, 12:30
When i add:
Code:
import kernel32,\
     GetSystemWow64Directory,'GetSystemWow64DirectoryA'
    

Compiler returns:
Quote:

Error: symbol already defined

and when this is removed i'm getting:
Quote:

undefined symbol GetSystemWow64Directory

How fix this?
Code:
format PE GUI 4.0

entry start 

include 'win32ax.inc'
include 'api\user32.inc'
include 'api\kernel32.inc'

section '.data' data readable writeable

a rb MAX_PATH  

section '.code' code readable executable

start:
      invoke GetSystemWow64Directory, a, MAX_PATH
      cmp eax, 0
      je exit
 
      invoke MessageBox, 0, a, '', MB_OK

exit:
      invoke ExitProcess, 0        
      
section '.idata' import data readable

 library kernel32,'kernel32.dll',\
      user32,'user32.dll'

import kernel32,\
     GetSystemWow64Directory,'GetSystemWow64DirectoryA'
    
Post 29 Jan 2021, 12:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20590
Location: In your JS exploiting you and your system
revolution 29 Jan 2021, 12:39
If you add custom APIs to kernel32 then you can't use the default fasm libraries.

Something like this, where you manually construct the API tables, and remove the 'x' from win32a.inc:
Code:
format PE GUI 4.0

entry start

include 'win32a.inc'

section '.data' data readable writeable

a rb MAX_PATH

section '.code' code readable executable

start:
      invoke GetSystemWow64Directory, a, MAX_PATH
      cmp eax, 0
      je exit

      invoke MessageBox, 0, a, '', MB_OK

exit:
      invoke ExitProcess, 0

section '.idata' import data readable

 library kernel32,'kernel32.dll',\
      user32,'user32.dll'

import kernel32,\
     ExitProcess,'ExitProcess',\
     GetSystemWow64Directory,'GetSystemWow64DirectoryA'

import user32,\
     MessageBox,'MessageBoxA'    
Post 29 Jan 2021, 12:39
View user's profile Send private message Visit poster's website Reply with quote
doutor



Joined: 29 Jan 2021
Posts: 2
doutor 29 Jan 2021, 13:15
revolution wrote:
If you add custom APIs to kernel32 then you can't use the default fasm libraries.

Something like this, where you manually construct the API tables, and remove the 'x' from win32a.inc:
Code:
format PE GUI 4.0

entry start

include 'win32a.inc'

section '.data' data readable writeable

a rb MAX_PATH

section '.code' code readable executable

start:
      invoke GetSystemWow64Directory, a, MAX_PATH
      cmp eax, 0
      je exit

      invoke MessageBox, 0, a, '', MB_OK

exit:
      invoke ExitProcess, 0

section '.idata' import data readable

 library kernel32,'kernel32.dll',\
      user32,'user32.dll'

import kernel32,\
     ExitProcess,'ExitProcess',\
     GetSystemWow64Directory,'GetSystemWow64DirectoryA'

import user32,\
     MessageBox,'MessageBoxA'    


Thank you my friend. Solved! Very Happy
Post 29 Jan 2021, 13:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.