kernel32: Implement CreateSymbolicLinkA/W by reusing a modified IoCreateSymbolicLink
Juan Lang
juan.lang at gmail.com
Mon May 9 18:27:52 CDT 2011
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
More information about the wine-devel
mailing list