EXETOOLS FORUM  

Go Back   EXETOOLS FORUM > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2013, 18:07
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Arrow How to fix these three RadASM compile errors?

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
Attached Files
File Type: rar _tolower.rar (19.3 KB, 6 views)
Reply With Quote
  #2  
Old 04-02-2013, 19:32
bilbo bilbo is offline
Friend
 
Join Date: Jul 2004
Posts: 101
Rept. Given: 36
Rept. Rcvd 15 Times in 12 Posts
Thanks Given: 15
Thanks Rcvd at 12 Times in 8 Posts
bilbo Reputation: 15
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
Reply With Quote
  #3  
Old 04-02-2013, 21:57
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Quote:
Originally Posted by bilbo View Post
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
Reply With Quote
  #4  
Old 04-02-2013, 22:49
cnbragon cnbragon is offline
Friend
 
Join Date: Nov 2010
Posts: 26
Rept. Given: 1
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 3
Thanks Rcvd at 0 Times in 0 Posts
cnbragon Reputation: 1
you should link with kernel32.lib
Reply With Quote
  #5  
Old 04-02-2013, 22:57
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Quote:
Originally Posted by cnbragon View Post
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
Reply With Quote
  #6  
Old 04-03-2013, 12:46
Av0id Av0id is offline
VIP
 
Join Date: Jan 2006
Posts: 399
Rept. Given: 112
Rept. Rcvd 111 Times in 69 Posts
Thanks Given: 0
Thanks Rcvd at 3 Times in 3 Posts
Av0id Reputation: 100-199 Av0id Reputation: 100-199
you need to set environment variable or include path for those libs in link parameters /LIBPATH, IIRC
Reply With Quote
  #7  
Old 04-03-2013, 12:59
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Quote:
Originally Posted by Av0id View Post
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;
Reply With Quote
  #8  
Old 04-03-2013, 13:20
bilbo bilbo is offline
Friend
 
Join Date: Jul 2004
Posts: 101
Rept. Given: 36
Rept. Rcvd 15 Times in 12 Posts
Thanks Given: 15
Thanks Rcvd at 12 Times in 8 Posts
bilbo Reputation: 15
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 _imp__GetModuleHandleA@4:PTR pr1
GetModuleHandleA equ <_imp__GetModuleHandleA@4>
Best regards
bilbo
Reply With Quote
  #9  
Old 04-03-2013, 14:22
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Quote:
Originally Posted by bilbo View Post
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 _imp__GetModuleHandleA@4:PTR pr1
GetModuleHandleA equ <_imp__GetModuleHandleA@4>
Best regards
bilbo
Wow, it works, Thanks a million, bilbo.
Reply With Quote
  #10  
Old 04-03-2013, 14:29
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Quote:
Originally Posted by bilbo View Post
pr1 typedef PROTO WORD
externdef _imp__GetModuleHandleA@4:PTR pr1
GetModuleHandleA equ <_imp__GetModuleHandleA@4>
[/CODE]
May I ask one more question, here "@4" mean ? Sorry, I'm newbie on this.

Last edited by bridgeic; 04-03-2013 at 14:36.
Reply With Quote
  #11  
Old 04-03-2013, 15:09
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
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 _imp__GetLastError@4:PTR pr2
GetLastError equ <_imp__GetLastError@4>

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
Reply With Quote
  #12  
Old 04-03-2013, 20:03
bilbo bilbo is offline
Friend
 
Join Date: Jul 2004
Posts: 101
Rept. Given: 36
Rept. Rcvd 15 Times in 12 Posts
Thanks Given: 15
Thanks Rcvd at 12 Times in 8 Posts
bilbo Reputation: 15
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 _imp__GetLastError@0 and not _imp__GetLasterror@4

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
Reply With Quote
  #13  
Old 04-03-2013, 21:30
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
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.
Reply With Quote
  #14  
Old 04-04-2013, 00:09
ragdog ragdog is offline
Friend
 
Join Date: Feb 2011
Posts: 57
Rept. Given: 2
Rept. Rcvd 25 Times in 7 Posts
Thanks Given: 9
Thanks Rcvd at 3 Times in 2 Posts
ragdog Reputation: 25
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,.....
Reply With Quote
  #15  
Old 04-04-2013, 01:41
bridgeic bridgeic is offline
Friend
 
Join Date: Jun 2012
Posts: 88
Rept. Given: 7
Rept. Rcvd 3 Times in 3 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
bridgeic Reputation: 3
Quote:
Originally Posted by ragdog View Post
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile eror rcer General Discussion 8 06-25-2013 18:21
Why this error report in RadASM? bridgeic General Discussion 3 04-02-2013 17:36


All times are GMT +8. The time now is 11:35.


��ICP��05004977��
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX