|
From: Ladislav M. <la...@li...> - 2010-08-13 20:50:24
|
Vincent Richomme <forumer@...> writes:
> Hi,
>
> please find a better version of patch.
Hi, patch is somehow hard to read, comments inline, patch shrunk to make
it more readable. A bit consolidated and a bit fixed patch follows.
> I will comment later because I don't have time right now.
Hmm, several months of silence... Nobody interested in such a cool feature?
I'll work on it if there is a chance to get it merged as I pretty much need
it.
> Just to sump up now symlinks respect relative path (that was not the case
> with my first patch).
I was unable to make junction work at all and had to use absolute paths.
> I recommend to test on Windows Vista/7 with admin priviledges and to use
> cygwin 1.7 or standard command line to see results.
>
>
> +/* msys_symlink.c
[snip]
> +/*
> +* MSYS DOESN'T SEEM TO ALLOW TO USE WCHAR FUNCTIONS
> +* SO WE REDECLARE SIMPLE ONES
> +*/
lstrlenW and friends work for me, changed to use them.
...
> + hFile = CreateFileW (wszNewPath, GENERIC_READ | GENERIC_WRITE, 0, 0,
> + OPEN_ALWAYS,
here we probably want to use FILE_EXISTING
...
> +static int
> +symlink_env_init (symlink_env_t *symlink_env)
...
> + memset(symlink_env, 0, sizeof(symlink_env_t));
> + symlink_env->symlink_to_file = create_copy_dir;
> + symlink_env->symlink_to_dir = create_copy_file;
I wonder if this code ever worked...
...
> + if ((strncmp ((const char*)fsname_buff, "NTFS", 4) == 0))
Here we probably do not want to check for NTFS filesystem type, but rather
FILE_SUPPORTS_REPARSE_POINTS flag. Also we do not want to query current
directory, but one we are going to make symlink on.
> + {
> + /* Before Windows Vista */
> + if ((dwMajVer < 6))
> + {
> + symlink_env->symlink_to_file = create_hard_link;
> + symlink_env->symlink_to_dir = create_junction;
> + symlink_env->symlink_to_dir = create_copy_dir;
> + }
> + else
> + {
> + /*
> + * Check if we have admin permissions
> + * TODO : check if we can implement native symlink
> + * without admin perms
> + */
> + if (has_admin_perms () == TRUE)
Here we do not want to check for admin permitions, but rather for
SeCreateSymbolicLinkPrivilege, which is assigned only to administrator
by default.
Anyway, thank you for very nice work. Hopefully one day it will get merged.
Best regards,
ladis
|