19#define WIN32_NO_STATUS
25#define MAX_DIR_ENTRY 256
38 while (*szU) {*szA++ = (
CHAR) (0x00ff & * szU++);}
54 while (*szA) {*szW++ = (
WCHAR) *szA++;}
65 static char RawValue [16];
70 return "STATUS_BUFFER_TOO_SMALL";
72 return "STATUS_INVALID_PARAMETER";
74 return "STATUS_OBJECT_NAME_INVALID";
76 return "STATUS_OBJECT_NAME_NOT_FOUND";
78 return "STATUS_PATH_SYNTAX_BAD";
80 return "STATUS_NO_MORE_ENTRIES";
82 return "STATUS_MORE_ENTRIES";
84 return "STATUS_ACCESS_DENIED";
86 return "STATUS_UNSUCCESSFUL";
88 return "STATUS_INVALID_HANDLE";
91 return (
const char *) RawValue;
108 ULONG DataWritten = 0;
111 Path.Buffer = PathBuffer;
113 Path.MaximumLength =
sizeof PathBuffer;
116 if (
L'\\' !=
Path.Buffer [(
Path.Length /
sizeof Path.Buffer[0]) - 1])
138 "Failed to open SymbolicLink object (Status: %s)\n",
143 TargetObjectName->Length = TargetObjectName->MaximumLength;
145 TargetObjectName->Buffer,
147 TargetObjectName->MaximumLength
157 "Failed to query SymbolicLink object (Status: %s)\n",
179 BYTE DirectoryEntry [512];
184 ULONG EntryCount = 0;
195 RawUszAsz (DirectoryNameW->Buffer, DirectoryNameA);
217 "Failed to open directory object \"%s\" (Status: %s)\n",
223 printf (
"\n Directory of %s\n\n", DirectoryNameA);
233 sizeof DirectoryEntry,
242 "Failed to query directory object (Status: %s)\n",
252 pDirectoryEntry = pDirectoryEntries;
263 & pDirectoryEntry->
Name,
279 "%-16s %s -> (error!)\n",
297 printf (
"\n\t%lu object(s)\n", EntryCount);
305 if (
FALSE != Recurse)
315 CurrentName [0] =
L'\0';
316 wcscpy (CurrentName, DirectoryNameW->Buffer);
317 if (
wcslen (CurrentName) > 1)
351 "%s: unknown option '%s'.\n",
362 "\nUsage: %s [-r] directory\n\n"
364 " directory a directory name in the system namespace\n\n",
static HANDLE DirectoryHandle
PRTL_UNICODE_STRING_BUFFER Path
int strcmp(const char *String1, const char *String2)
WCHAR CurrentDirectory[1024]
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
GLboolean GLboolean GLboolean GLboolean a
GLubyte GLubyte GLubyte GLubyte w
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define sprintf(buf, format,...)
#define InitializeObjectAttributes(p, n, a, r, s)
struct _OBJECT_DIRECTORY_INFORMATION * POBJECT_DIRECTORY_INFORMATION
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define SYMBOLIC_LINK_QUERY
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define STATUS_INVALID_HANDLE
#define STATUS_OBJECT_PATH_SYNTAX_BAD
#define STATUS_NO_MORE_ENTRIES
NTSTATUS NTAPI NtOpenDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
NTSTATUS NTAPI NtQueryDirectoryObject(IN HANDLE DirectoryHandle, OUT PVOID Buffer, IN ULONG BufferLength, IN BOOLEAN ReturnSingleEntry, IN BOOLEAN RestartScan, IN OUT PULONG Context, OUT PULONG ReturnLength OPTIONAL)
static PCHAR WINAPI RawUszAsz(PWCHAR szU, PCHAR szA)
static PWCHAR WINAPI RawAszUsz(PCHAR szA, PWCHAR szW)
BOOL WINAPI ExpandSymbolicLink(IN PUNICODE_STRING DirectoryName, IN PUNICODE_STRING SymbolicLinkName, IN OUT PUNICODE_STRING TargetObjectName)
static const char *WINAPI StatusToName(NTSTATUS Status)
BOOL WINAPI ListDirectory(IN PUNICODE_STRING DirectoryNameW, IN BOOL Recurse)
NTSTATUS NTAPI NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, OUT PUNICODE_STRING LinkTarget, OUT PULONG ResultLength OPTIONAL)
NTSTATUS NTAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define STATUS_BUFFER_TOO_SMALL
PVOID SecurityQualityOfService
PUNICODE_STRING ObjectName
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_MORE_ENTRIES
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_OBJECT_NAME_NOT_FOUND
struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName