flat assembler
Message board for the users of flat assembler.

Index > Windows > How can I get VS to sign my fasm code?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 07:35
Hi
I'm looking for best solution to migrate FASM projects to VisualStudio. Do you know some?

There is two ways to do that as I see:
1) Compile to MS COFF obj file
2) Convert to MASM for build-in subsystem

First solution need to prepare whole import section and rebuild resource section in C++. I need help on it to create convertion macro or so.

Second solution looks closer to FASM but what to do with all of that FASM's macros? No way...

Partially use both solutions or what? That is not really cool for develop and testing in FASM. All I want is to complete something in FASM and just insert into VS for the rest of signing and so.
Post 08 Jun 2024, 07:35
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20207
Location: In your JS exploiting you and your system
revolution 08 Jun 2024, 08:31
Do you want to create compatible source code that VS can use, i.e. convert fasm assembly source to MASM assembly source?

If so you can use PREPSRC.ASM (in the TOOLS folder) to get the raw source after preprocessing. Then all the macros are expanded..

Then use sed, or something similar, to massage the output into MASM syntax.
Post 08 Jun 2024, 08:31
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 12:03
How to order PREPSRC.ASM?
Post 08 Jun 2024, 12:03
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 16:15
PREPSRC.EXE Source.asm Result.inc

error: input file is not a recognized assembly information format.
Post 08 Jun 2024, 16:15
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20207
Location: In your JS exploiting you and your system
revolution 08 Jun 2024, 16:22
I think you need to pass the .fas file.
Post 08 Jun 2024, 16:22
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3973
Location: vpcmipstrm
bitRAKE 08 Jun 2024, 16:31
Overclick wrote:
I'm looking for best solution to migrate FASM projects to VisualStudio.
Visual Studio doesn't have assembly language support.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 08 Jun 2024, 16:31
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20207
Location: In your JS exploiting you and your system
revolution 08 Jun 2024, 16:42
Perhaps awk is a better choice than sed.

But nevertheless, if VS doesn't support assembly then the whole plan is useless. Sad
Post 08 Jun 2024, 16:42
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 16:54
I did, converted to .inc but what to do next? A lot of if-else-end if , virtual etc
What exactly I have to convert or replace on it?


Description:
Filesize: 31.9 KB
Viewed: 1183 Time(s)

Capture2.PNG


Post 08 Jun 2024, 16:54
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 16:57
bitRAKE wrote:
Overclick wrote:
I'm looking for best solution to migrate FASM projects to VisualStudio.
Visual Studio doesn't have assembly language support.


Description:
Filesize: 86.57 KB
Viewed: 1182 Time(s)

Capture3.PNG


