PathName

Hello !
How can I convert LongPathName to ShortPathName in Kernel mode ?
is it possible ?


Best regards,
foxgen mailto:xxxxx@yandex.ru

Hi,

There is a function in the IFS kit

VOID
RtlGenerate8dot3Name(
IN PUNICODE_STRING Name,
IN BOOLEAN AllowExtendedCharacters,
IN OUT PGENERATE_NAME_CONTEXT Context,
OUT PUNICODE_STRING Name8dot3
);

You are lucky… I recently converted 8.3 names to the long name, which
is more difficult…


Bartjan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yandex
Sent: vrijdag 16 augustus 2002 10:14
To: NT Developers Interest List
Subject: [ntdev] PathName

Hello !
How can I convert LongPathName to ShortPathName in Kernel
mode ? is it possible ?


Best regards,
foxgen mailto:xxxxx@yandex.ru


You are currently subscribed to ntdev as: xxxxx@zeelandnet.nl
To unsubscribe send a blank email to %%email.unsub%%

ZwQueryInformationFile, FILE_INFORMATION_CLASS FileBothDirectoryInformation.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@yandex
Sent: Friday, August 16, 2002 4:14 AM
To: NT Developers Interest List
Subject: [ntdev] PathName

Hello !
How can I convert LongPathName to ShortPathName in Kernel mode ?
is it possible ?


Best regards,
foxgen mailto:xxxxx@yandex.ru


You are currently subscribed to ntdev as: xxxxx@bwandel.com
To unsubscribe send a blank email to %%email.unsub%%

Hi Bill,

I could not find a description of “FileBothDirectoryInformation”, even not
in the latest XP Beta DDK. Will this once be provided ?

Christiaan

It’s in ifsddk(ntifs.h).

-----Original Message-----
From: Ghijselinck [mailto:xxxxx@Compaqnet.be]
Sent: Friday, August 16, 2002 5:04 PM
To: NT Developers Interest List
Subject: [ntdev] RE: PathName

Hi Bill,

I could not find a description of “FileBothDirectoryInformation”, even not
in the latest XP Beta DDK. Will this once be provided ?

Christiaan


You are currently subscribed to ntdev as: xxxxx@ati.com
To unsubscribe send a blank email to %%email.unsub%%

A better way is to use ZwQueryInformationFile with
FileQueryAlternateNameInformation. It fills in a FILE_NAME_INFORMATION
structure with the 8.3 name. I had forgotton about this information class.

I got this from the Windows NT/2000 Native API Reference book by Gary
Nebbett.

The enum is defined in ntddk.h/wdm.h.

The struct is
struct _FILE_BOTH_DIRECTORY_INFORMATION
{
ULONG NextEntryOffset;
ULONG Unknown;
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER EndOfFile;
LARGE_INTEGER AllocationSize;
ULONG FileAttributes;
ULONG FileNameLength;
ULONG EaInformationLength;
UCHAR AlternateNameLength;
WCHAR AlternateName[12];
WCHAR FileName[1];
};

The Alternate name is the 8.3 name.
I think that you have to open the directory with ZwOpenFile and use
ZwQueryDirectoryFile to get the info.

NTSYSAPI
NTSTATUS
NTAPI
ZwQueryDirectoryFile (
IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass,
IN BOOLEAN ReturnSingleEntry,
IN PUNICODE_STRING FileName OPTIONAL,
IN BOOLEAN RestartScan
);
You open the directory and set the FileName parameter to the file name that
you are interested in.

Someone else mentioned using one of the Rtl functions that are defined in
ntifs.h.

The problem with this is that you are using undocumented stuff which can get
you in trouble in the future.

The book seems to be pretty complete for the functions that are exported
from NtDll.dll.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ghijselinck
Sent: Friday, August 16, 2002 5:04 PM
To: NT Developers Interest List
Subject: [ntdev] RE: PathName

Hi Bill,

I could not find a description of “FileBothDirectoryInformation”, even not
in the latest XP Beta DDK. Will this once be provided ?

Christiaan


You are currently subscribed to ntdev as: xxxxx@bwandel.com
To unsubscribe send a blank email to %%email.unsub%%