mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2003-09-28, 20:40   #1
dsouza123
 
dsouza123's Avatar
 
Sep 2002

66210 Posts
Default Small windows programs to create and delete the stop.txt file for console ver NFSNET

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
Attached Files
File Type: zip nfstopgo.zip (2.2 KB, 320 views)
dsouza123 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create file to test primes automatically PawnProver44 Information & Answers 18 2016-03-08 00:58
console output to txt file pepi37 Linux 23 2015-09-28 18:23
Tired of all the prpclient console windows? opyrt Prime Sierpinski Project 4 2010-05-31 08:42
nfsnet programs henryzz NFSNET Discussion 2 2007-11-06 14:59
Posted windows programs and source to stop/allow console ver NFSNET dsouza123 NFSNET Discussion 1 2003-09-30 13:58

All times are UTC. The time now is 11:11.


Tue Oct 19 11:11:25 UTC 2021 up 88 days, 5:40, 0 users, load averages: 1.13, 1.12, 1.06

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.