News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Inappropriate or missing operand

Started by FlySky, August 02, 2009, 02:29:40 PM

Previous topic - Next topic

FlySky

Hey there guys,

Just started the switch from MASM to GoASM.

Practicing some 64 bit programming and having a problem with certain api's

For example the OpenProcess API:

invoke OpenProcess,PROCESS_ALL_ACCES, 0, [pid] when compiling it gives me an error like the title of this topic.

I also noticed on some sources I studied than when calling a simple MessageBox using the MessageBoxA API that the last argument: uType can't be defined as MB_OK (show button OK) and I need to use the Ordinal 40h instead. Is it possible to use Arguments like in MASM or do I need to use Ordinals etc.. and where can I read up on them as I have no clue where I could find them.
Thanks in advance.

ecube

FlySky are you using my unofficial SDK? from here http://www.masm32.com/board/index.php?topic=11180.0

using that you should have no problem as it includes donkeys headers so stuff like MB_OK etc are defined, there should be enough examples to get you up and running. I really need to release new SDK, and stop being a perfectionist. So many additions been added that recommending above is like recommending windows 98 when I just finished with XP heh.




jorgon

Hi FlySky

Welcome to the forum and to GoAsm!

Should this be PROCESS_ALL_ACCESS not PROCESS_ALL_ACCES?

In GoAsm, yes you can use words which are defined to mean something else, eg. MB_OK is defined as 40h.

Quoteand where can I read up on them as I have no clue where I could find them
If you want to look for these defines which are really just constant values you can download the Microsoft platform SDK (from the MSDN site).  Then you will get all the Microsoft header files (extension ".h").  These are normally put in the Program Files\Microsoft Platform SDK\include folder.  The SDK also gives you all the API specifications which is essential for Windows programming.  To find the correct one, look at the API specifications in the SDK and at the bottom it will tell you which header file applies to that API.  Please note that all these header files are also available in a form directly readable by GoAsm as Donkey's header files available from here, or within E^Cube's unofficial GoAsm SDK.  Also Wayne Radburn wrote a conversion program called xlatHinc which converts ".h" header files to a GoAsm readable form.  That is available from here.  Bryant Keller also created header files available from here.   There are also header files available within the Easy Code and RadAsm IDEs.  I'm afraid I've lost track a little as to which set of header files are which, others will guide you.  This is because personally I don't use them.  I think I must be about the only person who doesn't judging from the messages on this board!  Instead I simply insert the constant value in the source code and write in the Microsoft word as a comment in the source.  I also prefer to insert any required structures directly in my source.  This is only my own personal preference and GoAsm does support the use of such files.


Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

FlySky

Thanks for the answers guys, I am using your SDK E^Cube, But I think I have to define donkeys headers in the projects right, as I noticed goASM doesn't use include files? Like MASM does. When compiling and linking, I am setting the appropriate/ needed dll's there.

jorgon

If you want to use include files, you can do so with GoAsm.
See comments above.

#include MyHeaderFile.inc
#include MyOtherHeaderFile.h


The above would be in the source code file.
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

FlySky

It's working fine, thanks for the replies. You did a very nice job on GoASM Jorgon. I am comming from MASM myself and it's not very difficult to pick up on GoASM. The 64 Bit possibilities are phenomenal.
I am going to convert a few more sources thanks for the replies.

ecube

The examples in the SDK should show you how to use things for instance

;this links in necessary imports
#DEFINE LINKFILES

;comment this if building for 32bit
#Define WIN64

;windows.h which includes various other .h's
#include "\GoAsm\include\windows.h"
#include "\GoAsm\macros\Macros.asm"

DATA SECTION

CODE SECTION
START:
#ifndef WIN64
invoke MessageBox,0,"hello","i'm running in 32bit!",MB_ICONINFORMATION
#else
invoke MessageBox,0,"hello","i'm running in 64bit!",MB_ICONINFORMATION
#endif
invoke ExitProcess,0


then 32build.bat looks like

set INCLUDE=C:\GoAsm\include

\GoAsm\bin\GoAsm /x86 Example.asm
\GoAsm\bin\GoLink Example.obj
pause


64build.bat looks like

set INCLUDE=C:\GoAsm\include

\GoAsm\bin\GoAsm /x64 Example.asm
\GoAsm\bin\GoLink /fo Example.exe Example.obj
pause


so as you can see is pretty similar to MASM32. Also yeah jorgon did an incredible job on GoAsm, is a real pleasure to use.

donkey

Quote from: FlySky on August 02, 2009, 04:09:37 PM
Thanks for the answers guys, I am using your SDK E^Cube, But I think I have to define donkeys headers in the projects right, as I noticed goASM doesn't use include files? Like MASM does. When compiling and linking, I am setting the appropriate/ needed dll's there.

Hi FlySky,

GoAsm uses include files similar to MASM in both form and substance, as a matter of fact the header project is probably greater than 60% directly compatible with MASM. The only real difference is that I chose to use the .H extension as opposed to the .INC extension. This was primarily to allow them to match the documentation at MSDN but also to help distinguish them from MASM includes so there would be less confusion about which ones are used with which assembler.

For the DLLs you can use the LINKFILES switch with my headers to define the appropriate DLLs for GoAsm to search.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

FlySky

Hey guys,

I am really pleased to announce I am doing very well so far. The provided examples in the SDK are great. I am playing around with using resource files in goASM now, and noticed the nice example in the SDK from E^Cube called Resource. However when I want to compile that example in 64 Bit I am getting an error. The following error is shown: GoLink was given an mixture of Win32 and Win64 Object files. Compiling and linking 32 bit, disable the 64 bit switch #Define WIN64 and changing the bat to:

set INCLUDE=C:\GoAsm\include

\GoAsm\bin\GoAsm /x86 engine.asm
\GoAsm\bin\GoRc /r engine.rc
\GoAsm\bin\GoLink engine.obj engine.res

pause

all compiles great but when doing it for 64 BIT I get that error? Do I need to recompile/ recreate the .rc file with 64 bit trigger code or something? I am playing with EasyCode but that only supports 32 bit projects.

I didn't want to start a new topic just for this question I hope you guys don't mind.


jorgon

Hi FlySky

This seems to be a problem with GoLink.
If everything is working properly, the res file produced by GoRC can be used by GoLink for both 32-bit and 64-bit linking.  GoLink is supposed to check from the object files which are given to it, whether the final exe should be 32-bit or 64-bit.  It then converts the res file accordingly.
I shall look into this and come back to you with a fix for this bug in GoLink.

As a temporary work-around, you can ask GoRC to produce a 64-bit object file containing the resources using:-\GoAsm\bin\GoRc /fo engineRC.obj /machine AMD64 engine.rcThis will produce an object file called engineRC.obj.  Then change "engine.res" in the GoLink command line to "engineRC.obj"
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

jorgon

I have now fixed this problem and the latest version of GoLink 0.26.11 is available from here.

So, FlySky you can revert to your original command lines using this version.

Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

FlySky

Works like a charm, much appreciated, really nice Jorgon, your support on GoASM is phenomenal.