Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   How to fix these three RadASM compile errors? (https://forum.exetools.com/showthread.php?t=14920)

bridgeic 04-02-2013 18:07

How to fix these three RadASM compile errors?
 
1 Attachment(s)
I'm working on an asm file, now seems only 3 errors, I don't understand it, anyone can give help? Many thanks.

K:\testasm\_tolower.asm(18) : error A2008: syntax error : _SYSTEM_INFO
K:\testasm\_tolower.asm(38) : error A2008: syntax error : type
K:\testasm\_tolower.asm(498) : error A2081: missing operand after unary operator

bilbo 04-02-2013 19:32

First Error:
first field of _SYSTEM_INFO struc cannot refer itself. In Windows it is an union
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
but you can replace the line
anonymous_0 _SYSTEM_INFO::$1593C2ABA4C275C0FBEC2498FA3B0937 ?
with
dwOemId dd ?
without problems


Second and third error:
"Type" name is a reserved word: simply replace it with _Type, for example


Best regards,
bilbo

bridgeic 04-02-2013 21:57

Quote:

Originally Posted by bilbo (Post 83775)
First Error:
first field of _SYSTEM_INFO struc cannot refer itself. In Windows it is an union
......

It works, many thanks, bilbo.

After generate the .obj file and do LINK with VC, it reports errors below, any lib file I need add when do LINK?

; Imports from KERNEL32.dll
; HMODULE __stdcall GetModuleHandleA(LPCSTR lpModuleName)
externdef GetModuleHandleA:dword

error LNK2019: Unresolved external symbol _GetModuleHandleA
......
error LNK2019: Unresolved external symbol _LeaveCriticalSection

cnbragon 04-02-2013 22:49

you should link with kernel32.lib

bridgeic 04-02-2013 22:57

Quote:

Originally Posted by cnbragon (Post 83788)
you should link with kernel32.lib

But I have used it already, still get this error.

Below is the options I used:

LINK /nologo /NODEFAULTLIB /OPT:NOREF /out:test.exe test.obj lmgr.lib libsb.lib libcrvs.lib .\activation\lib\libnoact.lib oldnames.lib kernel32.lib user32.lib netapi32.lib advapi32.lib gdi32.lib comdlg32.lib comctl32.lib wsock32.lib libcmt.lib _tolower.obj

Av0id 04-03-2013 12:46

you need to set environment variable or include path for those libs in link parameters /LIBPATH, IIRC

bridgeic 04-03-2013 12:59

Quote:

Originally Posted by Av0id (Post 83806)
you need to set environment variable or include path for those libs in link parameters /LIBPATH, IIRC

Hi Av0id,

I do the VC setting as below, is this enough or still something missing? Thank you for your help on check.

@set MYPATH=C:\Program Files\VC2008
@set PATH=%MYPATH%\bin
@set INCLUDE=%MYPATH%\include;%MYPATH%\PlatformSDK\Include;%MYPATH%\atlmfc\include;%MYPATH%\DirectX_SDK\Include;
@set LIB=%MYPATH%\lib;%MYPATH%\PlatformSDK\Lib;%MYPATH%\atlmfc\lib;%MYPATH%\DirectX_SDK\Lib\x86;

bilbo 04-03-2013 13:20

kernel32.lib does not export GetModuleHandleA, but _imp__GetModuleHandleA
So you need to replace
Code:

externdef GetModuleHandleA:dword
with
Code:

pr1 typedef PROTO :DWORD
externdef [email protected]:PTR pr1
GetModuleHandleA equ <[email protected]>

Best regards
bilbo

bridgeic 04-03-2013 14:22

Quote:

Originally Posted by bilbo (Post 83811)
kernel32.lib does not export GetModuleHandleA, but _imp__GetModuleHandleA
So you need to replace
Code:

externdef GetModuleHandleA:dword
with
Code:

pr1 typedef PROTO :DWORD
externdef [email protected]:PTR pr1
GetModuleHandleA equ <[email protected]>

Best regards
bilbo

Wow, it works, Thanks a million, bilbo.

bridgeic 04-03-2013 14:29

Quote:

Originally Posted by bilbo (Post 83811)
pr1 typedef PROTO :DWORD
externdef [email protected]:PTR pr1
GetModuleHandleA equ <[email protected]>
[/CODE]

May I ask one more question, here "@4" mean ? Sorry, I'm newbie on this.

bridgeic 04-03-2013 15:09

Hi Bilbo,

Seems I can't simply copy/paste and just rename the function name as solution for other Unresolved external symbols.

I modify GetLastError as below, but don't works.
pr2 typedef PROTO £ºDWORD
externdef [email protected]:PTR pr2
GetLastError equ <[email protected]>

Is there easy way can work it out for all Unresolved external symbols below?

_GetLastError
_MultiByteToWideChar
_WideCharToMultiByte
_GetCurrentProcess
_VirtualAlloc
_VirtualFree
_SetLastError
_WriteFile
_GetModuleFileNameA
_GetSystemInfo
_VirtualProtect
_GetCPInfo
_GetLocaleInfoA
_VirtualQuery
_InterlockedExchange
_InitializeCriticalSection
_GetStringTypeW
_GetStringTypeA
_LoadLibraryA
_GetProcAddress
_GetStdHandle
_GetCurrentThreadId
_LCMapStringW
_LCMapStringA
_ExitProcess
_TerminateProcess
_HeapReAlloc
_HeapAlloc
_HeapFree

bilbo 04-03-2013 20:03

Quote:

I modify GetLastError as below, but don't works.
@4 means the total number of bytes required by function arguments (google for __stdcall calling convention). Now, GetLastError has no args at all. So, if you open kernel32.lib with an hex editor (I suggest you HxD) and look for GetLastError, you will find [email protected] and not [email protected]

Quote:

Is there easy way can work it out for all Unresolved external symbols below?
have a look at this link

Quote:

Sorry, I'm newbie on this
I like the approach you are following. I learned a lot of things using exactly the same approach than yours. By the way, how have you solved the assembly errors from defines such as
ms_exc = CPPEH_RECORD ptr -18h
in _tolower.asm?

Best regards
bilbo

bridgeic 04-03-2013 21:30

Quote:

Originally Posted by bilbo

have a look at this link

Sorry, it seems can't be download now, may I get your help to share if you have it?

Quote:

Originally Posted by bilbo
I like the approach you are following. I learned a lot of things using exactly the same approach than yours.

Thank you, I have put much time on it, near succeed now, many thanks for your patience to help me.

Quote:

Originally Posted by bilbo
how have you solved the assembly errors from defines such as
ms_exc = CPPEH_RECORD ptr -18h
in _tolower.asm?

I just add /Zm option when compile to make it back to masm5.10 .



Many many thanks, bilbo, you help me a lots, very appreciated. :)

ragdog 04-04-2013 00:09

Hi

Radasm set standart the environment variable or include path

You must only add in the source include the Lib

Include kernel32.inc
Includelib kernel32.lib

Or use a macro called "uselib"

uselib kernel,gdi32,.....

bridgeic 04-04-2013 01:41

Quote:

Originally Posted by ragdog (Post 83834)
Hi

Radasm set standart the environment variable or include path

You must only add in the source include the Lib

Include kernel32.inc
Includelib kernel32.lib

Or use a macro called "uselib"

uselib kernel,gdi32,.....

Hi ragdog,

I have done that way, but seems doesn't work, would you give more suggestion whether others need check? Thanks.


All times are GMT +8. The time now is 01:44.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX