The MASM Forum

General => The Campus => Topic started by: gelatine1 on January 29, 2016, 02:29:33 AM

Title: Distribution of a masm program
Post by: gelatine1 on January 29, 2016, 02:29:33 AM
Hi, I have been writing a program in masm and now I would like to share it with a few other people. I have never actually done this so I was wondering, should I write an installer? can i be sure that my code will work on any other windows system ? What about antiviruses thinking my program has bad intentions ? (my own antivirus usually thinks my programs in masm are malicious.. even though they aren't).
So how do I go about installing a masm program ?

thanks in advance

Ps: i added the source files and the program (in case anyone is interested...) (beware quite messy source code)
Title: Re: Distribution of a masm program
Post by: Grincheux on January 29, 2016, 05:57:04 AM
I believe that you cannot make commercial use of your program but Huch will tell you more.

See this (http://www.masm32.com/licence.htm) it's the licence.
Title: Re: Distribution of a masm program
Post by: Grincheux on January 29, 2016, 05:58:38 AM
Nice RubikCube.
The mouse is hidden while selecting the menu (windows 10 Pro)
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 29, 2016, 06:13:54 AM
I don't want to use it for commercial purposes. Just as a usefull tool for people. The program contains some more features which are 'hidden'. if the user presses enter a random configuration appears between start and end (or linear if selected). If a bool is checked inside the code (the edit bool) the user can change a color of the cube and save it to a file so it can be added to the configurations.

Right now I am having problems with antialiasing and I am not completely satisfied with the mouse input.

And i don't know why the mouse is being hidden in windows 10 (I have windows  7 myself)
Title: Re: Distribution of a masm program
Post by: Vortex on January 29, 2016, 07:06:55 AM
Hi gelatine1,

QuoteI have never actually done this so I was wondering, should I write an installer?

No need of an installer if your application is only one executable.

Quotecan i be sure that my code will work on any other windows system ?

To be sure, you need to test it on different versions of Windows.

QuoteWhat about antiviruses thinking my program has bad intentions ? (my own antivirus usually thinks my programs in masm are malicious.. even though they aren't).

You can instruct your antivirus to ignore the case - place the application to the exceptions list if it's possible.
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 29, 2016, 07:12:07 AM
Quote from: Vortex on January 29, 2016, 07:06:55 AM
QuoteWhat about antiviruses thinking my program has bad intentions ? (my own antivirus usually thinks my programs in masm are malicious.. even though they aren't).

You can instruct your antivirus to ignore the case - place the application to the exceptions list if it's possible.

Yes I can do that for myself but not for them.  I don't want people to think they downloaded a malicious program from me while it isn't. So I rather have something that asks the user "do you trust this application?" instead of antivirus shouting "danger!"
Title: Re: Distribution of a masm program
Post by: Vortex on January 29, 2016, 07:24:28 AM
QuoteSo I rather have something that asks the user "do you trust this application?"

Technically, one can never be 100% sure. You can also use a sandbox application to protect your system.
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 29, 2016, 07:30:50 AM
Hi gelatine1,

When using the mouse nothing happens, only the keyboard works.

Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
Windows 8.1
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 29, 2016, 07:48:33 AM
Quote from: Siekmanski on January 29, 2016, 07:30:50 AM
Hi gelatine1,

When using the mouse nothing happens, only the keyboard works.

Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
Windows 8.1

Well using the mouse you should click on a certain square, keep the mouse pressed, move it to another square and release there (make sure the line between the two would represent a valid cube turn)? if this still doesn't work It's probably got to do something with the color picking maybe it's reading another alpha value somewhere or i don't know :/
I decided to give up on the ray picking i was trying before :p
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 29, 2016, 08:02:00 AM
It doesn't work on my PC  :(
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 29, 2016, 08:56:37 AM
Could you see in odbg what the value of startalpha is right after clicking some of the green faces? It should be between 9 and 17. The source code for that should be around line 1000 in cube.asm or simply search WM_LBUTTONDOWN. If the alpha values are not being read correctly then its obviously not working because of that..

Otherwise you could try to remove the whole WM_MOUSEMOVE message code (if you have some spare time ofcourse). As that code could possibly be messing with the moved bool...

The mouse not working is obviously a big issue :S
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 29, 2016, 10:50:39 AM
Can you post these missing files...

../glMacros/gl.mac ( gl.def line 1416 )
../glMacros/glu.mac ( glu.def line 250 )
..\macros\mymacro.asm ;macros  ( cube.asm line 26 )
Title: Re: Distribution of a masm program
Post by: hutch-- on January 29, 2016, 01:39:12 PM
Hi gelatine1,

The only limit on code written in MASM32 is you cannot give it away to a different licencing system (GPL and similar). What you write is your own property, its up to you as to whether you supply the source code and you can sell it or give it away. The reason for the restriction on making code GPL is because nothing in the MASM32 SDK is owned by the GNU organisation so their rules of forced supply of code cannot be applied.

RE the executable file, make sure you supply a manifest with it and a resource based version control block. This will ensure that most AV scanners and the OS will not have any problems with it.
Title: Re: Distribution of a masm program
Post by: jj2007 on January 29, 2016, 04:27:13 PM
Quote from: hutch-- on January 29, 2016, 01:39:12 PMRE the executable file, make sure you supply a manifest with it and a resource based version control block. This will ensure that most AV scanners and the OS will not have any problems with it.

Reason is obviously that virus writers do not know what a manifest and a VCB are 8)
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 30, 2016, 02:49:42 AM
Quote from: Siekmanski on January 29, 2016, 10:50:39 AM
Can you post these missing files...

../glMacros/gl.mac ( gl.def line 1416 )
../glMacros/glu.mac ( glu.def line 250 )
..\macros\mymacro.asm ;macros  ( cube.asm line 26 )

Sorry.... totally forgot about the macro's. new zip file with macros in attachment. thank you alot for trying to help.

Quote from: hutch-- on January 29, 2016, 01:39:12 PM
Hi gelatine1,
The only limit on code written in MASM32 is you cannot give it away to a different licencing system (GPL and similar).
I have basically no knowledge about licencing systems or whatsoever but I assume I can't do anything wrong by not doing anything at all..? (for this)

Quote from: hutch-- on January 29, 2016, 01:39:12 PM
RE the executable file, make sure you supply a manifest with it and a resource based version control block. This will ensure that most AV scanners and the OS will not have any problems with it.

Where could i find good information on those topics (how to create them)?

Thanks in advance
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 30, 2016, 03:13:46 AM
Can you also post  your msvcrt.lib and msvcrt.inc ?
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 30, 2016, 03:30:48 AM
I'm afraid I do not have msvcrt.lib... the .inc file was just in the masm include folder...
But I see the msvcrt.lib is being included in my file but it's really not there...
how can I include a file thats apparently not existing ?? What sorcery is this ?
i do have msvcrt.dll maybe that's it ?
Title: Re: Distribution of a masm program
Post by: jj2007 on January 30, 2016, 04:06:34 AM
Quote from: gelatine1 on January 30, 2016, 03:30:48 AM
I'm afraid I do not have msvcrt.lib

\Masm32\lib\msvcrt.lib is part of the Masm32 package.
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 30, 2016, 04:08:21 AM
Quote from: jj2007 on January 30, 2016, 04:06:34 AM
Quote from: gelatine1 on January 30, 2016, 03:30:48 AM
I'm afraid I do not have msvcrt.lib

\Masm32\lib\msvcrt.lib is part of the Masm32 package.

I guess I'll reinstall masm then as it is really not there..
Title: Re: Distribution of a masm program
Post by: TouEnMasm on January 30, 2016, 04:18:27 AM
Quote
Where could i find good information on those topics (how to create them)?

resource based version control block :it is a VERSIONINFO resource,good information in this forum
manifest ,good information http://masm32.com/board/index.php?topic=1235.msg11991#msg11991
Lazy method for manifest is to let's it done by visual studio,compiling your project with it,when he is finished.
There is a tool who create them,Mt.exe.
https://msdn.microsoft.com/fr-fr/library/ms235591.aspx

Using the original msvcrt.lib is also a good soluce to avoid false alerts of antivirus
Title: Re: Distribution of a masm program
Post by: Vortex on January 30, 2016, 05:58:16 AM
Hi gelatine1,

A method to build msvcrt.lib :

\masm32\bin\polib.exe /OUT:msvcrt.lib %windir%\system32\msvcrt.dll
Title: Re: Distribution of a masm program
Post by: hutch-- on January 30, 2016, 06:45:14 AM
As part of the installation, go to the masm32\tools\makecimp directory and run the batch file MAKEVCRT.BAT.
Title: Re: Distribution of a masm program
Post by: GoneFishing on January 30, 2016, 07:00:26 AM
Hi  gelatine1
Cool ! Well done .
I built your app from reply #14. Compiles and works fine !  :t
I think there's no need for installer in this case . Just unzip it for the girl you like most  ;)
Title: Re: Distribution of a masm program
Post by: HSE on January 30, 2016, 07:37:31 AM
Impressive! :eusa_clap:  How I can solve the cube?  :biggrin:

Apparently mouse (and menu) don't work in full screen mode, but perfectly in a window. (win7)


Title: Re: Distribution of a masm program
Post by: gelatine1 on January 30, 2016, 07:49:51 AM
Thank you all for the nice feedback :)

Right now Im looking to build the manifest according to the links provided by toutenasm (thanks!) I'm not sure what I should actually use in the xml and resource files to make it better or something..

And I got the msvcrt.lib file back. Hutch is there an essential difference between that and the method provided by vortex ?

Quote from: HSE on January 30, 2016, 07:37:31 AM
Impressive! :eusa_clap:  How I can solve the cube?  :biggrin:

Apparently mouse (and menu) don't work in full screen mode, but perfectly in a window. (win7)
Oh I have never actually tried the fullscreen mode (to be honest fullscreen modes annoy me very much :p but it was included in the first opengl tutorials so i used it..) I'll try to see if i can fix the mouse there. you could try to solve the cube by randomly doing some moves and in a finite time it will be solved :P
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 30, 2016, 08:26:49 PM
Hi gelatine1,

It never executes the "turn,[startalpha],[endalpha]" proc
Because startalpha and endalpha are always both 255 ( at least on my windows 8.1 PC.... )

I've implemented a messagebox with the alpha values.

Used these params for glReadPixels to show colors and alpha,

GL_UNSIGNED_INT_8_8_8_8 equ 08035h ; not in your includes

invoke glReadPixels,ecx,eax,1,1,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8,addr startalpha
invoke glReadPixels,ecx,eax,1,1,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8,addr endalpha

It only shows the colors and alpha values, it doesn't turn.
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 30, 2016, 09:13:30 PM
Quote from: Siekmanski on January 30, 2016, 08:26:49 PM
Hi gelatine1,

It never executes the "turn,[startalpha],[endalpha]" proc
Because startalpha and endalpha are always both 255 ( at least on my windows 8.1 PC.... )

I've implemented a messagebox with the alpha values.

Used these params for glReadPixels to show colors and alpha,

GL_UNSIGNED_INT_8_8_8_8 equ 08035h ; not in your includes

invoke glReadPixels,ecx,eax,1,1,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8,addr startalpha
invoke glReadPixels,ecx,eax,1,1,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8,addr endalpha

It only shows the colors and alpha values, it doesn't turn.

Alright thanks Siekmanski! I have same issue when I'm in fullscreen so I'll try to see what goes wrong there and maybe that will fix the problem on your pc too.
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 31, 2016, 12:10:40 AM
Okay in some cases the screen was created with only 16 bits per pixel so the alpha channel is ignored or not accurate enough. I changed it now and it works for me in fullscreen now. can you test if it works for you now ?

thanks
Title: Re: Distribution of a masm program
Post by: HSE on January 31, 2016, 01:17:58 AM
Hi Gelatine1!

Now mouse work in full screen, but don't make movements (in any mode). Only the face selected change color ( in some cases become Gray).

Regards. HSE
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 31, 2016, 01:23:13 AM
Same here, no color change.
Title: Re: Distribution of a masm program
Post by: gelatine1 on January 31, 2016, 01:36:13 AM
Quote from: HSE on January 31, 2016, 01:17:58 AM
Hi Gelatine1!

Now mouse work in full screen, but don't make movements (in any mode). Only the face selected change color ( in some cases become Gray).

Regards. HSE
Oh yes that's just a variable called 'edit'. change the value to 0 and build again and the faces will turn. I should make it so one can change it from inside the program though...

Quote from: Siekmanski on January 31, 2016, 01:23:13 AM
Same here, no color change.

I can't really think of what might be wrong then ... Maybe something specific with your graphics card or I don't know :/
Title: Re: Distribution of a masm program
Post by: Siekmanski on January 31, 2016, 05:41:27 AM
Yeah, I can't find it either.
I only checked the alpha values not the whole source code, when I fill all alpha values with zero it reads 255 back.
Title: Re: Distribution of a masm program
Post by: HSE on January 31, 2016, 08:13:01 AM
 :t
Title: Re: Distribution of a masm program
Post by: Siekmanski on February 01, 2016, 12:17:01 AM
I had to know why glReadPixels always returned an alpha value of 255 on my PC.
Finally found out why.  :biggrin:

Video cards need the PIXELFORMATDESCRIPTOR.cAlphaBits set to 8.
Some work if cAlphaBits is set to 0.

And you do not need the alphaBlend functions to read the alpha values.

Made an example to check it.
Title: Re: Distribution of a masm program
Post by: gelatine1 on February 01, 2016, 01:11:29 AM
So changing PIXELFORMATDESCRIPTOR.cAlphaBits to 8 is the only thing to do to make it work right ? Thanks alot for helping by the way! I've been looking through the files you posted and i was wondering what's the .rap file ?
You're a very good programmer ;)
Title: Re: Distribution of a masm program
Post by: Siekmanski on February 01, 2016, 02:11:01 AM
Yes, that must be the solution.
The .rap file is the project file for RadASM.
That's the programming environment I use.