Hi André,

+    NtCreateSymbolicLinkObject( &handle, STANDARD_RIGHTS_REQUIRED |
0x1 /* SYMBOLIC_LINK_ALL_ACCESS */,
+                                &attr, &targetstr );
+    RtlFreeUnicodeString(&linkstr);
+    RtlFreeUnicodeString(&targetstr);
+    /* FIXME: store handle somewhere */
+    return handle != INVALID_HANDLE_VALUE;

Your fixme already indicates you need to do something different:
you're introducing a handle leak.  Since the caller has no access to
it, what's its use?  Simply close it.

Also, rather than test the handle value, NtCreateSymbolicLinkObject
already has a more direct way to return success: its return value.
I'd suggest you use that instead.

Finally, any reason you don't call CreateSymbolicLinkW from
CreateSymbolicLinkA?  This is the usual way we implement things, and
avoids having to fix two places if one turns out to be incorrect.

Thanks,
--Juan


Reply via email to