delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/06/11/22:13:15

From: ade AT greennet DOT net (Andrew Evans)
Subject: RE: EXE has file junk in it
11 Jun 1997 22:13:15 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <19970611203914116.AAA73.cygnus.gnu-win32@balingwire>
Mime-Version: 1.0
Comments: Authenticated sender is <ade@[208.192.4.16]>
Original-To: gnu-win32 AT cygnus DOT com
Original-CC: Sergey Okhapkin <sos AT prospect DOT com DOT ru>
In-reply-to: <01BC74C4.E9B55B40@gater.krystalbank.msk.ru>
X-mailer: Pegasus Mail for Win32 (v2.53/R1)
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Sergey Okhapkin wrote:

> I just tried my seek test on NTWS 4.0 - resulting file is zero-filled...

I wrote something similar, though it uses stdio rather than UNIX I/O 
functions.  It produced files with zero-filled empty space on NT 3.51 
and NT 4.0 boxes.  3.51 box is the Workstation distribution with the 
appropriate registry tweaks to make it run in server mode.  4.0 box 
is an unmodified Workstation distribution.  Since the 
workstation/server kernels are identical save for the registry keys 
that determine which mode they run in, I tend to suspect that a 
"real" server distribution would produce files with zero-filled empty 
space as well.

Here's my test program, compiled on VC++ 4.2:

#include <stdio.h>
#include <stdlib.h>

void main()
{
 FILE* fp;

 if (! (fp = fopen("c:\\temp\\empty.dat", "wb")))
 {
  fprintf(stderr, "Can't open file for writing\n");
  exit(1);
 }
 if (fseek(fp, 20971520, SEEK_END))	// create 20MB of empty data
 {
  fprintf(stderr, "Can't seek past EOF\n");
  exit(1);
 }
 if (! fprintf(fp, "That's all, folks\n"))
 {
  fprintf(stderr, "Can't write to file\n");
  exit(1);
 }
 fclose(fp);
 exit(0);
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019