Post 08 Jun 2024, 16:57
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20207
Location: In your JS exploiting you and your system
revolution 08 Jun 2024, 17:02
Overclick wrote:
What exactly I have to convert or replace on it?
I expect you need a big block of search/replace logic. MASM has if constructs (IIRC they are #IF). and the "offset" and "dword ptr" etc.

But virtual probably isn't a MASM thing. Confused
Post 08 Jun 2024, 17:02
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 17:05
revolution wrote:

But virtual probably isn't a MASM thing. Confused

sounds like dead end
Confused
Post 08 Jun 2024, 17:05
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3973
Location: vpcmipstrm
bitRAKE 08 Jun 2024, 18:36
ASSUME is the closest MASM gets to VIRTUAL.

If a custom build script is what passes for "support" then just write a VS build script for fasm.

Look in something like ...
C:\Program Files (x86)\Microsoft Visual Studio\2022\[Edition]\Common7\IDE\ItemTemplates\ ... *.vstemplate

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 08 Jun 2024, 18:36
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 08 Jun 2024, 19:07
Quote:

If a custom build script is what passes for "support"

The code is not from template, I found example in web and copy-pasted to check. It is built-in support in just virgin VS installed yesterday. That "customization" provided by MS itself with debug, steps, safe exceptions and etc features. If it that easy for FASM as you say then show me example.


Description:
Filesize: 55.49 KB
Viewed: 1153 Time(s)

Capture4.PNG


Post 08 Jun 2024, 19:07
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3973
Location: vpcmipstrm
bitRAKE 08 Jun 2024, 19:48
Debugger integration would require FAS -> PDB tool. The other things are possible with creation of XML property page.


Description: It's all possible besides the PDB debugging.
Filesize: 22.91 KB
Viewed: 1078 Time(s)

Screenshot 2024-06-08 173734.png



_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 08 Jun 2024, 19:48
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 09 Jun 2024, 06:23
I found instruction for setup MASM there:
https://programminghaven.home.blog/2020/02/16/setup-an-assembly-project-on-visual-studio-2019/

bitRAKE, I really hope you (or someone, or Tomasz hisself) help to do something similar for FASM
Post 09 Jun 2024, 06:23
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3973
Location: vpcmipstrm
bitRAKE 09 Jun 2024, 19:36
VS is an enterprise class tool with the slowness to match. The only benefit I see would be to integrate fasmg in the most general fashion to support learning and very complex build scenarios. This would require demultiplexing to desired targets. Certainly non-trivial - I'll need to give it more thought.
Post 09 Jun 2024, 19:36
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 09 Jun 2024, 20:04
Any other idea to sign/validate my fasm-projects to let it be allowed for Microsoft Store? Seems I need to try do it in masm from scratch Mad
Post 09 Jun 2024, 20:04
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3973
Location: vpcmipstrm
bitRAKE 09 Jun 2024, 23:17
Code:
@echo off
setlocal

:: Usage
if "%~1"=="" (
    echo Usage: sign.cmd [debug^|release] path_to_binary
    exit /b 1
)

set MODE=%~1
set FILEPATH=%~2

:: Path to signtool.exe, adjust as necessary
set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe"

:: Check if signtool exists
if not exist %SIGNTOOL% (
    echo signtool.exe not found.
    exit /b 1
)

:: Proceed based on mode
if /I "%MODE%"=="debug" (
    echo Debug mode: Signing with self-signed certificate...
    :: Ensure you have created a self-signed certificate named MySelfSignedCert.pfx
    %SIGNTOOL% sign /f MySelfSignedCert.pfx /p password /fd SHA256 /td SHA256 /tr http://timestamp.digicert.com /v %FILEPATH%
) else if /I "%MODE%"=="release" (
    echo Release mode: Signing with CA certificate...
    :: Assuming you have a CA certificate named MyCACert.pfx
    %SIGNTOOL% sign /f MyCACert.pfx /p password /fd SHA256 /td SHA256 /tr http://timestamp.digicert.com /v %FILEPATH%
) else (
    echo Invalid mode. Use 'debug' or 'release'.
    exit /b 1
)

echo Signing completed.
endlocal    
Perhaps this will work?

For testing you can create a self-signed cert with:
Code:
makecert -n "CN=MyTestCertificate" -r -sv MyTestCertificate.pvk MyTestCertificate.cer
pvk2pfx -pvk MyTestCertificate.pvk -spc MyTestCertificate.cer -pfx MyTestCertificate.pfx -po YourPFXPassword    
... I'm not sure what this has to do with MASM?

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 09 Jun 2024, 23:17
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 10 Jun 2024, 10:49
Microsoft Store seems to certificate itself, but Verification process need to be passed. Question: How to pass Verification process? To check it works I need to pass it localy first, but it crashes my app without results. Requirenments says I need VS, that means I need compile in VS right?
Post 10 Jun 2024, 10:49
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3973
Location: vpcmipstrm
bitRAKE 10 Jun 2024, 13:06
Overclick wrote:
Requirenments says I need VS
I'd be helpful to know where you are seeing this?

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 10 Jun 2024, 13:06
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.