mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Programming (https://www.mersenneforum.org/forumdisplay.php?f=29)
-   -   Small windows programs to create and delete the stop.txt file for console ver NFSNET (https://www.mersenneforum.org/showthread.php?t=1169)

dsouza123 2003-09-28 20:40

Small windows programs to create and delete the stop.txt file for console ver NFSNET
 
1 Attachment(s)
I have attached two programs nfs_stop.exe and nfs_go.exe
they are written in MASM and work in 32-bit Windows 98SE, 2000, XP.

Used ML 6.14.8444 to assemble and LINK 5.12.8078 to link.

The source is included.

nfs_stop.exe writes the text file stop.txt in C:\NFSNET\processors\p0 causing the console version of NFSNET to stop as soon as it can

nfs_go.exe deletes stop.txt

In windows the path and filename are Not case sensitive.
If you have a different path then you will most likely need to reassemble and link.

;== here is code common to both ==
.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

;== here is nfs_stop ==
.data
szFullPathStop db "C:\NFSNET\processors\p0\stop.txt",0
szBuffStop db "stop",0
szCaption db "NFS_Stop",0
hFile dd 0
fwritten dd 0

.code
start:

; write stop to textfile C:\NFSNET\PROCESSORS\P0\stop.txt

invoke CreateFile,ADDR szFullPathStop,GENERIC_WRITE,FILE_SHARE_READ,0,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov hFile,eax
invoke SetFilePointer,hFile,0,0,FILE_END
invoke lstrlen,ADDR szBuffStop
invoke WriteFile,hFile,ADDR szBuffStop,eax,ADDR fwritten,0
invoke CloseHandle,hFile

invoke MessageBox,0,ADDR szFullPathStop,ADDR szCaption,MB_OK

mov eax,0
invoke ExitProcess,eax
end start

;== here is nfs_go ==

.data
szFullPathStop db "C:\NFSNET\processors\p0\stop.txt",0
szBuffStop db "stop",0
szCaption db "NFS_Go",0
szDeleted db "Deleted C:\NFSNET\processors\p0\stop.txt",0
szNotFound db "Not Found C:\NFSNET\processors\p0\stop.txt",0

.code
start:

; delete file C:\NFSNET\PROCESSORS\P0\stop.txt

invoke DeleteFile,ADDR szFullPathStop
.if eax == TRUE
lea edx,szDeleted
.else
lea edx,szNotFound
.endif

invoke MessageBox,0,edx,ADDR szCaption,MB_OK

mov eax,0
invoke ExitProcess,eax
end start


All times are UTC. The time now is 23:40.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.