Skip to main content

x86 MASM C Linking

Jun 30, 2021LeifMessinger
Loading...

More Plaintext Posts

Wing Data

Oct 31, 2021aedrarian

0 likes • 3 views

##README: Rename file to "data" (no extension) and delete this line
4 4.55
5 5.70
6 6.80
7 7.95
8 9.10
9 10.20
10 11.35
11 12.50
12 13.60
13 14.75
14 15.90
15 17
16 18.15
17 19.30
18 20.40
19 21.55
20 22.70
21 23.80
22 24.95
23 26.10
24 27.25
25 27.80
26 28.95
27 30.10
28 31.20
29 32.35
30 33.50
35 39.15
40 44.80
45 50.50
50 55.60
60 67
70 78.30
75 83.45
80 89.10
90 100.45
100 111.25
125 139
150 166.85
200 222.50

default netplan

Nov 18, 2022AustinLeath

0 likes • 0 views

# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: yes
nameservers:
addresses: [8.8.8.8,8.8.4.4]
version: 2

MASM Over Explained

Jun 29, 2021LeifMessinger

0 likes • 2 views

; Sample project from the video "Setup Visual Studio for Assembly MASM" https://www.youtube.com/watch?v=LqyVybUodXE
; Basically reverses a string using the stack. It stores the result where the string was defined, modifying the string itself in memory.
.386
;x86 instruction set. This is only nessesary in x32 MASM.
.model flat, stdcall
;Defines the memory model, and the calling convention http://masm32.com/board/index.php?topic=6942.msg74381#msg74381
.stack 4096
;Sets the size of the stack. 4096 is 1024*4 which is 4 kilobytes.
;option casemap:none
;Make labels case sensitive, so things like ExitProcess and exitprocess and myName and myname are different.
;include \masm32\include\windows.inc
;include \masm32\include\kernel32.inc
;includelib \masm32\lib\kernel32.lib
;Some system calls or something are defined here. Not needed if you just use assembly along side c++ or c. Also can't be used if on anything other than windows.
ExitProcess PROTO, dwEXITCODE:DWORD
;Define the ExitProcess function prototype. ExitProcess is defined somewhere in the Windows API on the OS level.
.data
;Starts the data section of the program, where a lot of read-write memory is needed
myName BYTE "Leif Messinger", 0
;Allocates a string named myName initialized with LeifMessinger followed by a terminating null character
myNameLength = ($ - myName) - 1
;Allocates a 32 bit number which is initialized to be the current pointer ($), minus the pointer to the start of the string, minus one (because of the null terminating character)
.code
;Starts the section of the program where your code goes. Is the same as .text, and in theory, the name doesn't even matter. The importance is that it ends the data section, which was read-write. Code should be read only.
main PROC
;States the start of the main procedure. This is where the program starts executing.
mov ecx, myNameLength
;Sets the loop counter to myNameLength. The loop counts backwards until it reaches zero, meaning that it loops myNameLength times.
mov esi, 0
;Sets the general purpose register esi to 0. esi was named because it's a "source index" when moving stuff. It's basically like an i variable in c.
StackIt:
;Flag to the start of the loop. Ahh, tss push it
movzx eax, myName[esi]
;movzx stands for move with zero extend. It pads the source data (myName[esi]) with enough zeros to fill 32 bits, or enough for the push and pop instructions.
push eax
;Pushes the character we just got out of that string (and padded with zeros) to the stack
inc esi
;Increments our index
loop StackIt
;Decrements ecx and checks if it is equal to 0. If it isn't, jump to StackIt
mov ecx, myNameLength
;Sets the loop counter to myNameLength. The loop counts backwards until it reaches zero, meaning that it loops myNameLength times.
mov esi, 0
;Sets the general purpose register esi to 0. esi was named because it's a "source index" when moving stuff. It's basically like an i variable in c.
PopIt:
;Flag to the start of the loop.
pop eax
;Pops a 32 bit number off the stack and places it in eax
mov myName[esi], al
;Move the lower byte of eax (al) to the string (myName) at the index esi. This overwrites one character of the string.
inc esi
;Increments our index
loop PopIt
;Decrements ecx and checks if it is equal to 0. If it isn't, jump to StackIt
INVOKE ExitProcess, 0
;Exits the program with the error code of 0. The return type was declared in that prototype at the top, and defined by the operating system
main ENDP
;States the end of the main procedure
END main
;Declares the end of the file. Also defines where the start of the program is, which is main.
;Normally the linker looks for main as a place to start, but if you are writing pure assembly, that is need.
;Saying END without a pointer to the start is also alowed for people who like to live dangerously.

Lorem Ipsum Plaintext

Oct 15, 2022CodeCatch

0 likes • 0 views

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

AWS EC2 Cloud-Init User Detail

Nov 18, 2022AustinLeath

0 likes • 8 views

#!/bin/bash
yum -y install httpd
systemctl enable httpd
systemctl start httpd
hostname > /var/www/html/index.html

SCCM drive formatting

Nov 18, 2022AustinLeath

0 likes • 1 view

in case of SCCM error 0x800700A1 do the following:
diskpart
list disk (list all disks on system)
select disk 0 (0 being the disk to setup)
clean (wipes the disk)
create partition primary (creates windows partition)
select partition 1 (selects the first partition)
format quick fs=NTFS (sets format of primary partition)
assign letter C (assigns the drive letter to "C")
exit (exits diskpart)