Set end of file in kernel 9x?

Hello,

While working on a 9x driver (yep that still exists… :-() I wanted to
change a file size (more exactly, to shrink it). But I couldn’t find set end
of file call within the ring0 file functions:

#define R0_OPENCREATFILE 0xD500 /* Open/Create a file */
#define R0_OPENCREAT_IN_CONTEXT 0xD501 /* Open/Create file in current
context */
#define R0_READFILE 0xD600 /* Read a file, no
context */
#define R0_WRITEFILE 0xD601 /* Write to a file, no
context */
#define R0_READFILE_IN_CONTEXT 0xD602 /* Read a file, in thread context */
#define R0_WRITEFILE_IN_CONTEXT 0xD603 /* Write to a file, in thread
context */
#define R0_CLOSEFILE 0xD700 /* Close a file */
#define R0_GETFILESIZE 0xD800 /* Get size of a file */
#define R0_FINDFIRSTFILE 0x4E00 /* Do a LFN FindFirst
operation */
#define R0_FINDNEXTFILE 0x4F00 /* Do a LFN FindNext
operation */
#define R0_FINDCLOSEFILE 0xDC00 /* Do a LFN FindClose
operation */
#define R0_FILEATTRIBUTES 0x4300 /* Get/Set Attributes of a
file */
#define R0_RENAMEFILE 0x5600 /* Rename a file */
#define R0_DELETEFILE 0x4100 /* Delete a file */
#define R0_LOCKFILE 0x5C00 /* Lock/Unlock a
region in a file */
#define R0_GETDISKFREESPACE 0x3600 /* Get disk free space */
#define R0_READABSOLUTEDISK 0xDD00 /* Absolute disk read */
#define R0_WRITEABSOLUTEDISK 0xDE00 /* Absolute disk write */

Does someone know how to shrink a file on kernel 9x?

Best regards,

David Burg


David Burg
Software Development,
InCD Project Leader

Ahead Software AG phone: +49 (0)7248 911 862 (direct line)
Im Stoeckmaedle 18 fax: +49 (0)7248 911 888
76307 Karlsbad email: xxxxx@nero.com
Germany http://www.nero.com

If I recall correctly, the way it worked in 9x was to perform a zero length
write at the specified location. I don’t know if that works in kernel mode,
but it is worth a try.

Neil

----- Original Message -----
From: “David Burg”
To: “Windows File Systems Devs Interest List”
Sent: Friday, July 23, 2004 10:35 AM
Subject: [ntfsd] Set end of file in kernel 9x?

Hello,

While working on a 9x driver (yep that still exists… :-() I wanted to
change a file size (more exactly, to shrink it). But I couldn’t find set end
of file call within the ring0 file functions:

#define R0_OPENCREATFILE 0xD500 /* Open/Create a file /
#define R0_OPENCREAT_IN_CONTEXT 0xD501 /
Open/Create file in current
context /
#define R0_READFILE 0xD600 /
Read a file, no
context /
#define R0_WRITEFILE 0xD601 /
Write to a file, no
context /
#define R0_READFILE_IN_CONTEXT 0xD602 /
Read a file, in thread context /
#define R0_WRITEFILE_IN_CONTEXT 0xD603 /
Write to a file, in thread
context /
#define R0_CLOSEFILE 0xD700 /
Close a file /
#define R0_GETFILESIZE 0xD800 /
Get size of a file /
#define R0_FINDFIRSTFILE 0x4E00 /
Do a LFN FindFirst
operation /
#define R0_FINDNEXTFILE 0x4F00 /
Do a LFN FindNext
operation /
#define R0_FINDCLOSEFILE 0xDC00 /
Do a LFN FindClose
operation /
#define R0_FILEATTRIBUTES 0x4300 /
Get/Set Attributes of a
file /
#define R0_RENAMEFILE 0x5600 /
Rename a file /
#define R0_DELETEFILE 0x4100 /
Delete a file /
#define R0_LOCKFILE 0x5C00 /
Lock/Unlock a
region in a file /
#define R0_GETDISKFREESPACE 0x3600 /
Get disk free space /
#define R0_READABSOLUTEDISK 0xDD00 /
Absolute disk read /
#define R0_WRITEABSOLUTEDISK 0xDE00 /
Absolute disk write */

Does someone know how to shrink a file on kernel 9x?

Best regards,

David Burg

Yep, that’s the way. (Wasn’t cool not knowing that and trying to figure why
encryption filter doesn’t decrypt correctly:-)))

Neil Weicher wrote:

If I recall correctly, the way it worked in 9x was to perform a zero length write
at the specified location. I don’t know if that works in kernel mode, but it is
worth a try.


Kind regards, Dejan M. MVP for DDK
http://www.alfasp.com E-mail: xxxxx@alfasp.com
Alfa Transparent File Encryptor - Transparent file encryption services.
Alfa File Protector - File protection and hiding library for Win32 developers.
Alfa File Monitor - File monitoring library for Win32 developers.