MASM

Running asm procedure in cpp file

蹲街弑〆低调 提交于 2019-12-11 12:34:23
问题 I am trying to run procedure from asm file in cpp file but i get such errors: Error 1 error LNK2019: unresolved external symbol _calka referenced in function _main D:\Addem\main.obj Project Error 2 error LNK1120: 1 unresolved externals D:\Addem\Debug\Project.exe 1 1 Project Here is my main.cpp: #include <iostream> using namespace std; extern "C" void calka(); int main() { calka(); system("Pause"); return 0; } And my calka.asm ; The calka Subroutine (calka.asm) public _calka INCLUDELIB

How to print a string inside of a loop in assembly (MASM)

冷暖自知 提交于 2019-12-11 10:38:45
问题 So I'm new to assembly, and my professor is far from helpful when it comes to actually explaining what's happening. In class, we set up loops like this: mov si, 0 mov cx, 5 (repeating the loop 5 times) L1: ... loop L1 And we print strings like this: mov ah, 40h ;write to mov bx, handle ;file mov cx, lmess2 ;number of bytes to write mov dx, offset mess2 ; int 21h So now the issue is that I need to print a string inside the loop. The issue I see with this is that the CX register is used in both

Linking C with Assembly in Visual Studio

蹲街弑〆低调 提交于 2019-12-11 10:26:31
问题 I'm trying to link main.c program with procedure.asm. I have the following C program and Assembly program. main.c #include <Windows.h> #include <iostream> using namespace std; extern "C" { void ClearUsingIndex(int[], int); } static int Array[10] ={1, 2, 3, 4, 5, 6, 7, 8, 9, -1}; int main() { int size = 10; ClearUsingIndex( Array, size); system("pause"); return 0; } procedure.asm ; Listing generated by Microsoft (R) Optimizing Compiler Version 17.00.50727.1 TITLE c:\Users\GS\documents\visual

Addressing variables (or, what is ML64 generating?)

梦想的初衷 提交于 2019-12-11 09:59:57
问题 I have an ASM file written for X64. It provides a leaf function. The file was assembled with MASM64/ML64. The C-pseduo code with a signature is: int GenerateBlock(byte* ptr, size_t size, unsigned int safety) { if (ptr == NUL) return 0; /*FAIL*/ ... } Here's the same portion of ASM code: ;; RCX (in): byte* buffer ;; RDX (in): size_t bsize ;; R8d (in): unsigned int safety ;; RAX (out): bool, success (1), failure (0) ASM_GenerateBlock PROC buffer:QWORD,bsize:QWORD,safety:DWORD LOCAL val:QWORD ;;

MASM: Accessing to global C variable from assembly

╄→гoц情女王★ 提交于 2019-12-11 09:37:48
问题 I'm writing a program to convert image and compare the speed of processing data in C and assembly. I have 3 projects: main project in C DLL in C to convert image DLL in ASM to convert image In C DLL header, I simply wrote: #ifdef PROJEKTC_EXPORTS #define PROJEKTC_API __declspec(dllexport) #else #define PROJEKTC_API __declspec(dllimport) #endif ... extern PROJEKTC_API unsigned int ThreadID; PROJEKTC_API void __cdecl funkcjaC(void* Args); and after including this header, I can access variable

Where to start learning assembly - IDE, examples

佐手、 提交于 2019-12-11 08:44:33
问题 I have a solid knowledge of C#, I can use C quite well, and I am learning C++. I really would like to learn x86 assembly language for Windows, perhaps MASM, but I don't know where to start. The first thing is the IDE. If at all possible I would like a syntax-highlighting, compiling, linking IDE, as I hate using command-line tools. I do have a nice enough editor, so just a compiler and linker GUI would also be fine. Does anybody have any recommendations? I also am going to need some good

how can i get the dos exe build from segments in multiple asm files binary identical to the single asm file version

喜夏-厌秋 提交于 2019-12-11 07:36:15
问题 for an reverse engineering project i want to split an IDA Pro produced asm file into multiple segment files which must result in binary identical executeables binary equal means to me 100% equal: segment-starts, ordering, sizes, opcodes etc. - because its from a reversed exe and only some of the symbols are detected by IDA, mostly just variable or function offsets, etc. so i can't rely on the assembler own ordering of segments,symbols etc. - it needs to be 100% exact or else i introduce

Assembler Problem

一曲冷凌霜 提交于 2019-12-11 07:31:19
问题 I have MASM assembler to "compile" 16 bit programs. When I tried to "compile" my sample, the MASM throw me some errors: error A2004: symbol type conflict warning A4023: with /coff switch, leading underscore required for start address : START my code is: STA SEGMENT STACK DB 100H DUP(0) STA ENDS CODE SEGMENT ASSUME CS:CODE, DS:CODE,SS:STA START:MOV AX,CODE MOV DS, AX MOV DX, OFFSET BOKER MOV AH, 8 INT 21H MOV AX, 4C00H INT 21H BOKER DB 'Hello world!$' CODE ENDS END START Please help! Thanks.

20 Random Strings containing all capital letters

我与影子孤独终老i 提交于 2019-12-11 07:01:26
问题 I need to create a procedure that generates a random string of length L, containing all capital letters. When calling the procedure, I need to pass the value of L in EAX, and pass a pointer to an array of byte that will hold the random string. Then I need to write a test program that calls your procedure 20 times and displays the strings in the console window. The code below wont work it comes back with these errors: Line (33): error A2008: syntax error : main ENDP Line (35): error A2144:

MASM dll memory allocation

ε祈祈猫儿з 提交于 2019-12-11 06:38:54
问题 I need help with my MASM dll. I'm counting elements in array then I want to allocate memory for another array, in C I'm using vector. I tried to use: invoe GetProcessHeap invoke HeapAlloc, eax, HEAP_NO_SERIALIZE + HEAP_ZERO_MEMORY, <size> or invoke GlobalAlloc, GMEM_ZEROINIT, <size> mov tab, eax but I'm getting errors undefined symbol : GetProcessHeap undefined symbol : HeapAlloc I'm using this library in C# application. Can you show me example how can I dynamically allocate memory? 回答1: You