News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Windows Projects

Started by Manos, February 09, 2019, 06:22:42 AM

Previous topic - Next topic

Vortex

With thanks to Manos helping me to understand the Nasm style inline assembly, here is a quick example to calculate the size of a function :

#include <stdio.h>

int testfunc(int x,int y,int *pSize)
{
    int result;
    int temp;

    asm
    {
        mov     edx,label1
        dec     edx
l1:
        inc     edx
           
// Search for the RET ( 0xC3 ) instruction

        cmp     byte [edx], 0xC3
        jne     l1

        mov     dword [temp],edx
    }

    result=x;
    result+=y;

    *pSize=1+(int)temp-(int)testfunc;
   
label1:

    return result;
}


int main(void)
{
    int fSize;

    testfunc(10,20,&fSize);

    printf("Size of the function testfunc = %d bytes\n",fSize);

    return 0;

}

Vortex

Quotesplitter.exe splits a large file into megabyte chunks for transmission. It will also recombine them.

https://www.digitalmars.com/splitter.c

Compiling the code :

set PATH=%PATH%;\pcc32\bin

pcc32.exe /MM /I\pcc32\include /c splitter.c
link32 /SUBSYSTEM:CONSOLE /LIBPATH:\pcc32\lib /NEV splitter.obj kernel32.lib user32.lib msvcrt.lib