WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
 

Little help with coding

s.raj
Quote Post


Member
**

Group: Members
Posts: 34
Member No.: 48809
Joined: 7-January 12


I tried to code a program which reads the first two bytes of file and if its equal to MZ it returns it is valid pe file, can anyone help how its possible of reading of first two bytes of file.
PM
Top
shoorick
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 2301
Member No.: 160
Joined: 22-June 04


to do this you need:
1.read MSDN about WinAPI functions
2.look at tutorials, search and study existing examples
3.take simple examples and modify slightly, check result
4.use debugger to understand how does your code work or why not
5.when you stuck anyway - post your work at forum and ask precise question
PMEmail PosterUsers Website
Top
s.raj
Quote Post


Member
**

Group: Members
Posts: 34
Member No.: 48809
Joined: 7-January 12


I've learn't iczlions tutorials 1-14, but while file handling i'am supposed to obtain handle of file, allocate memory and lock the file and obtain file pointer then how would i read the bytes in memory
PM
Top
shoorick
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 2301
Member No.: 160
Joined: 22-June 04


well, tutorial 12 describes file IO
programming with assembler requires also general understanding CPU and its command set, also, as there is no assembly examples by MS, you must guess how to write same code in assembler using C examples.

QUOTE
obtain file pointer


using search helps very much:

step 1
step 2
step 3
step 4

QUOTE
Return value

If the function succeeds and lpDistanceToMoveHigh is NULL, the return value is the low-order DWORD of the new file pointer.


QUOTE
For information about how to determine the position of a file pointer, see Positioning a File Pointer.
QUOTE
The SetFilePointer function can also be used to query the current file pointer position by specifying a move method of FILE_CURRENT and a distance of zero.


QUOTE
how would i read the bytes in memory


it is very basic manipulation of any CPU. you must read about addressing modes for x86.

simpliest examples:

mov al, buffer ; masm

mov esi,offset buffer
lodsb
or
mov al,[esi]



PMEmail PosterUsers Website
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google