-
Notifications
You must be signed in to change notification settings - Fork 0
/
cApp_15.asm
71 lines (56 loc) · 1.26 KB
/
cApp_15.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.386 ; Set processor type
.model flat, stdcall ; 32-bit memory model
option casemap:none ; Case sensitive
include std.inc
; Data section
.data
szWindowTitle db "Asesh", 0h
szSucceeded db "Create file succeeded", 0h
szFaild db "Create file failed", 0h
szFileName db "EN_Visual_Studio_Team_System_2008_Team_Suite_x86_x64wow_DVD.01.sdc", 0h
hFile dd 0h
; Uninitialized data section
.data?
szBuffer db 9h dup (?)
.code
_start:
push offset szWindowTitle
call SetConsoleTitle
call main
mainLoop:
push 01Bh
call GetAsyncKeyState
cmp eax, 0h
jne exitMainLoop
push 064h
call Sleep
jmp mainLoop
exitMainLoop:
push hFile
call CloseHandle
ret
main proc
push 0h
push 0h
push OPEN_EXISTING
push 0h
mov eax, FILE_SHARE_READ
or eax, FILE_SHARE_WRITE
push eax
mov eax, GENERIC_READ
or eax, GENERIC_WRITE
push eax
push offset szFileName
call CreateFile
cmp eax, INVALID_HANDLE_VALUE
je _errorOpeningFile
mov hFile, eax
print chr$("The specified file : ")
print str$(szFileName)
print chr$(" has been locked to prevent deleting", 0Ah)
ret
_errorOpeningFile:
print chr$("Error opening the specified file", 0Ah)
ret
main endp
end _start