Problems with NtOpenSymbolicLinkObject...
I am trying to get the directory that a "directory" symbolic link "points to"
in Vista. (I actually need this in my application!) To do this I have to
call the "NtQuerySymbolicLinkObject" Windows API function, but prior to
calling the "NtQuerySymbolicLinkObject" routine, I have to call
"NtOpenSymbolicLinkObject" to "open" the symbolic link. (I have to call
"LoadLibrary" and "GetProcAddress" several times to get the actual run-time
addresses of these routines because they are not "exported" in the C++
run-time libraries), but that part is working fine!). Anyway, the result of
calling "NtOpenSymbolicLinkObject" is an "Invalid Parameter Information"
error at line 42 in function "wcscat_s" located in file "tcscat_s.inl", where
the expression that caused the error is "(L"Buffer is too small" && 0)"
(???). (I have fairly complete error catching and reporting in the
program.) To supply more (needed) information, the parameters to the
"NtOpenSymbolicLinkObject" routine are as follows:
ObjectAttributes.Length = 24
ObjectAttributes.RootDirectory = 0x00000000
ObjectAttributes.ObjectName = 0x0019a970
ObjectAttributes.ObjectName -> Buffer = ""
ObjectAttributes.ObjectName -> MaximumLength = 2048
ObjectAttributes.ObjectName -> Length = 0
ObjectAttributes.Attributes = 0x80000200
(OBJ_KERNEL_HANDLE | GENERIC_READ)
ObjectAttributes.SecurityDescriptor = 0x00000000
ObjectAttributes.SecurityQualityOfService = 0x00000000
From what I can tell from reading the (limited!) documentation, these
parameters are all correct, and I have tried MANY (!) variations, all with no
success. Bottom line: HELP!!! I've been fooling with this for two whole
days with no results!
date: Thu, 24 Jul 2008 20:15:02 -0700
author: DanTheMostlyRetiredMan