Board index » delphi » Erase Function for Win95 Long Filenames

Erase Function for Win95 Long Filenames

Hello all,

A short while ago I published a note requesting help with the Erase Long
FileName INT 21h service in Windows 95. I had some helpful feedback about
this, but I am now pleased to say that I have cracked the problem.

Basically, I was having a quiet drink with an infinite number of typing
monkeys about their new play called "Macbeth" when one of them happened to
mention that you need to set the SI register to 0, making the *ACTUAL* INT
21h request look like:

AX=$7141
DS:DX-> ASCIIZ long filename
SI=0

This now works fine- goodness knows why!??!.

Errors are indicated by the C flag as described in Ralf Brown's list.

Cheers everyone,
Chris.

 

Re:Erase Function for Win95 Long Filenames


Quote
cjran...@vossnet.co.uk(Chris Rankin) wrote:
>Hello all,

>A short while ago I published a note requesting help with the Erase Long
>FileName INT 21h service in Windows 95. I had some helpful feedback about
>this, but I am now pleased to say that I have cracked the problem.

>Basically, I was having a quiet drink with an infinite number of typing
>monkeys about their new play called "Macbeth" when one of them happened to
>mention that you need to set the SI register to 0, making the *ACTUAL* INT
>21h request look like:

>AX=$7141
>DS:DX-> ASCIIZ long filename
>SI=0

>This now works fine- goodness knows why!??!.

>Errors are indicated by the C flag as described in Ralf Brown's list.

I think Ralf missed the description of the SI register here.  Zero
isn't the only possible value.  Here's what the Win95 Programmer's
reference says about it:

Interrupt 21h Function 7141h Delete File [New - Windows 95]

mov ax, 7141h             ; Delete File

mov ch, MustMatchAttrs    ; see below

mov cl, SearchAttrs       ; see below

mov dx, seg Filename      ; see below

mov ds, dx

mov dx, offset Filename

mov si, WildcardAndAttrs  ; see below

int 21h

jc error

Deletes the given file or files. If the specified filename contains a

wildcard character, this function can delete multiple files that match
the
wildcard.

      Clears the carry flag if successful. Otherwise, the function
sets
the carry flag and sets the AX register to an error value.

MustMatchAttrs

Additional filter on the attributes specified in SearchAttrs. This

parameter can be a combination of these values:

FILE_ATTRIBUTE_NORMAL (0000h)

        The file can be read from or written to. This value is valid
only
if used alone.

FILE_ATTRIBUTE_READONLY (0001h)

        The file can be read from, but not written to.

FILE_ATTRIBUTE_HIDDEN (0002h)

        The file is hidden and does not appear in an ordinary
directory  
listing.

FILE_ATTRIBUTE_SYSTEM (0004h)

        The file is part of the operating system or is used
exclusively  
by it.

FILE_ATTRIBUTE_VOLUME (0008h)

        The name specified by Filename is used as the volume label for

the current medium.

FILE_ATTRIBUTE_DIRECTORY (0010h)

        The name specified by Filename is used as a directory, not a
file.

FILE_ATTRIBUTE_ARCHIVE (0020h)

        The file is an archive file. Applications use this value to
mark  
files for backup or removal.

SearchAttrs

File attributes to search for. This parameter can be a combination of

these values:

FILE_ATTRIBUTE_NORMAL (0000h)

FILE_ATTRIBUTE_READONLY (0001h)

FILE_ATTRIBUTE_HIDDEN (0002h)

FILE_ATTRIBUTE_SYSTEM (0004h)

FILE_ATTRIBUTE_VOLUME (0008h)

FILE_ATTRIBUTE_DIRECTORY (0010h)

FILE_ATTRIBUTE_ARCHIVE (0020h)

Filename

Address of a null-terminated string specifying the name of the file to

delete. If WildcardAndAttrs is 1, the "*" and "?" wildcard characters
are  
permitted in the filename. Long filenames are allowed.

WildcardAndAttrs

Search criteria. This parameter must be one of these values:

0       Wildcard characters are not allowed in Filename. Any specified

        attributes are ignored.

1       Wildcard characters are allowed in Filename. Files with
specified  
        attributes are matched.

Wildcard searches are more flexible in Windows 95 than in MS-DOS. Both
long
filenames and aliases are considered in searches. For example, *1
finds    
Windows 95 filenames (both long filenames and aliases) that end in a 1

and *mid* finds filenames that contain the characters mid. In MS-DOS
and  
in Windows 95 searching on real-mode FAT directories, all characters
after
the first * are ignored.

For more information about how MustMatchAttrs and SearchAttrs are
used,    
see the comments for Find First File (Interrupt 21h Function 714Eh).

- Show quoted text -

Quote
}

Other Threads