EXE has file junk in it

Andrew Evans ade@greennet.net
Wed Jun 11 14:52:00 GMT 1997


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@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list